#427 Implement buffer variable overrides for all linter options
This commit is contained in:
parent
e80116cee0
commit
e97dada261
45 changed files with 117 additions and 108 deletions
|
@ -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
|
||||
|
|
|
@ -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', {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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', {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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', {
|
||||
|
|
|
@ -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', {
|
||||
|
|
|
@ -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', {
|
||||
|
|
|
@ -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',
|
||||
\})
|
||||
|
|
|
@ -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', {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
" Author: jwilliams108 <https://github.com/jwilliams108>
|
||||
" Description: phpcs for PHP files
|
||||
|
||||
let g:ale_php_phpcs_standard = get(g:, 'ale_php_phpcs_standard', '')
|
||||
|
||||
function! ale_linters#php#phpcs#GetCommand(buffer) abort
|
||||
let l:command = 'phpcs -s --report=emacs --stdin-path=%s'
|
||||
let l:standard = ale#Var(a:buffer, 'php_phpcs_standard')
|
||||
let l:standard_option = !empty(l:standard)
|
||||
\ ? '--standard=' . l: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
|
||||
|
||||
return l:command
|
||||
return 'phpcs -s --report=emacs --stdin-path=%s ' . l:standard_option
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpcs#Handle(buffer, lines) abort
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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', {
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 . ' '
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
6
test/test_load_all_linters.vader
Normal file
6
test/test_load_all_linters.vader
Normal file
|
@ -0,0 +1,6 @@
|
|||
Execute(Exceptions shouldn't be thrown when loading all linters):
|
||||
" This test will look for errors when loading any of the linter files.
|
||||
runtime! ale_linters/*/*.vim
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
Reference in a new issue