summaryrefslogtreecommitdiff
path: root/ale_linters/pug
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-08-02 23:44:12 +0100
committerw0rp <devw0rp@gmail.com>2018-08-02 23:44:12 +0100
commit217284360d35711b751859ed27a7a3c3da300e85 (patch)
tree4b26a84b397e3ac15a8b13a572b1f9a50312dbab /ale_linters/pug
parent9ef266d050d698c3ed3be3456ce6a5da5755d5ef (diff)
downloadale-217284360d35711b751859ed27a7a3c3da300e85.zip
Simplify the code for most linters and tests with closures
Diffstat (limited to 'ale_linters/pug')
-rw-r--r--ale_linters/pug/puglint.vim14
1 files changed, 4 insertions, 10 deletions
diff --git a/ale_linters/pug/puglint.vim b/ale_linters/pug/puglint.vim
index 165e68b7..63208986 100644
--- a/ale_linters/pug/puglint.vim
+++ b/ale_linters/pug/puglint.vim
@@ -5,12 +5,6 @@ call ale#Set('pug_puglint_options', '')
call ale#Set('pug_puglint_executable', 'pug-lint')
call ale#Set('pug_puglint_use_global', get(g:, 'ale_use_global_executables', 0))
-function! ale_linters#pug#puglint#GetExecutable(buffer) abort
- return ale#node#FindExecutable(a:buffer, 'pug_puglint', [
- \ 'node_modules/.bin/pug-lint',
- \])
-endfunction
-
function! s:FindConfig(buffer) abort
for l:filename in [
\ '.pug-lintrc',
@@ -29,19 +23,19 @@ function! s:FindConfig(buffer) abort
endfunction
function! ale_linters#pug#puglint#GetCommand(buffer) abort
- let l:executable = ale_linters#pug#puglint#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'pug_puglint_options')
let l:config = s:FindConfig(a:buffer)
- return ale#Escape(l:executable)
- \ . (!empty(l:options) ? ' ' . l:options : '')
+ return '%e' . ale#Pad(l:options)
\ . (!empty(l:config) ? ' -c ' . ale#Escape(l:config) : '')
\ . ' -r inline %t'
endfunction
call ale#linter#Define('pug', {
\ 'name': 'puglint',
-\ 'executable_callback': 'ale_linters#pug#puglint#GetExecutable',
+\ 'executable_callback': ale#node#FindExecutableFunc('pug_puglint', [
+\ 'node_modules/.bin/pug-lint',
+\ ]),
\ 'output_stream': 'stderr',
\ 'command_callback': 'ale_linters#pug#puglint#GetCommand',
\ 'callback': 'ale#handlers#unix#HandleAsError',