diff options
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/go/gobuild.vim | 5 | ||||
-rw-r--r-- | ale_linters/go/golangci_lint.vim | 2 | ||||
-rw-r--r-- | ale_linters/go/govet.vim | 7 | ||||
-rw-r--r-- | ale_linters/julia/languageserver.vim | 2 | ||||
-rw-r--r-- | ale_linters/python/flake8.vim | 6 | ||||
-rw-r--r-- | ale_linters/python/mypy.vim | 6 | ||||
-rw-r--r-- | ale_linters/python/prospector.vim | 7 | ||||
-rw-r--r-- | ale_linters/python/pycodestyle.vim | 6 | ||||
-rw-r--r-- | ale_linters/python/pyflakes.vim | 6 | ||||
-rw-r--r-- | ale_linters/python/pylint.vim | 6 | ||||
-rw-r--r-- | ale_linters/python/pyls.vim | 6 | ||||
-rw-r--r-- | ale_linters/python/pyre.vim | 6 | ||||
-rw-r--r-- | ale_linters/ruby/brakeman.vim | 12 | ||||
-rw-r--r-- | ale_linters/ruby/rails_best_practices.vim | 14 | ||||
-rw-r--r-- | ale_linters/ruby/reek.vim | 13 | ||||
-rw-r--r-- | ale_linters/ruby/rubocop.vim | 12 | ||||
-rw-r--r-- | ale_linters/ruby/solargraph.vim | 20 | ||||
-rw-r--r-- | ale_linters/thrift/thrift.vim | 2 |
18 files changed, 97 insertions, 41 deletions
diff --git a/ale_linters/go/gobuild.vim b/ale_linters/go/gobuild.vim index a44449f1..cef1ff88 100644 --- a/ale_linters/go/gobuild.vim +++ b/ale_linters/go/gobuild.vim @@ -3,6 +3,7 @@ " Description: go build for Go files " inspired by work from dzhou121 <dzhou121@gmail.com> +call ale#Set('go_go_executable', 'go') call ale#Set('go_gobuild_options', '') function! ale_linters#go#gobuild#GetCommand(buffer) abort @@ -10,7 +11,7 @@ function! ale_linters#go#gobuild#GetCommand(buffer) abort " Run go test in local directory with relative path return ale#path#BufferCdString(a:buffer) - \ . 'go test' + \ . ale#Var(a:buffer, 'go_go_executable') . ' test' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -c -o /dev/null ./' endfunction @@ -47,7 +48,7 @@ endfunction call ale#linter#Define('go', { \ 'name': 'gobuild', \ 'aliases': ['go build'], -\ 'executable': 'go', +\ 'executable_callback': ale#VarFunc('go_go_executable'), \ 'command_callback': 'ale_linters#go#gobuild#GetCommand', \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#go#gobuild#Handler', diff --git a/ale_linters/go/golangci_lint.vim b/ale_linters/go/golangci_lint.vim index b44a6239..dd9a3c64 100644 --- a/ale_linters/go/golangci_lint.vim +++ b/ale_linters/go/golangci_lint.vim @@ -18,7 +18,7 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort return ale#path#BufferCdString(a:buffer) \ . '%e run ' - \ . ale#util#EscapePCRE(l:filename) + \ . ale#Escape(l:filename) \ . ' ' . l:options endfunction diff --git a/ale_linters/go/govet.vim b/ale_linters/go/govet.vim index 84c23236..3d0d2adf 100644 --- a/ale_linters/go/govet.vim +++ b/ale_linters/go/govet.vim @@ -4,20 +4,23 @@ " Author: John Eikenberry <jae@zhar.net> " Description: updated to work with go1.10 +call ale#Set('go_go_executable', 'go') call ale#Set('go_govet_options', '') function! ale_linters#go#govet#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'go_govet_options') - return ale#path#BufferCdString(a:buffer) . ' go vet .' + return ale#path#BufferCdString(a:buffer) . ' ' + \ . ale#Var(a:buffer, 'go_go_executable') . ' vet ' \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' .' endfunction call ale#linter#Define('go', { \ 'name': 'govet', \ 'aliases': ['go vet'], \ 'output_stream': 'stderr', -\ 'executable': 'go', +\ 'executable_callback': ale#VarFunc('go_go_executable'), \ 'command_callback': 'ale_linters#go#govet#GetCommand', \ 'callback': 'ale#handlers#go#Handler', \ 'lint_file': 1, diff --git a/ale_linters/julia/languageserver.vim b/ale_linters/julia/languageserver.vim index b6bf8e73..cd2000de 100644 --- a/ale_linters/julia/languageserver.vim +++ b/ale_linters/julia/languageserver.vim @@ -6,7 +6,7 @@ call ale#Set('julia_executable', 'julia') function! ale_linters#julia#languageserver#GetCommand(buffer) abort let l:julia_executable = ale#Var(a:buffer, 'julia_executable') - let l:cmd_string = 'using LanguageServer; server = LanguageServer.LanguageServerInstance(STDIN, STDOUT, false); server.runlinter = true; run(server);' + let l:cmd_string = 'using LanguageServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);' return ale#Escape(l:julia_executable) . ' --startup-file=no --history-file=no -e ' . ale#Escape(l:cmd_string) endfunction diff --git a/ale_linters/python/flake8.vim b/ale_linters/python/flake8.vim index 358f51a4..9dcdacc6 100644 --- a/ale_linters/python/flake8.vim +++ b/ale_linters/python/flake8.vim @@ -5,12 +5,18 @@ call ale#Set('python_flake8_executable', 'flake8') call ale#Set('python_flake8_options', '') call ale#Set('python_flake8_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_flake8_change_directory', 1) +call ale#Set('python_flake8_auto_pipenv', 0) function! s:UsingModule(buffer) abort return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8' endfunction function! ale_linters#python#flake8#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_flake8_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + if !s:UsingModule(a:buffer) return ale#python#FindExecutable(a:buffer, 'python_flake8', ['flake8']) endif diff --git a/ale_linters/python/mypy.vim b/ale_linters/python/mypy.vim index b38ccdeb..0c90a3c7 100644 --- a/ale_linters/python/mypy.vim +++ b/ale_linters/python/mypy.vim @@ -5,8 +5,14 @@ call ale#Set('python_mypy_executable', 'mypy') call ale#Set('python_mypy_ignore_invalid_syntax', 0) call ale#Set('python_mypy_options', '') call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_mypy_auto_pipenv', 0) function! ale_linters#python#mypy#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_mypy_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy']) endfunction diff --git a/ale_linters/python/prospector.vim b/ale_linters/python/prospector.vim index fff37147..b01cec87 100644 --- a/ale_linters/python/prospector.vim +++ b/ale_linters/python/prospector.vim @@ -1,6 +1,8 @@ " Author: chocoelho <carlospecter@gmail.com> " Description: prospector linter python files +call ale#Set('python_prospector_auto_pipenv', 0) + let g:ale_python_prospector_executable = \ get(g:, 'ale_python_prospector_executable', 'prospector') @@ -10,6 +12,11 @@ let g:ale_python_prospector_options = let g:ale_python_prospector_use_global = get(g:, 'ale_python_prospector_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#python#prospector#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_prospector_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector']) endfunction diff --git a/ale_linters/python/pycodestyle.vim b/ale_linters/python/pycodestyle.vim index de96363f..f0269585 100644 --- a/ale_linters/python/pycodestyle.vim +++ b/ale_linters/python/pycodestyle.vim @@ -4,8 +4,14 @@ call ale#Set('python_pycodestyle_executable', 'pycodestyle') call ale#Set('python_pycodestyle_options', '') call ale#Set('python_pycodestyle_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_pycodestyle_auto_pipenv', 0) function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycodestyle_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle']) endfunction diff --git a/ale_linters/python/pyflakes.vim b/ale_linters/python/pyflakes.vim index 86ff8773..091408d5 100644 --- a/ale_linters/python/pyflakes.vim +++ b/ale_linters/python/pyflakes.vim @@ -3,8 +3,14 @@ call ale#Set('python_pyflakes_executable', 'pyflakes') call ale#Set('python_pyflakes_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_pyflakes_auto_pipenv', 0) function! ale_linters#python#pyflakes#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflakes_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes']) endfunction diff --git a/ale_linters/python/pylint.vim b/ale_linters/python/pylint.vim index 9239f835..01c3cb37 100644 --- a/ale_linters/python/pylint.vim +++ b/ale_linters/python/pylint.vim @@ -5,8 +5,14 @@ call ale#Set('python_pylint_executable', 'pylint') call ale#Set('python_pylint_options', '') call ale#Set('python_pylint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pylint_change_directory', 1) +call ale#Set('python_pylint_auto_pipenv', 0) function! ale_linters#python#pylint#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pylint_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint']) endfunction diff --git a/ale_linters/python/pyls.vim b/ale_linters/python/pyls.vim index ae71f022..83fe8066 100644 --- a/ale_linters/python/pyls.vim +++ b/ale_linters/python/pyls.vim @@ -3,8 +3,14 @@ call ale#Set('python_pyls_executable', 'pyls') call ale#Set('python_pyls_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_pyls_auto_pipenv', 0) function! ale_linters#python#pyls#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyls_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + return ale#python#FindExecutable(a:buffer, 'python_pyls', ['pyls']) endfunction diff --git a/ale_linters/python/pyre.vim b/ale_linters/python/pyre.vim index 5efef409..adc185f2 100644 --- a/ale_linters/python/pyre.vim +++ b/ale_linters/python/pyre.vim @@ -3,8 +3,14 @@ call ale#Set('python_pyre_executable', 'pyre') call ale#Set('python_pyre_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_pyre_auto_pipenv', 0) function! ale_linters#python#pyre#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyre_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + return ale#python#FindExecutable(a:buffer, 'python_pyre', ['pyre']) endfunction diff --git a/ale_linters/ruby/brakeman.vim b/ale_linters/ruby/brakeman.vim index 85cfc184..122e0b5b 100644 --- a/ale_linters/ruby/brakeman.vim +++ b/ale_linters/ruby/brakeman.vim @@ -1,8 +1,9 @@ " Author: Eddie Lebow https://github.com/elebow " Description: Brakeman, a static analyzer for Rails security -let g:ale_ruby_brakeman_options = -\ get(g:, 'ale_ruby_brakeman_options', '') +call ale#Set('ruby_brakeman_options', '') +call ale#Set('ruby_brakeman_executable', 'brakeman') +call ale#Set('ruby_brakeman_options', '') function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort let l:output = [] @@ -33,14 +34,17 @@ function! ale_linters#ruby#brakeman#GetCommand(buffer) abort return '' endif - return 'brakeman -f json -q ' + let l:executable = ale#Var(a:buffer, 'ruby_brakeman_executable') + + return ale#handlers#ruby#EscapeExecutable(l:executable, 'brakeman') + \ . ' -f json -q ' \ . ale#Var(a:buffer, 'ruby_brakeman_options') \ . ' -p ' . ale#Escape(l:rails_root) endfunction call ale#linter#Define('ruby', { \ 'name': 'brakeman', -\ 'executable': 'brakeman', +\ 'executable_callback': ale#VarFunc('ruby_brakeman_executable'), \ 'command_callback': 'ale_linters#ruby#brakeman#GetCommand', \ 'callback': 'ale_linters#ruby#brakeman#Handle', \ 'lint_file': 1, diff --git a/ale_linters/ruby/rails_best_practices.vim b/ale_linters/ruby/rails_best_practices.vim index 4ba1f3fe..20cadca8 100644 --- a/ale_linters/ruby/rails_best_practices.vim +++ b/ale_linters/ruby/rails_best_practices.vim @@ -22,26 +22,18 @@ function! ale_linters#ruby#rails_best_practices#Handle(buffer, lines) abort return l:output endfunction -function! ale_linters#ruby#rails_best_practices#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'ruby_rails_best_practices_executable') -endfunction - function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort - let l:executable = ale_linters#ruby#rails_best_practices#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'bundle$' - \ ? ' exec rails_best_practices' - \ : '' - let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) if l:rails_root is? '' return '' endif + let l:executable = ale#Var(a:buffer, 'ruby_rails_best_practices_executable') let l:output_file = ale#Has('win32') ? '%t ' : '/dev/stdout ' let l:cat_file = ale#Has('win32') ? '; type %t' : '' - return ale#Escape(l:executable) . l:exec_args + return ale#handlers#ruby#EscapeExecutable(l:executable, 'rails_best_practices') \ . ' --silent -f json --output-file ' . l:output_file \ . ale#Var(a:buffer, 'ruby_rails_best_practices_options') \ . ale#Escape(l:rails_root) @@ -50,7 +42,7 @@ endfunction call ale#linter#Define('ruby', { \ 'name': 'rails_best_practices', -\ 'executable_callback': 'ale_linters#ruby#rails_best_practices#GetExecutable', +\ 'executable_callback': ale#VarFunc('ruby_rails_best_practices_executable'), \ 'command_callback': 'ale_linters#ruby#rails_best_practices#GetCommand', \ 'callback': 'ale_linters#ruby#rails_best_practices#Handle', \ 'lint_file': 1, diff --git a/ale_linters/ruby/reek.vim b/ale_linters/ruby/reek.vim index aa5d8d70..eefc4ecf 100644 --- a/ale_linters/ruby/reek.vim +++ b/ale_linters/ruby/reek.vim @@ -3,6 +3,8 @@ call ale#Set('ruby_reek_show_context', 0) call ale#Set('ruby_reek_show_wiki_link', 0) +call ale#Set('ruby_reek_options', '') +call ale#Set('ruby_reek_executable', 'reek') function! ale_linters#ruby#reek#VersionCheck(buffer) abort " If we have previously stored the version number in a cache, then @@ -12,18 +14,23 @@ function! ale_linters#ruby#reek#VersionCheck(buffer) abort return '' endif - return 'reek --version' + let l:executable = ale#Var(a:buffer, 'ruby_reek_executable') + + return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek') + \ . ' --version' endfunction function! ale_linters#ruby#reek#GetCommand(buffer, version_output) abort let l:version = ale#semver#GetVersion('reek', a:version_output) + let l:executable = ale#Var(a:buffer, 'ruby_reek_executable') " Tell reek what the filename is if the version of reek is new enough. let l:display_name_args = ale#semver#GTE(l:version, [5, 0, 0]) \ ? ' --stdin-filename %s' \ : '' - return 'reek -f json --no-progress --no-color' + return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek') + \ . ' -f json --no-progress --no-color' \ . l:display_name_args endfunction @@ -62,7 +69,7 @@ endfunction call ale#linter#Define('ruby', { \ 'name': 'reek', -\ 'executable': 'reek', +\ 'executable_callback': ale#VarFunc('ruby_reek_executable'), \ 'command_chain': [ \ {'callback': 'ale_linters#ruby#reek#VersionCheck'}, \ {'callback': 'ale_linters#ruby#reek#GetCommand'}, diff --git a/ale_linters/ruby/rubocop.vim b/ale_linters/ruby/rubocop.vim index 777f457a..45218394 100644 --- a/ale_linters/ruby/rubocop.vim +++ b/ale_linters/ruby/rubocop.vim @@ -1,13 +1,13 @@ " Author: ynonp - https://github.com/ynonp, Eddie Lebow https://github.com/elebow " Description: RuboCop, a code style analyzer for Ruby files +call ale#Set('ruby_rubocop_executable', 'rubocop') +call ale#Set('ruby_rubocop_options', '') + function! ale_linters#ruby#rubocop#GetCommand(buffer) abort - let l:executable = ale#handlers#rubocop#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'bundle$' - \ ? ' exec rubocop' - \ : '' + let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable') - return ale#Escape(l:executable) . l:exec_args + return ale#handlers#ruby#EscapeExecutable(l:executable, 'rubocop') \ . ' --format json --force-exclusion ' \ . ale#Var(a:buffer, 'ruby_rubocop_options') \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) @@ -55,7 +55,7 @@ endfunction call ale#linter#Define('ruby', { \ 'name': 'rubocop', -\ 'executable_callback': 'ale#handlers#rubocop#GetExecutable', +\ 'executable_callback': ale#VarFunc('ruby_rubocop_executable'), \ 'command_callback': 'ale_linters#ruby#rubocop#GetCommand', \ 'callback': 'ale_linters#ruby#rubocop#Handle', \}) diff --git a/ale_linters/ruby/solargraph.vim b/ale_linters/ruby/solargraph.vim index 2aad3af6..7ca0399f 100644 --- a/ale_linters/ruby/solargraph.vim +++ b/ale_linters/ruby/solargraph.vim @@ -1,20 +1,20 @@ " Author: Horacio Sanson - https://github.com/hsanson " Description: Solargraph Language Server https://solargraph.org/ +" +" Author: Devon Meunier <devon.meunier@gmail.com> +" Description: updated to use stdio -call ale#Set('ruby_solargraph_host', '127.0.0.1') -call ale#Set('ruby_solargraph_port', '7658') +call ale#Set('ruby_solargraph_executable', 'solargraph') -function! ale_linters#ruby#solargraph#GetAddress(buffer) abort - let l:host = ale#Var(a:buffer, 'ruby_solargraph_host') - let l:port = ale#Var(a:buffer, 'ruby_solargraph_port') - - return l:host . ':' . l:port +function! ale_linters#ruby#solargraph#GetCommand(buffer) abort + return '%e' . ale#Pad('stdio') endfunction call ale#linter#Define('ruby', { \ 'name': 'solargraph', -\ 'lsp': 'socket', -\ 'address_callback': 'ale_linters#ruby#solargraph#GetAddress', +\ 'lsp': 'stdio', \ 'language': 'ruby', -\ 'project_root_callback': 'ale#ruby#FindProjectRoot' +\ 'executable_callback': ale#VarFunc('ruby_solargraph_executable'), +\ 'command_callback': 'ale_linters#ruby#solargraph#GetCommand', +\ 'project_root_callback': 'ale#ruby#FindProjectRoot', \}) diff --git a/ale_linters/thrift/thrift.vim b/ale_linters/thrift/thrift.vim index 396a2355..36a8656e 100644 --- a/ale_linters/thrift/thrift.vim +++ b/ale_linters/thrift/thrift.vim @@ -2,7 +2,7 @@ call ale#Set('thrift_thrift_executable', 'thrift') call ale#Set('thrift_thrift_generators', ['cpp']) -call ale#Set('thrift_thrift_includes', []) +call ale#Set('thrift_thrift_includes', ['.']) call ale#Set('thrift_thrift_options', '-strict') function! ale_linters#thrift#thrift#GetCommand(buffer) abort |