Use ale#Var in linters that didn't use it yet

This commit is contained in:
Adriaan Zonnenberg 2017-04-28 00:01:01 +02:00
parent ba6dbde906
commit 7230cbe9e4
4 changed files with 10 additions and 13 deletions

View File

@ -11,20 +11,20 @@ let g:ale_javascript_xo_use_global =
\ get(g:, 'ale_javascript_xo_use_global', 0)
function! ale_linters#javascript#xo#GetExecutable(buffer) abort
if g:ale_javascript_xo_use_global
return g:ale_javascript_xo_executable
if ale#Var(a:buffer, 'javascript_xo_use_global')
return ale#Var(a:buffer, 'javascript_xo_executable')
endif
return ale#path#ResolveLocalPath(
\ a:buffer,
\ 'node_modules/.bin/xo',
\ g:ale_javascript_xo_executable
\ ale#Var(a:buffer, 'javascript_xo_executable')
\)
endfunction
function! ale_linters#javascript#xo#GetCommand(buffer) abort
return ale_linters#javascript#xo#GetExecutable(a:buffer)
\ . ' ' . g:ale_javascript_xo_options
\ . ' ' . ale#Var(a:buffer, 'javascript_xo_options')
\ . ' --reporter unix --stdin --stdin-filename %s'
endfunction

View File

@ -20,12 +20,6 @@ function! ale_linters#sh#shellcheck#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'sh_shellcheck_executable')
endfunction
if g:ale_linters_sh_shellcheck_exclusions !=# ''
let s:exclude_option = '-e ' . g:ale_linters_sh_shellcheck_exclusions
else
let s:exclude_option = ''
endif
function! s:GetDialectArgument() abort
if exists('b:is_bash') && b:is_bash
return '-s bash'
@ -39,9 +33,12 @@ function! s:GetDialectArgument() abort
endfunction
function! ale_linters#sh#shellcheck#GetCommand(buffer) abort
let l:exclude_option = ale#Var(a:buffer, 'linters_sh_shellcheck_exclusions')
return ale_linters#sh#shellcheck#GetExecutable(a:buffer)
\ . ' ' . ale#Var(a:buffer, 'sh_shellcheck_options')
\ . ' ' . s:exclude_option . ' ' . s:GetDialectArgument() . ' -f gcc -'
\ . ' ' . (!empty(l:exclude_option) ? '-e ' . l:exclude_option : '')
\ . ' ' . s:GetDialectArgument() . ' -f gcc -'
endfunction
call ale#linter#Define('sh', {

View File

@ -39,7 +39,7 @@ function! ale_linters#sml#smlnj#Handle(buffer, lines) abort
return l:out
endfunction
call g:ale#linter#Define('sml', {
call ale#linter#Define('sml', {
\ 'name': 'smlnj',
\ 'executable': 'sml',
\ 'command': 'sml',

View File

@ -53,7 +53,7 @@ g:ale_linters_sh_shellcheck_exclusions *g:ale_linters_sh_shellcheck_exclusions*
will be sourced by other scripts, use the buffer-local variant:
>
autocmd BufEnter PKGBUILD,.env
\ let b:ale_sh_shellcheck_exclusions = 'SC2034,SC2154,SC2164'
\ let b:ale_linters_sh_shellcheck_exclusions = 'SC2034,SC2154,SC2164'
<
-------------------------------------------------------------------------------