diff options
Diffstat (limited to 'ale_linters')
34 files changed, 103 insertions, 82 deletions
diff --git a/ale_linters/ansible/ansible-lint.vim b/ale_linters/ansible/ansible-lint.vim index af1e28b2..f3bcf565 100644 --- a/ale_linters/ansible/ansible-lint.vim +++ b/ale_linters/ansible/ansible-lint.vim @@ -4,6 +4,6 @@ call ale#linter#Define('ansible', { \ 'name': 'ansible', \ 'executable': 'ansible', -\ 'command': g:ale#util#stdin_wrapper . ' .yml ansible-lint -p', +\ 'command': 'ansible-lint -p %t', \ 'callback': 'ale#handlers#HandlePEP8Format', \}) diff --git a/ale_linters/c/cppcheck.vim b/ale_linters/c/cppcheck.vim index d4362cc0..754dad70 100644 --- a/ale_linters/c/cppcheck.vim +++ b/ale_linters/c/cppcheck.vim @@ -2,15 +2,14 @@ " Description: cppcheck linter for c files " Set this option to change the cppcheck options -if !exists('g:ale_c_cppcheck_options') - let g:ale_c_cppcheck_options = '--enable=style' -endif +let g:ale_c_cppcheck_options = get(g:, 'ale_c_cppcheck_options', '--enable=style') call ale#linter#Define('c', { \ 'name': 'cppcheck', \ 'output_stream': 'both', \ 'executable': 'cppcheck', -\ 'command': g:ale#util#stdin_wrapper . ' .c cppcheck -q --language=c ' -\ . g:ale_c_cppcheck_options, +\ 'command': 'cppcheck -q --language=c ' +\ . g:ale_c_cppcheck_options +\ . ' %t', \ 'callback': 'ale#handlers#HandleCppCheckFormat', \}) diff --git a/ale_linters/chef/foodcritic.vim b/ale_linters/chef/foodcritic.vim index bfe73c36..0728a37e 100644 --- a/ale_linters/chef/foodcritic.vim +++ b/ale_linters/chef/foodcritic.vim @@ -35,7 +35,7 @@ endfunction call ale#linter#Define('chef', { \ 'name': 'foodcritic', \ 'executable': 'foodcritic', -\ 'command': g:ale#util#stdin_wrapper . ' .rb foodcritic', +\ 'command': 'foodcritic %t', \ 'callback': 'ale_linters#chef#foodcritic#Handle', \}) diff --git a/ale_linters/cpp/cppcheck.vim b/ale_linters/cpp/cppcheck.vim index 9576b092..b2877158 100644 --- a/ale_linters/cpp/cppcheck.vim +++ b/ale_linters/cpp/cppcheck.vim @@ -2,15 +2,14 @@ " Description: cppcheck linter for cpp files " Set this option to change the cppcheck options -if !exists('g:ale_cpp_cppcheck_options') - let g:ale_cpp_cppcheck_options = '--enable=style' -endif +let g:ale_cpp_cppcheck_options = get(g:, 'ale_cpp_cppcheck_options', '--enable=style') call ale#linter#Define('cpp', { \ 'name': 'cppcheck', \ 'output_stream': 'both', \ 'executable': 'cppcheck', -\ 'command': g:ale#util#stdin_wrapper . ' .cpp cppcheck -q --language=c++ ' -\ . g:ale_cpp_cppcheck_options, +\ 'command': 'cppcheck -q --language=c++ ' +\ . g:ale_cpp_cppcheck_options +\ . ' %t', \ 'callback': 'ale#handlers#HandleCppCheckFormat', \}) diff --git a/ale_linters/cs/mcs.vim b/ale_linters/cs/mcs.vim index edf3bd27..3d39cfb7 100644 --- a/ale_linters/cs/mcs.vim +++ b/ale_linters/cs/mcs.vim @@ -1,6 +1,8 @@ -if !exists('g:ale_cs_mcs_options') - let g:ale_cs_mcs_options = '' -endif +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' +endfunction function! ale_linters#cs#mcs#Handle(buffer, lines) abort " Look for lines like the following. @@ -31,10 +33,9 @@ function! ale_linters#cs#mcs#Handle(buffer, lines) abort endfunction call ale#linter#Define('cs',{ -\ 'name': 'mcs', -\ 'output_stream': 'stderr', -\ 'executable': 'mcs', -\ 'command': g:ale#util#stdin_wrapper . ' .cs mcs -unsafe --parse' . g:ale_cs_mcs_options, -\ 'callback': 'ale_linters#cs#mcs#Handle', -\ }) - +\ 'name': 'mcs', +\ 'output_stream': 'stderr', +\ 'executable': 'mcs', +\ 'command_callback': 'ale_linters#cs#mcs#GetCommand', +\ 'callback': 'ale_linters#cs#mcs#Handle', +\}) diff --git a/ale_linters/css/csslint.vim b/ale_linters/css/csslint.vim index d967f83b..39176ce3 100644 --- a/ale_linters/css/csslint.vim +++ b/ale_linters/css/csslint.vim @@ -4,6 +4,6 @@ call ale#linter#Define('css', { \ 'name': 'csslint', \ 'executable': 'csslint', -\ 'command': g:ale#util#stdin_wrapper . ' .css csslint --format=compact', +\ 'command': 'csslint --format=compact %t', \ 'callback': 'ale#handlers#HandleCSSLintFormat', \}) diff --git a/ale_linters/d/dmd.vim b/ale_linters/d/dmd.vim index 0c665d71..26e80145 100644 --- a/ale_linters/d/dmd.vim +++ b/ale_linters/d/dmd.vim @@ -46,9 +46,7 @@ function! ale_linters#d#dmd#DMDCommand(buffer, dub_output) abort endif endfor - return g:ale#util#stdin_wrapper . ' .d dmd ' - \ . join(l:import_list) - \ . ' -o- -vcolumns -c' + return 'dmd '. join(l:import_list) . ' -o- -vcolumns -c %t' endfunction function! ale_linters#d#dmd#Handle(buffer, lines) abort diff --git a/ale_linters/elm/make.vim b/ale_linters/elm/make.vim index 35522f1c..714272c5 100644 --- a/ale_linters/elm/make.vim +++ b/ale_linters/elm/make.vim @@ -52,9 +52,8 @@ function! ale_linters#elm#make#GetCommand(buffer) abort " which is why this is hard coded here. " Source: https://github.com/elm-lang/elm-make/blob/master/src/Flags.hs let l:elm_cmd = 'elm-make --report=json --output='.shellescape('/dev/null') - let l:stdin_wrapper = g:ale#util#stdin_wrapper . ' .elm' - return l:dir_set_cmd . ' ' . l:stdin_wrapper . ' ' . l:elm_cmd + return l:dir_set_cmd . ' ' . l:elm_cmd . ' %t' endfunction call ale#linter#Define('elm', { diff --git a/ale_linters/erlang/erlc.vim b/ale_linters/erlang/erlc.vim index 1cd35d06..571592fb 100644 --- a/ale_linters/erlang/erlc.vim +++ b/ale_linters/erlang/erlc.vim @@ -3,7 +3,7 @@ let g:ale_erlang_erlc_options = get(g:, 'ale_erlang_erlc_options', '') function! ale_linters#erlang#erlc#GetCommand(buffer) abort - return g:ale#util#stdin_wrapper . ' .erl erlc ' . g:ale_erlang_erlc_options + return 'erlc ' . g:ale_erlang_erlc_options . ' %t' endfunction function! ale_linters#erlang#erlc#Handle(buffer, lines) abort diff --git a/ale_linters/go/gofmt.vim b/ale_linters/go/gofmt.vim index 50d25086..b38e4e98 100644 --- a/ale_linters/go/gofmt.vim +++ b/ale_linters/go/gofmt.vim @@ -5,6 +5,6 @@ call ale#linter#Define('go', { \ 'name': 'gofmt', \ 'output_stream': 'stderr', \ 'executable': 'gofmt', -\ 'command': g:ale#util#stdin_wrapper . ' .go gofmt -e', +\ 'command': 'gofmt -e %t', \ 'callback': 'ale#handlers#HandleUnixFormatAsError', \}) diff --git a/ale_linters/go/golint.vim b/ale_linters/go/golint.vim index 5329e334..8fe5b69b 100644 --- a/ale_linters/go/golint.vim +++ b/ale_linters/go/golint.vim @@ -4,6 +4,6 @@ call ale#linter#Define('go', { \ 'name': 'golint', \ 'executable': 'golint', -\ 'command': g:ale#util#stdin_wrapper . ' .go golint', +\ 'command': 'golint %t', \ 'callback': 'ale#handlers#HandleUnixFormatAsWarning', \}) diff --git a/ale_linters/go/govet.vim b/ale_linters/go/govet.vim index 6153caa8..e605a299 100644 --- a/ale_linters/go/govet.vim +++ b/ale_linters/go/govet.vim @@ -5,6 +5,6 @@ call ale#linter#Define('go', { \ 'name': 'go vet', \ 'output_stream': 'stderr', \ 'executable': 'go', -\ 'command': g:ale#util#stdin_wrapper . ' .go go vet', +\ 'command': 'go vet %t', \ 'callback': 'ale#handlers#HandleUnixFormatAsError', \}) diff --git a/ale_linters/haskell/ghc.vim b/ale_linters/haskell/ghc.vim index 5ddc15fe..c14274f4 100644 --- a/ale_linters/haskell/ghc.vim +++ b/ale_linters/haskell/ghc.vim @@ -60,7 +60,7 @@ call ale#linter#Define('haskell', { \ 'name': 'ghc', \ 'output_stream': 'stderr', \ 'executable': 'ghc', -\ 'command': g:ale#util#stdin_wrapper . ' .hs ghc -fno-code -v0', +\ 'command': 'ghc -fno-code -v0 %t', \ 'callback': 'ale_linters#haskell#ghc#Handle', \}) @@ -68,6 +68,6 @@ call ale#linter#Define('haskell', { \ 'name': 'stack-ghc', \ 'output_stream': 'stderr', \ 'executable': 'stack', -\ 'command': g:ale#util#stdin_wrapper . ' .hs stack ghc -- -fno-code -v0', +\ 'command': 'stack ghc -- -fno-code -v0 %t', \ 'callback': 'ale_linters#haskell#ghc#Handle', \}) diff --git a/ale_linters/html/htmlhint.vim b/ale_linters/html/htmlhint.vim index 910f3e63..c4afceea 100644 --- a/ale_linters/html/htmlhint.vim +++ b/ale_linters/html/htmlhint.vim @@ -23,9 +23,9 @@ function! ale_linters#html#htmlhint#GetExecutable(buffer) abort endfunction function! ale_linters#html#htmlhint#GetCommand(buffer) abort - return g:ale#util#stdin_wrapper . ' .html ' - \ . ale_linters#html#htmlhint#GetExecutable(a:buffer) + return ale_linters#html#htmlhint#GetExecutable(a:buffer) \ . ' ' . g:ale_html_htmlhint_options + \ . ' %t' endfunction call ale#linter#Define('html', { diff --git a/ale_linters/markdown/proselint.vim b/ale_linters/markdown/proselint.vim index fd2155f7..065ae32f 100644 --- a/ale_linters/markdown/proselint.vim +++ b/ale_linters/markdown/proselint.vim @@ -4,6 +4,6 @@ call ale#linter#Define('markdown', { \ 'name': 'proselint', \ 'executable': 'proselint', -\ 'command': g:ale#util#stdin_wrapper . ' .md proselint', +\ 'command': 'proselint %t', \ 'callback': 'ale#handlers#HandleUnixFormatAsWarning', \}) diff --git a/ale_linters/matlab/mlint.vim b/ale_linters/matlab/mlint.vim index 302e75ce..8eb747ec 100644 --- a/ale_linters/matlab/mlint.vim +++ b/ale_linters/matlab/mlint.vim @@ -4,6 +4,16 @@ 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 +endfunction + +function! ale_linters#matlab#mlint#GetCommand(buffer) abort + let l:executable = ale_linters#matlab#mlint#GetExecutable(a:buffer) + + return l:executable . ' -id %t' +endfunction + function! ale_linters#matlab#mlint#Handle(buffer, lines) abort " Matches patterns like the following: " @@ -47,9 +57,8 @@ endfunction call ale#linter#Define('matlab', { \ 'name': 'mlint', -\ 'executable': 'mlint', -\ 'command': g:ale#util#stdin_wrapper . -\ ' .m ' . g:ale_matlab_mlint_executable . ' -id', +\ 'executable_callback': 'ale_linters#matlab#mlint#GetExecutable', +\ 'command_callback': 'ale_linters#matlab#mlint#GetCommand', \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#matlab#mlint#Handle', \}) diff --git a/ale_linters/php/phpmd.vim b/ale_linters/php/phpmd.vim index 73432538..e7f87bc5 100644 --- a/ale_linters/php/phpmd.vim +++ b/ale_linters/php/phpmd.vim @@ -36,6 +36,6 @@ endfunction call ale#linter#Define('php', { \ 'name': 'phpmd', \ 'executable': 'phpmd', -\ 'command': g:ale#util#stdin_wrapper . ' .php phpmd %s text ' . g:ale_php_phpmd_ruleset . ' --ignore-violations-on-exit', +\ 'command': 'phpmd %s text ' . g:ale_php_phpmd_ruleset . ' --ignore-violations-on-exit %t', \ 'callback': 'ale_linters#php#phpmd#Handle', \}) diff --git a/ale_linters/pug/puglint.vim b/ale_linters/pug/puglint.vim index 338cb05f..4ded7ead 100644 --- a/ale_linters/pug/puglint.vim +++ b/ale_linters/pug/puglint.vim @@ -5,6 +5,6 @@ call ale#linter#Define('pug', { \ 'name': 'puglint', \ 'executable': 'pug-lint', \ 'output_stream': 'stderr', -\ 'command': g:ale#util#stdin_wrapper . ' .pug pug-lint -r inline', +\ 'command': 'pug-lint -r inline %t', \ 'callback': 'ale#handlers#HandleUnixFormatAsError', \}) diff --git a/ale_linters/puppet/puppet.vim b/ale_linters/puppet/puppet.vim index 534894cd..175d059f 100644 --- a/ale_linters/puppet/puppet.vim +++ b/ale_linters/puppet/puppet.vim @@ -33,6 +33,6 @@ call ale#linter#Define('puppet', { \ 'name': 'puppet', \ 'executable': 'puppet', \ 'output_stream': 'stderr', -\ 'command': g:ale#util#stdin_wrapper . ' .pp puppet parser validate --color=false', +\ 'command': 'puppet parser validate --color=false %t', \ 'callback': 'ale_linters#puppet#puppet#Handle', \}) diff --git a/ale_linters/puppet/puppetlint.vim b/ale_linters/puppet/puppetlint.vim index 2d93e530..05745cfe 100644 --- a/ale_linters/puppet/puppetlint.vim +++ b/ale_linters/puppet/puppetlint.vim @@ -3,6 +3,8 @@ call ale#linter#Define('puppet', { \ 'name': 'puppetlint', \ 'executable': 'puppet-lint', -\ 'command': g:ale#util#stdin_wrapper . ' .pp puppet-lint --no-autoloader_layout-check --log-format "-:%{line}:%{column}: %{kind}: [%{check}] %{message}"', +\ 'command': 'puppet-lint --no-autoloader_layout-check' +\ . ' --log-format "-:%{line}:%{column}: %{kind}: [%{check}] %{message}"' +\ . ' %t', \ 'callback': 'ale#handlers#HandleGCCFormat', \}) diff --git a/ale_linters/pyrex/cython.vim b/ale_linters/pyrex/cython.vim index 59004314..9168e092 100644 --- a/ale_linters/pyrex/cython.vim +++ b/ale_linters/pyrex/cython.vim @@ -5,8 +5,6 @@ call ale#linter#Define('pyrex', { \ 'name': 'cython', \ 'output_stream': 'stderr', \ 'executable': 'cython', -\ 'command': g:ale#util#stdin_wrapper -\ . ' .pyx cython --warning-extra -o ' -\ . g:ale#util#nul_file, +\ 'command': 'cython --warning-extra -o ' . g:ale#util#nul_file . ' %t', \ 'callback': 'ale#handlers#HandleUnixFormatAsError', \}) diff --git a/ale_linters/python/mypy.vim b/ale_linters/python/mypy.vim index 1509d9e6..55ab9022 100644 --- a/ale_linters/python/mypy.vim +++ b/ale_linters/python/mypy.vim @@ -10,10 +10,9 @@ function! g:ale_linters#python#mypy#GetCommand(buffer) abort \ ? 'MYPYPATH=' . l:automatic_stubs_dir . ' ' \ : '' - return l:automatic_stubs_command - \ . g:ale#util#stdin_wrapper - \ . ' .py mypy --show-column-numbers ' + return 'mypy --show-column-numbers ' \ . g:ale_python_mypy_options + \ . ' %t' endfunction let s:path_pattern = '[a-zA-Z]\?\\\?:\?[[:alnum:]/\.\-_]\+' diff --git a/ale_linters/python/pylint.vim b/ale_linters/python/pylint.vim index f0cd5bd6..ada1bfa2 100644 --- a/ale_linters/python/pylint.vim +++ b/ale_linters/python/pylint.vim @@ -12,10 +12,10 @@ function! ale_linters#python#pylint#GetExecutable(buffer) abort endfunction function! ale_linters#python#pylint#GetCommand(buffer) abort - return g:ale#util#stdin_wrapper . ' .py ' - \ . ale_linters#python#pylint#GetExecutable(a:buffer) + return ale_linters#python#pylint#GetExecutable(a:buffer) \ . ' ' . g:ale_python_pylint_options \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} {msg}" --reports n' + \ . ' %t' endfunction call ale#linter#Define('python', { diff --git a/ale_linters/sass/sasslint.vim b/ale_linters/sass/sasslint.vim index 8c497edf..7d011907 100644 --- a/ale_linters/sass/sasslint.vim +++ b/ale_linters/sass/sasslint.vim @@ -3,6 +3,6 @@ call ale#linter#Define('sass', { \ 'name': 'sasslint', \ 'executable': 'sass-lint', -\ 'command': g:ale#util#stdin_wrapper . ' .sass sass-lint -v -q -f compact', +\ 'command': 'sass-lint -v -q -f compact %t', \ 'callback': 'ale#handlers#HandleCSSLintFormat', \}) diff --git a/ale_linters/scala/scalac.vim b/ale_linters/scala/scalac.vim index c2e7543c..6f462068 100644 --- a/ale_linters/scala/scalac.vim +++ b/ale_linters/scala/scalac.vim @@ -1,4 +1,3 @@ -" vim: set et: " Author: Zoltan Kalmar - https://github.com/kalmiz " Description: Basic scala support using scalac @@ -21,8 +20,10 @@ function! ale_linters#scala#scalac#Handle(buffer, lines) abort let l:text = l:match[3] let l:type = l:match[2] ==# 'error' ? 'E' : 'W' let l:col = 0 + if l:ln + 1 < len(a:lines) let l:col = stridx(a:lines[l:ln + 1], '^') + if l:col == -1 let l:col = 0 endif @@ -47,6 +48,6 @@ call ale#linter#Define('scala', { \ 'name': 'scalac', \ 'executable': 'scalac', \ 'output_stream': 'stderr', -\ 'command': g:ale#util#stdin_wrapper . ' .scala scalac -Ystop-after:parser', +\ 'command': 'scalac -Ystop-after:parser %t', \ 'callback': 'ale_linters#scala#scalac#Handle', \}) diff --git a/ale_linters/scss/sasslint.vim b/ale_linters/scss/sasslint.vim index 0b78f3b0..ee4fdbb4 100644 --- a/ale_linters/scss/sasslint.vim +++ b/ale_linters/scss/sasslint.vim @@ -3,6 +3,6 @@ call ale#linter#Define('scss', { \ 'name': 'sasslint', \ 'executable': 'sass-lint', -\ 'command': g:ale#util#stdin_wrapper . ' .scss sass-lint -v -q -f compact', +\ 'command': 'sass-lint -v -q -f compact %t', \ 'callback': 'ale#handlers#HandleCSSLintFormat', \}) diff --git a/ale_linters/tex/lacheck.vim b/ale_linters/tex/lacheck.vim index ffa1daa7..848cbed2 100644 --- a/ale_linters/tex/lacheck.vim +++ b/ale_linters/tex/lacheck.vim @@ -4,6 +4,14 @@ 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 +endfunction + +function! ale_linters#tex#lacheck#GetCommand(buffer) abort + return g:ale_tex_lacheck_executable . ' %t' +endfunction + function! ale_linters#tex#lacheck#Handle(buffer, lines) abort " Mattes lines like: " @@ -43,8 +51,7 @@ endfunction call ale#linter#Define('tex', { \ 'name': 'lacheck', -\ 'executable': 'lacheck', -\ 'command': g:ale#util#stdin_wrapper . ' .tex ' -\ . g:ale_tex_lacheck_executable, +\ 'executable_callback': 'ale_linters#tex#lacheck#GetExecutable', +\ 'command_callback': 'ale_linters#tex#lacheck#GetCommand', \ 'callback': 'ale_linters#tex#lacheck#Handle' \}) diff --git a/ale_linters/tex/proselint.vim b/ale_linters/tex/proselint.vim index d175c88c..6801cf3e 100644 --- a/ale_linters/tex/proselint.vim +++ b/ale_linters/tex/proselint.vim @@ -4,6 +4,6 @@ call ale#linter#Define('tex', { \ 'name': 'proselint', \ 'executable': 'proselint', -\ 'command': g:ale#util#stdin_wrapper . ' .tex proselint', +\ 'command': 'proselint %t', \ 'callback': 'ale#handlers#HandleUnixFormatAsWarning', \}) diff --git a/ale_linters/text/proselint.vim b/ale_linters/text/proselint.vim index f84462d4..9bfbb2ce 100644 --- a/ale_linters/text/proselint.vim +++ b/ale_linters/text/proselint.vim @@ -5,5 +5,5 @@ call ale#linter#Define('text', { \ 'name': 'proselint', \ 'executable': 'proselint', \ 'callback': 'ale#handlers#HandleUnixFormatAsWarning', -\ 'command': g:ale#util#stdin_wrapper . ' .txt proselint', +\ 'command': 'proselint %t', \}) diff --git a/ale_linters/typescript/tslint.vim b/ale_linters/typescript/tslint.vim index eb5b1a7d..ae41ed4f 100644 --- a/ale_linters/typescript/tslint.vim +++ b/ale_linters/typescript/tslint.vim @@ -38,13 +38,11 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines) abort return l:output endfunction -function! ale_linters#typescript#tslint#BuildLintCommand(buffer_n) abort - let l:tsconfig_path = ale#util#FindNearestFile(a:buffer_n, 'tslint.json') +function! ale_linters#typescript#tslint#BuildLintCommand(buffer) abort + let l:tsconfig_path = ale#util#FindNearestFile(a:buffer, 'tslint.json') let l:tslint_options = empty(l:tsconfig_path) ? '' : '-c ' . l:tsconfig_path - let l:ext = '.' . fnamemodify(bufname(a:buffer_n), ':e') - - return g:ale#util#stdin_wrapper . ' ' . l:ext . ' tslint ' . l:tslint_options + return 'tslint ' . l:tslint_options . ' %t' endfunction call ale#linter#Define('typescript', { diff --git a/ale_linters/verilog/iverilog.vim b/ale_linters/verilog/iverilog.vim index d10661d7..cf1b0fa8 100644 --- a/ale_linters/verilog/iverilog.vim +++ b/ale_linters/verilog/iverilog.vim @@ -40,6 +40,6 @@ call ale#linter#Define('verilog', { \ 'name': 'iverilog', \ 'output_stream': 'stderr', \ 'executable': 'iverilog', -\ 'command': g:ale#util#stdin_wrapper . ' .v iverilog -t null -Wall', +\ 'command': 'iverilog -t null -Wall %t', \ 'callback': 'ale_linters#verilog#iverilog#Handle', \}) diff --git a/ale_linters/verilog/verilator.vim b/ale_linters/verilog/verilator.vim index 534e1ae2..4ff2093a 100644 --- a/ale_linters/verilog/verilator.vim +++ b/ale_linters/verilog/verilator.vim @@ -1,6 +1,16 @@ " Author: Masahiro H https://github.com/mshr-h " Description: verilator for verilog files +function! ale_linters#verilog#verilator#GetCommand(buffer) abort + let l:filename = tempname() . '_verilator_linted.v' + + " Create a special filename, so we can detect it in the handler. + call ale#engine#ManageFile(a:buffer, l:filename) + call writefile(getbufline(a:buffer, 1, '$'), l:filename) + + return 'verilator --lint-only -Wall -Wno-DECLFILENAME ' . fnameescape(l:filename) +endfunction + function! ale_linters#verilog#verilator#Handle(buffer, lines) abort " Look for lines like the following. " @@ -25,16 +35,16 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort let l:text = l:match[4] let l:file = l:match[2] - if(l:file =~# '_verilator_linted.v') - call add(l:output, { - \ 'bufnr': a:buffer, - \ 'lnum': l:line, - \ 'vcol': 0, - \ 'col': 1, - \ 'text': l:text, - \ 'type': l:type, - \ 'nr': -1, - \}) + if l:file =~# '_verilator_linted.v' + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:line, + \ 'vcol': 0, + \ 'col': 1, + \ 'text': l:text, + \ 'type': l:type, + \ 'nr': -1, + \}) endif endfor @@ -45,6 +55,7 @@ call ale#linter#Define('verilog', { \ 'name': 'verilator', \ 'output_stream': 'stderr', \ 'executable': 'verilator', -\ 'command': g:ale#util#stdin_wrapper . ' _verilator_linted.v verilator --lint-only -Wall -Wno-DECLFILENAME', +\ 'command_callback': 'ale_linters#verilog#verilator#GetCommand', \ 'callback': 'ale_linters#verilog#verilator#Handle', +\ 'read_buffer': 0, \}) diff --git a/ale_linters/vim/vint.vim b/ale_linters/vim/vint.vim index bc6ea460..9917f3fe 100644 --- a/ale_linters/vim/vint.vim +++ b/ale_linters/vim/vint.vim @@ -12,11 +12,11 @@ let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {desc call ale#linter#Define('vim', { \ 'name': 'vint', \ 'executable': 'vint', -\ 'command': g:ale#util#stdin_wrapper -\ . ' .vim vint ' +\ 'command': 'vint ' \ . s:warning_flag \ . ' --no-color ' \ . s:enable_neovim -\ . s:format, +\ . s:format +\ . ' %t', \ 'callback': 'ale#handlers#HandleGCCFormat', \}) diff --git a/ale_linters/yaml/yamllint.vim b/ale_linters/yaml/yamllint.vim index 05af709d..0a1ca7d0 100644 --- a/ale_linters/yaml/yamllint.vim +++ b/ale_linters/yaml/yamllint.vim @@ -37,6 +37,6 @@ endfunction call ale#linter#Define('yaml', { \ 'name': 'yamllint', \ 'executable': 'yamllint', -\ 'command': g:ale#util#stdin_wrapper . ' .yml yamllint -f parsable', +\ 'command': 'yamllint -f parsable %t', \ 'callback': 'ale_linters#yaml#yamllint#Handle', \}) |