summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-04-16 01:24:08 +0100
committerw0rp <devw0rp@gmail.com>2017-04-16 01:24:08 +0100
commite97dada261c4a69f43c5a6c34d349ad6246fe34c (patch)
treebbaf8aec8ec0474251bdd3e183eb93d06d80c792 /ale_linters
parente80116cee03af66bb229c3f570f0b2f244f0a197 (diff)
downloadale-e97dada261c4a69f43c5a6c34d349ad6246fe34c.zip
#427 Implement buffer variable overrides for all linter options
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/asm/gcc.vim2
-rw-r--r--ale_linters/c/clang.vim2
-rw-r--r--ale_linters/c/cppcheck.vim2
-rw-r--r--ale_linters/c/gcc.vim2
-rw-r--r--ale_linters/chef/foodcritic.vim4
-rw-r--r--ale_linters/cmake/cmakelint.vim4
-rw-r--r--ale_linters/cpp/clang.vim2
-rw-r--r--ale_linters/cpp/clangtidy.vim2
-rw-r--r--ale_linters/cpp/cppcheck.vim10
-rw-r--r--ale_linters/cpp/gcc.vim2
-rw-r--r--ale_linters/cs/mcs.vim2
-rw-r--r--ale_linters/css/stylelint.vim8
-rw-r--r--ale_linters/erlang/erlc.vim4
-rw-r--r--ale_linters/fortran/gcc.vim6
-rw-r--r--ale_linters/go/gometalinter.vim2
-rw-r--r--ale_linters/handlebars/embertemplatelint.vim6
-rw-r--r--ale_linters/html/htmlhint.vim18
-rw-r--r--ale_linters/html/tidy.vim6
-rw-r--r--ale_linters/java/javac.vim6
-rw-r--r--ale_linters/javascript/eslint.vim8
-rw-r--r--ale_linters/javascript/flow.vim6
-rw-r--r--ale_linters/javascript/jshint.vim6
-rw-r--r--ale_linters/javascript/standard.vim8
-rw-r--r--ale_linters/lua/luacheck.vim2
-rw-r--r--ale_linters/matlab/mlint.vim2
-rw-r--r--ale_linters/perl/perl.vim4
-rw-r--r--ale_linters/php/phpcs.vim14
-rw-r--r--ale_linters/php/phpmd.vim2
-rw-r--r--ale_linters/puppet/puppetlint.vim4
-rw-r--r--ale_linters/python/flake8.vim5
-rw-r--r--ale_linters/python/mypy.vim6
-rw-r--r--ale_linters/python/pylint.vim4
-rw-r--r--ale_linters/ruby/rubocop.vim2
-rw-r--r--ale_linters/rust/cargo.vim2
-rw-r--r--ale_linters/sass/stylelint.vim6
-rw-r--r--ale_linters/scss/scsslint.vim2
-rw-r--r--ale_linters/scss/stylelint.vim6
-rw-r--r--ale_linters/sh/shell.vim2
-rw-r--r--ale_linters/sh/shellcheck.vim4
-rw-r--r--ale_linters/tex/chktex.vim4
-rw-r--r--ale_linters/tex/lacheck.vim4
-rw-r--r--ale_linters/typescript/tslint.vim20
-rw-r--r--ale_linters/vim/vint.vim2
-rw-r--r--ale_linters/yaml/yamllint.vim4
44 files changed, 111 insertions, 108 deletions
diff --git a/ale_linters/asm/gcc.vim b/ale_linters/asm/gcc.vim
index 2ef7924e..c25d4aec 100644
--- a/ale_linters/asm/gcc.vim
+++ b/ale_linters/asm/gcc.vim
@@ -6,7 +6,7 @@ let g:ale_asm_gcc_options = get(g:, 'ale_asm_gcc_options', '-Wall')
function! ale_linters#asm#gcc#GetCommand(buffer) abort
return 'gcc -x assembler -fsyntax-only '
\ . '-iquote ' . fnameescape(fnamemodify(bufname(a:buffer), ':p:h'))
- \ . ' ' . g:ale_asm_gcc_options . ' -'
+ \ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
endfunction
function! ale_linters#asm#gcc#Handle(buffer, lines) abort
diff --git a/ale_linters/c/clang.vim b/ale_linters/c/clang.vim
index 489245da..38e0d480 100644
--- a/ale_linters/c/clang.vim
+++ b/ale_linters/c/clang.vim
@@ -14,7 +14,7 @@ function! ale_linters#c#clang#GetCommand(buffer) abort
" headers in the same directory.
return 'clang -S -x c -fsyntax-only '
\ . '-iquote ' . fnameescape(fnamemodify(bufname(a:buffer), ':p:h'))
- \ . ' ' . g:ale_c_clang_options . ' -'
+ \ . ' ' . ale#Var(a:buffer, 'c_clang_options') . ' -'
endfunction
call ale#linter#Define('c', {
diff --git a/ale_linters/c/cppcheck.vim b/ale_linters/c/cppcheck.vim
index 7b89bee4..e4e8eb0c 100644
--- a/ale_linters/c/cppcheck.vim
+++ b/ale_linters/c/cppcheck.vim
@@ -6,7 +6,7 @@ let g:ale_c_cppcheck_options = get(g:, 'ale_c_cppcheck_options', '--enable=style
function! ale_linters#c#cppcheck#GetCommand(buffer) abort
return 'cppcheck -q --language=c '
- \ . g:ale_c_cppcheck_options
+ \ . ale#Var(a:buffer, 'c_cppcheck_options')
\ . ' %t'
endfunction
diff --git a/ale_linters/c/gcc.vim b/ale_linters/c/gcc.vim
index c89fae72..7eed0f45 100644
--- a/ale_linters/c/gcc.vim
+++ b/ale_linters/c/gcc.vim
@@ -14,7 +14,7 @@ function! ale_linters#c#gcc#GetCommand(buffer) abort
" headers in the same directory.
return 'gcc -S -x c -fsyntax-only '
\ . '-iquote ' . fnameescape(fnamemodify(bufname(a:buffer), ':p:h'))
- \ . ' ' . g:ale_c_gcc_options . ' -'
+ \ . ' ' . ale#Var(a:buffer, 'c_gcc_options') . ' -'
endfunction
call ale#linter#Define('c', {
diff --git a/ale_linters/chef/foodcritic.vim b/ale_linters/chef/foodcritic.vim
index e6d1ddb6..8fa2dfe9 100644
--- a/ale_linters/chef/foodcritic.vim
+++ b/ale_linters/chef/foodcritic.vim
@@ -36,8 +36,8 @@ endfunction
function! ale_linters#chef#foodcritic#GetCommand(buffer) abort
return printf('%s %s %%t',
- \ g:ale_chef_foodcritic_executable,
- \ escape(g:ale_chef_foodcritic_options, '~')
+ \ ale#Var(a:buffer, 'chef_foodcritic_executable'),
+ \ escape(ale#Var(a:buffer, 'chef_foodcritic_options'), '~')
\)
endfunction
diff --git a/ale_linters/cmake/cmakelint.vim b/ale_linters/cmake/cmakelint.vim
index fb876c66..baf9e235 100644
--- a/ale_linters/cmake/cmakelint.vim
+++ b/ale_linters/cmake/cmakelint.vim
@@ -8,12 +8,12 @@ let g:ale_cmake_cmakelint_options =
\ get(g:, 'ale_cmake_cmakelint_options', '')
function! ale_linters#cmake#cmakelint#Executable(buffer) abort
- return g:ale_cmake_cmakelint_executable
+ return ale#Var(a:buffer, 'cmake_cmakelint_executable')
endfunction
function! ale_linters#cmake#cmakelint#Command(buffer) abort
return ale_linters#cmake#cmakelint#Executable(a:buffer)
- \ . ' ' . g:ale_cmake_cmakelint_options . ' %t'
+ \ . ' ' . ale#Var(a:buffer, 'cmake_cmakelint_options') . ' %t'
endfunction
call ale#linter#Define('cmake', {
diff --git a/ale_linters/cpp/clang.vim b/ale_linters/cpp/clang.vim
index e8af6dc2..b830f6a7 100644
--- a/ale_linters/cpp/clang.vim
+++ b/ale_linters/cpp/clang.vim
@@ -11,7 +11,7 @@ function! ale_linters#cpp#clang#GetCommand(buffer) abort
" headers in the same directory.
return 'clang++ -S -x c++ -fsyntax-only '
\ . '-iquote ' . fnameescape(fnamemodify(bufname(a:buffer), ':p:h'))
- \ . ' ' . g:ale_cpp_clang_options . ' -'
+ \ . ' ' . ale#Var(a:buffer, 'cpp_clang_options') . ' -'
endfunction
call ale#linter#Define('cpp', {
diff --git a/ale_linters/cpp/clangtidy.vim b/ale_linters/cpp/clangtidy.vim
index 6b72e1f5..2acd345a 100644
--- a/ale_linters/cpp/clangtidy.vim
+++ b/ale_linters/cpp/clangtidy.vim
@@ -6,7 +6,7 @@ let g:ale_cpp_clangtidy_options =
\ get(g:, 'ale_cpp_clangtidy_options', '-std=c++14 -Wall')
function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
- return 'clang-tidy %t -- ' . g:ale_cpp_clangtidy_options
+ return 'clang-tidy %t -- ' . ale#Var(a:buffer, 'cpp_clangtidy_options')
endfunction
call ale#linter#Define('cpp', {
diff --git a/ale_linters/cpp/cppcheck.vim b/ale_linters/cpp/cppcheck.vim
index b2877158..adb3f450 100644
--- a/ale_linters/cpp/cppcheck.vim
+++ b/ale_linters/cpp/cppcheck.vim
@@ -4,12 +4,16 @@
" Set this option to change the cppcheck options
let g:ale_cpp_cppcheck_options = get(g:, 'ale_cpp_cppcheck_options', '--enable=style')
+function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
+ return 'cppcheck -q --language=c++ '
+ \ . ale#Var(a:buffer, 'cpp_cppcheck_options')
+ \ . ' %t'
+endfunction
+
call ale#linter#Define('cpp', {
\ 'name': 'cppcheck',
\ 'output_stream': 'both',
\ 'executable': 'cppcheck',
-\ 'command': 'cppcheck -q --language=c++ '
-\ . g:ale_cpp_cppcheck_options
-\ . ' %t',
+\ 'command_callback': 'ale_linters#cpp#cppcheck#GetCommand',
\ 'callback': 'ale#handlers#HandleCppCheckFormat',
\})
diff --git a/ale_linters/cpp/gcc.vim b/ale_linters/cpp/gcc.vim
index c16a0706..9e8f859d 100644
--- a/ale_linters/cpp/gcc.vim
+++ b/ale_linters/cpp/gcc.vim
@@ -20,7 +20,7 @@ function! ale_linters#cpp#gcc#GetCommand(buffer) abort
" headers in the same directory.
return 'gcc -S -x c++ -fsyntax-only '
\ . '-iquote ' . fnameescape(fnamemodify(bufname(a:buffer), ':p:h'))
- \ . ' ' . g:ale_cpp_gcc_options . ' -'
+ \ . ' ' . ale#Var(a:buffer, 'cpp_gcc_options') . ' -'
endfunction
call ale#linter#Define('cpp', {
diff --git a/ale_linters/cs/mcs.vim b/ale_linters/cs/mcs.vim
index f1e1fc87..690fec79 100644
--- a/ale_linters/cs/mcs.vim
+++ b/ale_linters/cs/mcs.vim
@@ -1,7 +1,7 @@
let g:ale_cs_mcs_options = get(g:, 'ale_cs_mcs_options', '')
function! ale_linters#cs#mcs#GetCommand(buffer) abort
- return 'mcs -unsafe --parse ' . g:ale_cs_mcs_options . ' %t'
+ return 'mcs -unsafe --parse ' . ale#Var(a:buffer, 'cs_mcs_options') . ' %t'
endfunction
function! ale_linters#cs#mcs#Handle(buffer, lines) abort
diff --git a/ale_linters/css/stylelint.vim b/ale_linters/css/stylelint.vim
index ef496302..ffda0498 100644
--- a/ale_linters/css/stylelint.vim
+++ b/ale_linters/css/stylelint.vim
@@ -10,20 +10,20 @@ let g:ale_css_stylelint_use_global =
\ get(g:, 'ale_css_stylelint_use_global', 0)
function! ale_linters#css#stylelint#GetExecutable(buffer) abort
- if g:ale_css_stylelint_use_global
- return g:ale_css_stylelint_executable
+ if ale#Var(a:buffer, 'css_stylelint_use_global')
+ return ale#Var(a:buffer, 'css_stylelint_executable')
endif
return ale#util#ResolveLocalPath(
\ a:buffer,
\ 'node_modules/.bin/stylelint',
- \ g:ale_css_stylelint_executable
+ \ ale#Var(a:buffer, 'css_stylelint_executable')
\)
endfunction
function! ale_linters#css#stylelint#GetCommand(buffer) abort
return ale_linters#css#stylelint#GetExecutable(a:buffer)
- \ . ' ' . g:ale_css_stylelint_options
+ \ . ' ' . ale#Var(a:buffer, 'css_stylelint_options')
\ . ' --stdin-filename %s'
endfunction
diff --git a/ale_linters/erlang/erlc.vim b/ale_linters/erlang/erlc.vim
index 5ec04106..a44e9887 100644
--- a/ale_linters/erlang/erlc.vim
+++ b/ale_linters/erlang/erlc.vim
@@ -6,7 +6,9 @@ function! ale_linters#erlang#erlc#GetCommand(buffer) abort
let l:output_file = tempname()
call ale#engine#ManageFile(a:buffer, l:output_file)
- return 'erlc -o ' . fnameescape(l:output_file) . ' ' . g:ale_erlang_erlc_options . ' %t'
+ return 'erlc -o ' . fnameescape(l:output_file)
+ \ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options')
+ \ . ' %t'
endfunction
function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
diff --git a/ale_linters/fortran/gcc.vim b/ale_linters/fortran/gcc.vim
index 9b66f449..a59c6564 100644
--- a/ale_linters/fortran/gcc.vim
+++ b/ale_linters/fortran/gcc.vim
@@ -62,18 +62,18 @@ function! ale_linters#fortran#gcc#Handle(buffer, lines) abort
endfunction
function! ale_linters#fortran#gcc#GetExecutable(buffer) abort
- return g:ale_fortran_gcc_executable
+ return ale#Var(a:buffer, 'fortran_gcc_executable')
endfunction
function! ale_linters#fortran#gcc#GetCommand(buffer) abort
- let l:layout_option = g:ale_fortran_gcc_use_free_form
+ let l:layout_option = ale#Var(a:buffer, 'fortran_gcc_use_free_form')
\ ? '-ffree-form'
\ : '-ffixed-form'
return ale_linters#fortran#gcc#GetExecutable(a:buffer)
\ . ' -S -x f95 -fsyntax-only '
\ . l:layout_option . ' '
- \ . g:ale_fortran_gcc_options . ' '
+ \ . ale#Var(a:buffer, 'fortran_gcc_options') . ' '
\ . '-'
endfunction
diff --git a/ale_linters/go/gometalinter.vim b/ale_linters/go/gometalinter.vim
index 8dbd8b26..71d60c54 100644
--- a/ale_linters/go/gometalinter.vim
+++ b/ale_linters/go/gometalinter.vim
@@ -7,7 +7,7 @@ endif
function! ale_linters#go#gometalinter#GetCommand(buffer) abort
return 'gometalinter '
- \ . g:ale_go_gometalinter_options
+ \ . ale#Var(a:buffer, 'go_gometalinter_options')
\ . ' ' . fnameescape(fnamemodify(bufname(a:buffer), ':p:h'))
endfunction
diff --git a/ale_linters/handlebars/embertemplatelint.vim b/ale_linters/handlebars/embertemplatelint.vim
index 68d9ed6c..bfec27aa 100644
--- a/ale_linters/handlebars/embertemplatelint.vim
+++ b/ale_linters/handlebars/embertemplatelint.vim
@@ -8,14 +8,14 @@ let g:ale_handlebars_embertemplatelint_use_global =
\ get(g:, 'ale_handlebars_embertemplatelint_use_global', 0)
function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
- if g:ale_handlebars_embertemplatelint_use_global
- return g:ale_handlebars_embertemplatelint_executable
+ if ale#Var(a:buffer, 'handlebars_embertemplatelint_use_global')
+ return ale#Var(a:buffer, 'handlebars_embertemplatelint_executable')
endif
return ale#util#ResolveLocalPath(
\ a:buffer,
\ 'node_modules/.bin/ember-template-lint',
- \ g:ale_handlebars_embertemplatelint_executable
+ \ ale#Var(a:buffer, 'handlebars_embertemplatelint_executable')
\)
endfunction
diff --git a/ale_linters/html/htmlhint.vim b/ale_linters/html/htmlhint.vim
index c4afceea..2d65dddc 100644
--- a/ale_linters/html/htmlhint.vim
+++ b/ale_linters/html/htmlhint.vim
@@ -2,29 +2,25 @@
" Description: HTMLHint for checking html files
" CLI options
-let g:ale_html_htmlhint_options = get(g:, 'ale_html_htmlhint_options', '--format=unix')
-
-let g:ale_html_htmlhint_executable =
-\ get(g:, 'ale_html_htmlhint_executable', 'htmlhint')
-
-let g:ale_html_htmlhint_use_global =
-\ get(g:, 'ale_html_htmlhint_use_global', 0)
+let g:html_htmlhint_options = get(g:, 'ale_html_htmlhint_options', '--format=unix')
+let g:html_htmlhint_executable = get(g:, 'ale_html_htmlhint_executable', 'htmlhint')
+let g:html_htmlhint_use_global = get(g:, 'ale_html_htmlhint_use_global', 0)
function! ale_linters#html#htmlhint#GetExecutable(buffer) abort
- if g:ale_html_htmlhint_use_global
- return g:ale_html_htmlhint_executable
+ if ale#Var(a:buffer, 'html_htmlhint_use_global')
+ return ale#Var(a:buffer, 'html_htmlhint_executable')
endif
return ale#util#ResolveLocalPath(
\ a:buffer,
\ 'node_modules/.bin/htmlhint',
- \ g:ale_html_htmlhint_executable
+ \ ale#Var(a:buffer, 'html_htmlhint_executable')
\)
endfunction
function! ale_linters#html#htmlhint#GetCommand(buffer) abort
return ale_linters#html#htmlhint#GetExecutable(a:buffer)
- \ . ' ' . g:ale_html_htmlhint_options
+ \ . ' ' . ale#Var(a:buffer, 'html_htmlhint_options')
\ . ' %t'
endfunction
diff --git a/ale_linters/html/tidy.vim b/ale_linters/html/tidy.vim
index eab07a0f..764bea82 100644
--- a/ale_linters/html/tidy.vim
+++ b/ale_linters/html/tidy.vim
@@ -26,14 +26,14 @@ function! ale_linters#html#tidy#GetCommand(buffer) abort
\ }, &fileencoding, '-utf8')
return printf('%s %s %s -',
- \ g:ale_html_tidy_executable,
- \ g:ale_html_tidy_options,
+ \ ale#Var(a:buffer, 'html_tidy_executable'),
+ \ ale#Var(a:buffer, 'html_tidy_options'),
\ l:file_encoding
\)
endfunction
function! ale_linters#html#tidy#GetExecutable(buffer) abort
- return g:ale_html_tidy_executable
+ return ale#Var(a:buffer, 'html_tidy_executable')
endfunction
function! ale_linters#html#tidy#Handle(buffer, lines) abort
diff --git a/ale_linters/java/javac.vim b/ale_linters/java/javac.vim
index d6cb6a4b..9c9962a9 100644
--- a/ale_linters/java/javac.vim
+++ b/ale_linters/java/javac.vim
@@ -5,8 +5,8 @@ let g:ale_java_javac_options = get(g:, 'ale_java_javac_options', '')
let g:ale_java_javac_classpath = get(g:, 'ale_java_javac_classpath', '')
function! ale_linters#java#javac#GetCommand(buffer) abort
- let l:cp_option = !empty(g:ale_java_javac_classpath)
- \ ? '-cp ' . g:ale_java_javac_classpath
+ let l:cp_option = !empty(ale#Var(a:buffer, 'java_javac_classpath'))
+ \ ? '-cp ' . ale#Var(a:buffer, 'java_javac_classpath')
\ : ''
" Create .class files in a temporary directory, which we will delete later.
@@ -15,7 +15,7 @@ function! ale_linters#java#javac#GetCommand(buffer) abort
return 'javac -Xlint '
\ . l:cp_option
\ . ' -d ' . fnameescape(l:class_file_directory)
- \ . ' ' . g:ale_java_javac_options
+ \ . ' ' . ale#Var(a:buffer, 'java_javac_options')
\ . ' %t'
endfunction
diff --git a/ale_linters/javascript/eslint.vim b/ale_linters/javascript/eslint.vim
index 22fc93fc..2a65e301 100644
--- a/ale_linters/javascript/eslint.vim
+++ b/ale_linters/javascript/eslint.vim
@@ -11,8 +11,8 @@ let g:ale_javascript_eslint_use_global =
\ get(g:, 'ale_javascript_eslint_use_global', 0)
function! ale_linters#javascript#eslint#GetExecutable(buffer) abort
- if g:ale_javascript_eslint_use_global
- return g:ale_javascript_eslint_executable
+ if ale#Var(a:buffer, 'javascript_eslint_use_global')
+ return ale#Var(a:buffer, 'javascript_eslint_executable')
endif
" Look for the kinds of paths that create-react-app generates first.
@@ -29,13 +29,13 @@ function! ale_linters#javascript#eslint#GetExecutable(buffer) abort
return ale#util#ResolveLocalPath(
\ a:buffer,
\ 'node_modules/.bin/eslint',
- \ g:ale_javascript_eslint_executable
+ \ ale#Var(a:buffer, 'javascript_eslint_executable')
\)
endfunction
function! ale_linters#javascript#eslint#GetCommand(buffer) abort
return ale_linters#javascript#eslint#GetExecutable(a:buffer)
- \ . ' ' . g:ale_javascript_eslint_options
+ \ . ' ' . ale#Var(a:buffer, 'javascript_eslint_options')
\ . ' -f unix --stdin --stdin-filename %s'
endfunction
diff --git a/ale_linters/javascript/flow.vim b/ale_linters/javascript/flow.vim
index 98bda753..07900310 100644
--- a/ale_linters/javascript/flow.vim
+++ b/ale_linters/javascript/flow.vim
@@ -8,14 +8,14 @@ let g:ale_javascript_flow_use_global =
\ get(g:, 'ale_javascript_flow_use_global', 0)
function! ale_linters#javascript#flow#GetExecutable(buffer) abort
- if g:ale_javascript_flow_use_global
- return g:ale_javascript_flow_executable
+ if ale#Var(a:buffer, 'javascript_flow_use_global')
+ return ale#Var(a:buffer, 'javascript_flow_executable')
endif
return ale#util#ResolveLocalPath(
\ a:buffer,
\ 'node_modules/.bin/flow',
- \ g:ale_javascript_flow_executable
+ \ ale#Var(a:buffer, 'javascript_flow_executable')
\)
endfunction
diff --git a/ale_linters/javascript/jshint.vim b/ale_linters/javascript/jshint.vim
index f4b66519..24c3875c 100644
--- a/ale_linters/javascript/jshint.vim
+++ b/ale_linters/javascript/jshint.vim
@@ -8,14 +8,14 @@ let g:ale_javascript_jshint_use_global =
\ get(g:, 'ale_javascript_jshint_use_global', 0)
function! ale_linters#javascript#jshint#GetExecutable(buffer) abort
- if g:ale_javascript_jshint_use_global
- return g:ale_javascript_jshint_executable
+ if ale#Var(a:buffer, 'javascript_jshint_use_global')
+ return ale#Var(a:buffer, 'javascript_jshint_executable')
endif
return ale#util#ResolveLocalPath(
\ a:buffer,
\ 'node_modules/.bin/jshint',
- \ g:ale_javascript_jshint_executable
+ \ ale#Var(a:buffer, 'javascript_jshint_executable')
\)
endfunction
diff --git a/ale_linters/javascript/standard.vim b/ale_linters/javascript/standard.vim
index 891de83f..c43b83c5 100644
--- a/ale_linters/javascript/standard.vim
+++ b/ale_linters/javascript/standard.vim
@@ -11,20 +11,20 @@ let g:ale_javascript_standard_use_global =
\ get(g:, 'ale_javascript_standard_use_global', 0)
function! ale_linters#javascript#standard#GetExecutable(buffer) abort
- if g:ale_javascript_standard_use_global
- return g:ale_javascript_standard_executable
+ if ale#Var(a:buffer, 'javascript_standard_use_global')
+ return ale#Var(a:buffer, 'javascript_standard_executable')
endif
return ale#util#ResolveLocalPath(
\ a:buffer,
\ 'node_modules/.bin/standard',
- \ g:ale_javascript_standard_executable
+ \ ale#Var(a:buffer, 'javascript_standard_executable')
\)
endfunction
function! ale_linters#javascript#standard#GetCommand(buffer) abort
return ale_linters#javascript#standard#GetExecutable(a:buffer)
- \ . ' ' . g:ale_javascript_standard_options
+ \ . ' ' . ale#Var(a:buffer, 'javascript_standard_options')
\ . ' --stdin %s'
endfunction
diff --git a/ale_linters/lua/luacheck.vim b/ale_linters/lua/luacheck.vim
index ab590911..c73c775e 100644
--- a/ale_linters/lua/luacheck.vim
+++ b/ale_linters/lua/luacheck.vim
@@ -5,7 +5,7 @@ let g:ale_lua_luacheck_executable =
\ get(g:, 'ale_lua_luacheck_executable', 'luacheck')
function! ale_linters#lua#luacheck#GetExecutable(buffer) abort
- return g:ale_lua_luacheck_executable
+ return ale#Var(a:buffer, 'lua_luacheck_executable')
endfunction
function! ale_linters#lua#luacheck#GetCommand(buffer) abort
diff --git a/ale_linters/matlab/mlint.vim b/ale_linters/matlab/mlint.vim
index 775d431c..68f9cf81 100644
--- a/ale_linters/matlab/mlint.vim
+++ b/ale_linters/matlab/mlint.vim
@@ -5,7 +5,7 @@ let g:ale_matlab_mlint_executable =
\ get(g:, 'ale_matlab_mlint_executable', 'mlint')
function! ale_linters#matlab#mlint#GetExecutable(buffer) abort
- return g:ale_matlab_mlint_executable
+ return ale#Var(a:buffer, 'matlab_mlint_executable')
endfunction
function! ale_linters#matlab#mlint#GetCommand(buffer) abort
diff --git a/ale_linters/perl/perl.vim b/ale_linters/perl/perl.vim
index 23586a76..7e48efc3 100644
--- a/ale_linters/perl/perl.vim
+++ b/ale_linters/perl/perl.vim
@@ -8,12 +8,12 @@ let g:ale_perl_perl_options =
\ get(g:, 'ale_perl_perl_options', '-X -c -Mwarnings -Ilib')
function! ale_linters#perl#perl#GetExecutable(buffer) abort
- return g:ale_perl_perl_executable
+ return ale#Var(a:buffer, 'perl_perl_executable')
endfunction
function! ale_linters#perl#perl#GetCommand(buffer) abort
return ale_linters#perl#perl#GetExecutable(a:buffer)
- \ . ' ' . g:ale_perl_perl_options
+ \ . ' ' . ale#Var(a:buffer, 'perl_perl_options')
\ . ' %t'
endfunction
diff --git a/ale_linters/php/phpcs.vim b/ale_linters/php/phpcs.vim
index 73dd940f..15e1457a 100644
--- a/ale_linters/php/phpcs.vim
+++ b/ale_linters/php/phpcs.vim
@@ -1,15 +1,15 @@
" Author: jwilliams108 <https://github.com/jwilliams108>
" Description: phpcs for PHP files
-function! ale_linters#php#phpcs#GetCommand(buffer) abort
- let l:command = 'phpcs -s --report=emacs --stdin-path=%s'
+let g:ale_php_phpcs_standard = get(g:, 'ale_php_phpcs_standard', '')
- " This option can be set to change the standard used by phpcs
- if exists('g:ale_php_phpcs_standard')
- let l:command .= ' --standard=' . g:ale_php_phpcs_standard
- endif
+function! ale_linters#php#phpcs#GetCommand(buffer) abort
+ let l:standard = ale#Var(a:buffer, 'php_phpcs_standard')
+ let l:standard_option = !empty(l:standard)
+ \ ? '--standard=' . l:standard
+ \ : ''
- return l:command
+ return 'phpcs -s --report=emacs --stdin-path=%s ' . l:standard_option
endfunction
function! ale_linters#php#phpcs#Handle(buffer, lines) abort
diff --git a/ale_linters/php/phpmd.vim b/ale_linters/php/phpmd.vim
index 9426fcc3..02b98306 100644
--- a/ale_linters/php/phpmd.vim
+++ b/ale_linters/php/phpmd.vim
@@ -6,7 +6,7 @@ let g:ale_php_phpmd_ruleset = get(g:, 'ale_php_phpmd_ruleset', 'cleancode,codesi
function! ale_linters#php#phpmd#GetCommand(buffer) abort
return 'phpmd %s text '
- \ . g:ale_php_phpmd_ruleset
+ \ . ale#Var(a:buffer, 'php_phpmd_ruleset')
\ . ' --ignore-violations-on-exit %t'
endfunction
diff --git a/ale_linters/puppet/puppetlint.vim b/ale_linters/puppet/puppetlint.vim
index 902480d8..13da511b 100644
--- a/ale_linters/puppet/puppetlint.vim
+++ b/ale_linters/puppet/puppetlint.vim
@@ -8,12 +8,12 @@ let g:ale_puppet_puppetlint_options =
\ get(g:, 'ale_puppet_puppetlint_options', '--no-autoloader_layout-check')
function! ale_linters#puppet#puppetlint#GetExecutable(buffer) abort
- return g:ale_puppet_puppetlint_executable
+ return ale#Var(a:buffer, 'puppet_puppetlint_executable')
endfunction
function! ale_linters#puppet#puppetlint#GetCommand(buffer) abort
return ale_linters#puppet#puppetlint#GetExecutable(a:buffer)
- \ . ' ' . g:ale_puppet_puppetlint_options
+ \ . ' ' . ale#Var(a:buffer, 'puppet_puppetlint_options')
\ . ' --log-format "-:%{line}:%{column}: %{kind}: [%{check}] %{message}"'
\ . ' %t'
endfunction
diff --git a/ale_linters/python/flake8.vim b/ale_linters/python/flake8.vim
index 378d6b53..71e04d21 100644
--- a/ale_linters/python/flake8.vim
+++ b/ale_linters/python/flake8.vim
@@ -14,7 +14,7 @@ let g:ale_python_flake8_options =
let s:version_cache = {}
function! ale_linters#python#flake8#GetExecutable(buffer) abort
- return g:ale_python_flake8_executable
+ return ale#Var(a:buffer, 'python_flake8_executable')
endfunction
function! ale_linters#python#flake8#VersionCheck(buffer) abort
@@ -64,7 +64,8 @@ function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort
\ : ''
return ale_linters#python#flake8#GetExecutable(a:buffer)
- \ . ' ' . g:ale_python_flake8_args . ' ' . l:display_name_args . ' -'
+ \ . ' ' . ale#Var(a:buffer, 'python_flake8_options')
+ \ . ' ' . l:display_name_args . ' -'
endfunction
call ale#linter#Define('python', {
diff --git a/ale_linters/python/mypy.vim b/ale_linters/python/mypy.vim
index c60c0607..d0a891ea 100644
--- a/ale_linters/python/mypy.vim
+++ b/ale_linters/python/mypy.vim
@@ -3,7 +3,7 @@
let g:ale_python_mypy_options = get(g:, 'ale_python_mypy_options', '')
-function! g:ale_linters#python#mypy#GetCommand(buffer) abort
+function! ale_linters#python#mypy#GetCommand(buffer) abort
let l:automatic_stubs_dir = ale#util#FindNearestDirectory(a:buffer, 'stubs')
" TODO: Add Windows support
let l:automatic_stubs_command = (has('unix') && !empty(l:automatic_stubs_dir))
@@ -11,13 +11,13 @@ function! g:ale_linters#python#mypy#GetCommand(buffer) abort
\ : ''
return 'mypy --show-column-numbers '
- \ . g:ale_python_mypy_options
+ \ . ale#Var(a:buffer, 'python_mypy_options')
\ . ' %t'
endfunction
let s:path_pattern = '[a-zA-Z]\?\\\?:\?[[:alnum:]/\.\-_]\+'
-function! g:ale_linters#python#mypy#Handle(buffer, lines) abort
+function! ale_linters#python#mypy#Handle(buffer, lines) abort
" Look for lines like the following:
"
" file.py:4: error: No library stub file for module 'django.db'
diff --git a/ale_linters/python/pylint.vim b/ale_linters/python/pylint.vim
index 88dc4b42..37788f11 100644
--- a/ale_linters/python/pylint.vim
+++ b/ale_linters/python/pylint.vim
@@ -8,12 +8,12 @@ let g:ale_python_pylint_options =
\ get(g:, 'ale_python_pylint_options', '')
function! ale_linters#python#pylint#GetExecutable(buffer) abort
- return g:ale_python_pylint_executable
+ return ale#Var(a:buffer, 'python_pylint_executable')
endfunction
function! ale_linters#python#pylint#GetCommand(buffer) abort
return ale_linters#python#pylint#GetExecutable(a:buffer)
- \ . ' ' . g:ale_python_pylint_options
+ \ . ' ' . ale#Var(a:buffer, 'python_pylint_options')
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n'
\ . ' %t'
endfunction
diff --git a/ale_linters/ruby/rubocop.vim b/ale_linters/ruby/rubocop.vim
index 05763b55..fe5d3443 100644
--- a/ale_linters/ruby/rubocop.vim
+++ b/ale_linters/ruby/rubocop.vim
@@ -33,7 +33,7 @@ endfunction
function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
return 'rubocop --format emacs --force-exclusion '
- \ . g:ale_ruby_rubocop_options
+ \ . ale#Var(a:buffer, 'ruby_rubocop_options')
\ . ' --stdin ' . bufname(a:buffer)
endfunction
diff --git a/ale_linters/rust/cargo.vim b/ale_linters/rust/cargo.vim
index 84e4be74..8dbc0bd0 100644
--- a/ale_linters/rust/cargo.vim
+++ b/ale_linters/rust/cargo.vim
@@ -14,7 +14,7 @@ function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
endfunction
function! ale_linters#rust#cargo#GetCommand(buffer) abort
- let l:command = g:ale_rust_cargo_use_check
+ let l:command = ale#Var(a:buffer, 'rust_cargo_use_check')
\ ? 'check'
\ : 'build'
diff --git a/ale_linters/sass/stylelint.vim b/ale_linters/sass/stylelint.vim
index 0d85829c..a481f280 100644
--- a/ale_linters/sass/stylelint.vim
+++ b/ale_linters/sass/stylelint.vim
@@ -7,14 +7,14 @@ let g:ale_sass_stylelint_use_global =
\ get(g:, 'ale_sass_stylelint_use_global', 0)
function! ale_linters#sass#stylelint#GetExecutable(buffer) abort
- if g:ale_sass_stylelint_use_global
- return g:ale_sass_stylelint_executable
+ if ale#Var(a:buffer, 'sass_stylelint_use_global')
+ return ale#Var(a:buffer, 'sass_stylelint_executable')
endif
return ale#util#ResolveLocalPath(
\ a:buffer,
\ 'node_modules/.bin/stylelint',
- \ g:ale_sass_stylelint_executable
+ \ ale#Var(a:buffer, 'sass_stylelint_executable')
\)
endfunction
diff --git a/ale_linters/scss/scsslint.vim b/ale_linters/scss/scsslint.vim
index bc02e931..34db37ea 100644
--- a/ale_linters/scss/scsslint.vim
+++ b/ale_linters/scss/scsslint.vim
@@ -15,7 +15,7 @@ function! ale_linters#scss#scsslint#Handle(buffer, lines) abort
continue
endif
- if !g:ale_warn_about_trailing_whitespace && l:match[4] =~# '^TrailingWhitespace'
+ if g:ale_warn_about_trailing_whitespace && l:match[4] =~# '^TrailingWhitespace'
" Skip trailing whitespace warnings if that option is on.
continue
endif
diff --git a/ale_linters/scss/stylelint.vim b/ale_linters/scss/stylelint.vim
index 2f5da7c9..2e5d0270 100644
--- a/ale_linters/scss/stylelint.vim
+++ b/ale_linters/scss/stylelint.vim
@@ -7,14 +7,14 @@ let g:ale_scss_stylelint_use_global =
\ get(g:, 'ale_scss_stylelint_use_global', 0)
function! ale_linters#scss#stylelint#GetExecutable(buffer) abort
- if g:ale_scss_stylelint_use_global
- return g:ale_scss_stylelint_executable
+ if ale#Var(a:buffer, 'scss_stylelint_use_global')
+ return ale#Var(a:buffer, 'scss_stylelint_executable')
endif
return ale#util#ResolveLocalPath(
\ a:buffer,
\ 'node_modules/.bin/stylelint',
- \ g:ale_scss_stylelint_executable
+ \ ale#Var(a:buffer, 'scss_stylelint_executable')
\)
endfunction
diff --git a/ale_linters/sh/shell.vim b/ale_linters/sh/shell.vim
index 8cb7a490..372c1729 100644
--- a/ale_linters/sh/shell.vim
+++ b/ale_linters/sh/shell.vim
@@ -26,7 +26,7 @@ function! ale_linters#sh#shell#GetExecutable(buffer) abort
endfor
endif
- return g:ale_linters_sh_shell_default_shell
+ return ale#Var(a:buffer, 'linters_sh_shell_default_shell')
endfunction
function! ale_linters#sh#shell#GetCommand(buffer) abort
diff --git a/ale_linters/sh/shellcheck.vim b/ale_linters/sh/shellcheck.vim
index 5f932b19..1d9f7b05 100644
--- a/ale_linters/sh/shellcheck.vim
+++ b/ale_linters/sh/shellcheck.vim
@@ -17,7 +17,7 @@ let g:ale_sh_shellcheck_options =
\ get(g:, 'ale_sh_shellcheck_options', '')
function! ale_linters#sh#shellcheck#GetExecutable(buffer) abort
- return g:ale_sh_shellcheck_executable
+ return ale#Var(a:buffer, 'sh_shellcheck_executable')
endfunction
if g:ale_linters_sh_shellcheck_exclusions !=# ''
@@ -40,7 +40,7 @@ endfunction
function! ale_linters#sh#shellcheck#GetCommand(buffer) abort
return ale_linters#sh#shellcheck#GetExecutable(a:buffer)
- \ . ' ' . g:ale_sh_shellcheck_options
+ \ . ' ' . ale#Var(a:buffer, 'sh_shellcheck_options')
\ . ' ' . s:exclude_option . ' ' . s:GetDialectArgument() . ' -f gcc -'
endfunction
diff --git a/ale_linters/tex/chktex.vim b/ale_linters/tex/chktex.vim
index edcfa7d9..da5cc668 100644
--- a/ale_linters/tex/chktex.vim
+++ b/ale_linters/tex/chktex.vim
@@ -13,7 +13,7 @@ function! ale_linters#tex#chktex#GetCommand(buffer) abort
\ a:buffer,
\ '.chktexrc')
- let l:command = g:ale_tex_chktex_executable
+ let l:command = ale#Var(a:buffer, 'tex_chktex_executable')
" Avoid bug when used without -p (last warning has gibberish for a filename)
let l:command .= ' -v0 -p stdin -q'
@@ -21,7 +21,7 @@ function! ale_linters#tex#chktex#GetCommand(buffer) abort
let l:command .= ' -l ' . fnameescape(l:chktex_config)
endif
- let l:command .= ' ' . g:ale_tex_chktex_options
+ let l:command .= ' ' . ale#Var(a:buffer, 'tex_chktex_options')
return l:command
endfunction
diff --git a/ale_linters/tex/lacheck.vim b/ale_linters/tex/lacheck.vim
index 300e95d8..de8e76ab 100644
--- a/ale_linters/tex/lacheck.vim
+++ b/ale_linters/tex/lacheck.vim
@@ -5,11 +5,11 @@ let g:ale_tex_lacheck_executable =
\ get(g:, 'ale_tex_lacheck_executable', 'lacheck')
function! ale_linters#tex#lacheck#GetExecutable(buffer) abort
- return g:ale_tex_lacheck_executable
+ return ale#Var(a:buffer, 'tex_lacheck_executable')
endfunction
function! ale_linters#tex#lacheck#GetCommand(buffer) abort
- return g:ale_tex_lacheck_executable . ' %t'
+ return ale#Var(a:buffer, 'tex_lacheck_executable') . ' %t'
endfunction
function! ale_linters#tex#lacheck#Handle(buffer, lines) abort
diff --git a/ale_linters/typescript/tslint.vim b/ale_linters/typescript/tslint.vim
index 38d55dc9..a77011e5 100644
--- a/ale_linters/typescript/tslint.vim
+++ b/ale_linters/typescript/tslint.vim
@@ -11,7 +11,7 @@ function! ale_linters#typescript#tslint#GetExecutable(buffer) abort
return ale#util#ResolveLocalPath(
\ a:buffer,
\ 'node_modules/.bin/tslint',
- \ g:ale_typescript_tslint_executable
+ \ ale#Var(a:buffer, 'typescript_tslint_executable')
\)
endfunction
@@ -50,18 +50,18 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
endfunction
function! ale_linters#typescript#tslint#BuildLintCommand(buffer) abort
- let g:ale_typescript_tslint_config_path =
- \ empty(g:ale_typescript_tslint_config_path)
- \ ? ale#util#FindNearestFile(a:buffer, 'tslint.json')
- \ : g:ale_typescript_tslint_config_path
+ let l:tslint_config_path = ale#util#ResolveLocalPath(
+ \ a:buffer,
+ \ 'tslint.json',
+ \ ale#Var(a:buffer, 'typescript_tslint_config_path')
+ \)
- let l:tslint_options =
- \ empty(g:ale_typescript_tslint_config_path)
- \ ? ''
- \ : '-c ' . fnameescape(g:ale_typescript_tslint_config_path)
+ let l:tslint_config_option = !empty(l:tslint_config_path)
+ \ ? '-c ' . fnameescape(l:tslint_config_path)
+ \ : ''
return ale_linters#typescript#tslint#GetExecutable(a:buffer)
- \ . ' ' . l:tslint_options
+ \ . ' ' . l:tslint_config_option
\ . ' %t'
endfunction
diff --git a/ale_linters/vim/vint.vim b/ale_linters/vim/vint.vim
index 05ec2424..3a5c40e4 100644
--- a/ale_linters/vim/vint.vim
+++ b/ale_linters/vim/vint.vim
@@ -11,7 +11,7 @@ let s:enable_neovim = has('nvim') ? ' --enable-neovim ' : ''
let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"'
function! ale_linters#vim#vint#GetCommand(buffer) abort
- let l:warning_flag = g:ale_vim_vint_show_style_issues ? '-s' : '-w'
+ let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w'
return 'vint '
\ . l:warning_flag . ' '
diff --git a/ale_linters/yaml/yamllint.vim b/ale_linters/yaml/yamllint.vim
index 018553db..d8671cbd 100644
--- a/ale_linters/yaml/yamllint.vim
+++ b/ale_linters/yaml/yamllint.vim
@@ -7,12 +7,12 @@ let g:ale_yaml_yamllint_options =
\ get(g:, 'ale_yaml_yamllint_options', '')
function! ale_linters#yaml#yamllint#GetExecutable(buffer) abort
- return g:ale_yaml_yamllint_executable
+ return ale#Var(a:buffer, 'yaml_yamllint_executable')
endfunction
function! ale_linters#yaml#yamllint#GetCommand(buffer) abort
return ale_linters#yaml#yamllint#GetExecutable(a:buffer)
- \ . ' ' . g:ale_yaml_yamllint_options
+ \ . ' ' . ale#Var(a:buffer, 'yaml_yamllint_options')
\ . ' -f parsable %t'
endfunction