From a42999a639b2916b769a85f37d037be314d9d61b Mon Sep 17 00:00:00 2001 From: w0rp Date: Sun, 15 Jul 2018 18:24:53 +0100 Subject: Massively reduce the amount of code needed for linter tests --- ale_linters/asciidoc/write-good.vim | 9 --------- ale_linters/asciidoc/writegood.vim | 9 +++++++++ ale_linters/awk/gawk.vim | 4 ++-- ale_linters/cs/mcs.vim | 6 +++++- ale_linters/cs/mcsc.vim | 10 +++++----- ale_linters/fuse/fusionlint.vim | 9 +++------ ale_linters/glsl/glslang.vim | 6 +++--- ale_linters/go/gotype.vim | 3 +-- ale_linters/help/write-good.vim | 9 --------- ale_linters/help/writegood.vim | 9 +++++++++ ale_linters/html/write-good.vim | 9 --------- ale_linters/html/writegood.vim | 9 +++++++++ ale_linters/java/javac.vim | 6 +++--- ale_linters/llvm/llc.vim | 3 +-- ale_linters/markdown/write-good.vim | 9 --------- ale_linters/markdown/writegood.vim | 9 +++++++++ ale_linters/nasm/nasm.vim | 2 +- ale_linters/nroff/write-good.vim | 9 --------- ale_linters/nroff/writegood.vim | 9 +++++++++ ale_linters/po/write-good.vim | 9 --------- ale_linters/po/writegood.vim | 9 +++++++++ ale_linters/pod/write-good.vim | 9 --------- ale_linters/pod/writegood.vim | 9 +++++++++ ale_linters/rst/write-good.vim | 9 --------- ale_linters/rst/writegood.vim | 9 +++++++++ ale_linters/ruby/rails_best_practices.vim | 12 ++++++++---- ale_linters/scala/scalastyle.vim | 28 +++++++++------------------- ale_linters/tex/write-good.vim | 9 --------- ale_linters/tex/writegood.vim | 9 +++++++++ ale_linters/texinfo/write-good.vim | 9 --------- ale_linters/texinfo/writegood.vim | 9 +++++++++ ale_linters/text/write-good.vim | 9 --------- ale_linters/text/writegood.vim | 9 +++++++++ ale_linters/thrift/thrift.vim | 10 ++++------ ale_linters/typescript/tslint.vim | 16 +++------------- ale_linters/xhtml/write-good.vim | 9 --------- ale_linters/xhtml/writegood.vim | 9 +++++++++ ale_linters/xml/xmllint.vim | 2 +- 38 files changed, 157 insertions(+), 176 deletions(-) delete mode 100644 ale_linters/asciidoc/write-good.vim create mode 100644 ale_linters/asciidoc/writegood.vim delete mode 100644 ale_linters/help/write-good.vim create mode 100644 ale_linters/help/writegood.vim delete mode 100644 ale_linters/html/write-good.vim create mode 100644 ale_linters/html/writegood.vim delete mode 100644 ale_linters/markdown/write-good.vim create mode 100644 ale_linters/markdown/writegood.vim delete mode 100644 ale_linters/nroff/write-good.vim create mode 100644 ale_linters/nroff/writegood.vim delete mode 100644 ale_linters/po/write-good.vim create mode 100644 ale_linters/po/writegood.vim delete mode 100644 ale_linters/pod/write-good.vim create mode 100644 ale_linters/pod/writegood.vim delete mode 100644 ale_linters/rst/write-good.vim create mode 100644 ale_linters/rst/writegood.vim delete mode 100644 ale_linters/tex/write-good.vim create mode 100644 ale_linters/tex/writegood.vim delete mode 100644 ale_linters/texinfo/write-good.vim create mode 100644 ale_linters/texinfo/writegood.vim delete mode 100644 ale_linters/text/write-good.vim create mode 100644 ale_linters/text/writegood.vim delete mode 100644 ale_linters/xhtml/write-good.vim create mode 100644 ale_linters/xhtml/writegood.vim (limited to 'ale_linters') diff --git a/ale_linters/asciidoc/write-good.vim b/ale_linters/asciidoc/write-good.vim deleted file mode 100644 index c986cc6c..00000000 --- a/ale_linters/asciidoc/write-good.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Author: Sumner Evans -" Description: write-good for AsciiDoc files - -call ale#linter#Define('asciidoc', { -\ 'name': 'write-good', -\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', -\ 'command_callback': 'ale#handlers#writegood#GetCommand', -\ 'callback': 'ale#handlers#writegood#Handle', -\}) diff --git a/ale_linters/asciidoc/writegood.vim b/ale_linters/asciidoc/writegood.vim new file mode 100644 index 00000000..c986cc6c --- /dev/null +++ b/ale_linters/asciidoc/writegood.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" Description: write-good for AsciiDoc files + +call ale#linter#Define('asciidoc', { +\ 'name': 'write-good', +\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', +\ 'command_callback': 'ale#handlers#writegood#GetCommand', +\ 'callback': 'ale#handlers#writegood#Handle', +\}) diff --git a/ale_linters/awk/gawk.vim b/ale_linters/awk/gawk.vim index 3e9987b3..8b60815f 100644 --- a/ale_linters/awk/gawk.vim +++ b/ale_linters/awk/gawk.vim @@ -15,9 +15,9 @@ function! ale_linters#awk#gawk#GetCommand(buffer) abort " note the --source 'BEGIN ...' is to prevent " gawk from attempting to execute the body of the script " it is linting. - return ale_linters#awk#gawk#GetExecutable(a:buffer) + return ale#Escape(ale_linters#awk#gawk#GetExecutable(a:buffer)) \ . " --source 'BEGIN { exit } END { exit 1 }'" - \ . ' ' . ale#Var(a:buffer, 'awk_gawk_options') + \ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options')) \ . ' ' . '-f %t --lint /dev/null' endfunction diff --git a/ale_linters/cs/mcs.vim b/ale_linters/cs/mcs.vim index b5c4054a..8738026d 100644 --- a/ale_linters/cs/mcs.vim +++ b/ale_linters/cs/mcs.vim @@ -1,7 +1,11 @@ let g:ale_cs_mcs_options = get(g:, 'ale_cs_mcs_options', '') function! ale_linters#cs#mcs#GetCommand(buffer) abort - return 'mcs -unsafe --parse ' . ale#Var(a:buffer, 'cs_mcs_options') . ' %t' + let l:options = ale#Var(a:buffer, 'cs_mcs_options') + + return 'mcs -unsafe --parse' + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' %t' endfunction function! ale_linters#cs#mcs#Handle(buffer, lines) abort diff --git a/ale_linters/cs/mcsc.vim b/ale_linters/cs/mcsc.vim index 8e84620c..1561661e 100644 --- a/ale_linters/cs/mcsc.vim +++ b/ale_linters/cs/mcsc.vim @@ -29,16 +29,16 @@ function! ale_linters#cs#mcsc#GetCommand(buffer) abort \ : '' " register temporary module target file with ale - let l:out = ale#util#Tempname() - call ale#engine#ManageFile(a:buffer, l:out) + " register temporary module target file with ALE. + let l:out = ale#engine#CreateFile(a:buffer) " The code is compiled as a module and the output is redirected to a " temporary file. return ale#path#CdString(s:GetWorkingDirectory(a:buffer)) \ . 'mcs -unsafe' - \ . ' ' . ale#Var(a:buffer, 'cs_mcsc_options') - \ . ' ' . l:lib_option - \ . ' ' . l:r_option + \ . ale#Pad(ale#Var(a:buffer, 'cs_mcsc_options')) + \ . ale#Pad(l:lib_option) + \ . ale#Pad(l:r_option) \ . ' -out:' . l:out \ . ' -t:module' \ . ' -recurse:' . ale#Escape('*.cs') diff --git a/ale_linters/fuse/fusionlint.vim b/ale_linters/fuse/fusionlint.vim index 968e801b..cf20e1b4 100644 --- a/ale_linters/fuse/fusionlint.vim +++ b/ale_linters/fuse/fusionlint.vim @@ -1,11 +1,8 @@ " Author: RyanSquared " Description: `fusion-lint` linter for FusionScript files -let g:ale_fuse_fusionlint_executable = -\ get(g:, 'ale_fuse_fusionlint_executable', 'fusion-lint') - -let g:ale_fuse_fusionlint_options = -\ get(g:, 'ale_fuse_fusionlint_options', '') +call ale#Set('fuse_fusionlint_executable', 'fusion-lint') +call ale#Set('fuse_fusionlint_options', '') function! ale_linters#fuse#fusionlint#GetExecutable(buffer) abort return ale#Var(a:buffer, 'fuse_fusionlint_executable') @@ -13,7 +10,7 @@ endfunction function! ale_linters#fuse#fusionlint#GetCommand(buffer) abort return ale#Escape(ale_linters#fuse#fusionlint#GetExecutable(a:buffer)) - \ . ' ' . ale#Var(a:buffer, 'fuse_fusionlint_options') + \ . ale#Pad(ale#Var(a:buffer, 'fuse_fusionlint_options')) \ . ' --filename %s -i' endfunction diff --git a/ale_linters/glsl/glslang.vim b/ale_linters/glsl/glslang.vim index 21a03ee2..d494df0e 100644 --- a/ale_linters/glsl/glslang.vim +++ b/ale_linters/glsl/glslang.vim @@ -14,9 +14,9 @@ function! ale_linters#glsl#glslang#GetExecutable(buffer) abort endfunction function! ale_linters#glsl#glslang#GetCommand(buffer) abort - return ale_linters#glsl#glslang#GetExecutable(a:buffer) - \ . ' ' . ale#Var(a:buffer, 'glsl_glslang_options') - \ . ' ' . '-C %t' + return ale#Escape(ale_linters#glsl#glslang#GetExecutable(a:buffer)) + \ . ale#Pad(ale#Var(a:buffer, 'glsl_glslang_options')) + \ . ' -C %t' endfunction function! ale_linters#glsl#glslang#Handle(buffer, lines) abort diff --git a/ale_linters/go/gotype.vim b/ale_linters/go/gotype.vim index f4bb274e..a678e0f3 100644 --- a/ale_linters/go/gotype.vim +++ b/ale_linters/go/gotype.vim @@ -3,10 +3,9 @@ function! ale_linters#go#gotype#GetCommand(buffer) abort if expand('#' . a:buffer . ':p') =~# '_test\.go$' - return + return '' endif - return ale#path#BufferCdString(a:buffer) . ' gotype .' endfunction diff --git a/ale_linters/help/write-good.vim b/ale_linters/help/write-good.vim deleted file mode 100644 index 11254cd2..00000000 --- a/ale_linters/help/write-good.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Author: Sumner Evans -" Description: write-good for vim Help files - -call ale#linter#Define('help', { -\ 'name': 'write-good', -\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', -\ 'command_callback': 'ale#handlers#writegood#GetCommand', -\ 'callback': 'ale#handlers#writegood#Handle', -\}) diff --git a/ale_linters/help/writegood.vim b/ale_linters/help/writegood.vim new file mode 100644 index 00000000..11254cd2 --- /dev/null +++ b/ale_linters/help/writegood.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" Description: write-good for vim Help files + +call ale#linter#Define('help', { +\ 'name': 'write-good', +\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', +\ 'command_callback': 'ale#handlers#writegood#GetCommand', +\ 'callback': 'ale#handlers#writegood#Handle', +\}) diff --git a/ale_linters/html/write-good.vim b/ale_linters/html/write-good.vim deleted file mode 100644 index 9fae8821..00000000 --- a/ale_linters/html/write-good.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Author: Sumner Evans -" Description: write-good for nroff files - -call ale#linter#Define('html', { -\ 'name': 'write-good', -\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', -\ 'command_callback': 'ale#handlers#writegood#GetCommand', -\ 'callback': 'ale#handlers#writegood#Handle', -\}) diff --git a/ale_linters/html/writegood.vim b/ale_linters/html/writegood.vim new file mode 100644 index 00000000..9fae8821 --- /dev/null +++ b/ale_linters/html/writegood.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" Description: write-good for nroff files + +call ale#linter#Define('html', { +\ 'name': 'write-good', +\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', +\ 'command_callback': 'ale#handlers#writegood#GetCommand', +\ 'callback': 'ale#handlers#writegood#Handle', +\}) diff --git a/ale_linters/java/javac.vim b/ale_linters/java/javac.vim index b1f74a6d..d7a39aa7 100644 --- a/ale_linters/java/javac.vim +++ b/ale_linters/java/javac.vim @@ -84,10 +84,10 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort return ale#path#BufferCdString(a:buffer) \ . ale#Escape(l:executable) \ . ' -Xlint' - \ . ' ' . l:cp_option - \ . ' ' . l:sp_option + \ . ale#Pad(l:cp_option) + \ . ale#Pad(l:sp_option) \ . ' -d ' . ale#Escape(l:class_file_directory) - \ . ' ' . ale#Var(a:buffer, 'java_javac_options') + \ . ale#Pad(ale#Var(a:buffer, 'java_javac_options')) \ . ' %t' endfunction diff --git a/ale_linters/llvm/llc.vim b/ale_linters/llvm/llc.vim index 0a4903eb..15201cbe 100644 --- a/ale_linters/llvm/llc.vim +++ b/ale_linters/llvm/llc.vim @@ -9,8 +9,7 @@ endfunction function! ale_linters#llvm#llc#GetCommand(buffer) abort return ale#Escape(ale_linters#llvm#llc#GetExecutable(a:buffer)) - \ . ' -filetype=null -o=' - \ . ale#Escape(g:ale#util#nul_file) + \ . ' -filetype=null -o=' . g:ale#util#nul_file endfunction function! ale_linters#llvm#llc#HandleErrors(buffer, lines) abort diff --git a/ale_linters/markdown/write-good.vim b/ale_linters/markdown/write-good.vim deleted file mode 100644 index 21dbff1a..00000000 --- a/ale_linters/markdown/write-good.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Author: Sumner Evans -" Description: write-good for Markdown files - -call ale#linter#Define('markdown', { -\ 'name': 'write-good', -\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', -\ 'command_callback': 'ale#handlers#writegood#GetCommand', -\ 'callback': 'ale#handlers#writegood#Handle', -\}) diff --git a/ale_linters/markdown/writegood.vim b/ale_linters/markdown/writegood.vim new file mode 100644 index 00000000..21dbff1a --- /dev/null +++ b/ale_linters/markdown/writegood.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" Description: write-good for Markdown files + +call ale#linter#Define('markdown', { +\ 'name': 'write-good', +\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', +\ 'command_callback': 'ale#handlers#writegood#GetCommand', +\ 'callback': 'ale#handlers#writegood#Handle', +\}) diff --git a/ale_linters/nasm/nasm.vim b/ale_linters/nasm/nasm.vim index f4b2ca4b..77d57e18 100644 --- a/ale_linters/nasm/nasm.vim +++ b/ale_linters/nasm/nasm.vim @@ -42,9 +42,9 @@ endfunction call ale#linter#Define('nasm', { \ 'name': 'nasm', -\ 'executable': 'nasm', \ 'output_stream': 'stderr', \ 'lint_file': 1, +\ 'executable_callback': 'ale_linters#nasm#nasm#GetExecutable', \ 'command_callback': 'ale_linters#nasm#nasm#GetCommand', \ 'callback': 'ale_linters#nasm#nasm#Handle', \}) diff --git a/ale_linters/nroff/write-good.vim b/ale_linters/nroff/write-good.vim deleted file mode 100644 index d318fb28..00000000 --- a/ale_linters/nroff/write-good.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Author: Sumner Evans -" Description: write-good for nroff files - -call ale#linter#Define('nroff', { -\ 'name': 'write-good', -\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', -\ 'command_callback': 'ale#handlers#writegood#GetCommand', -\ 'callback': 'ale#handlers#writegood#Handle', -\}) diff --git a/ale_linters/nroff/writegood.vim b/ale_linters/nroff/writegood.vim new file mode 100644 index 00000000..d318fb28 --- /dev/null +++ b/ale_linters/nroff/writegood.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" Description: write-good for nroff files + +call ale#linter#Define('nroff', { +\ 'name': 'write-good', +\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', +\ 'command_callback': 'ale#handlers#writegood#GetCommand', +\ 'callback': 'ale#handlers#writegood#Handle', +\}) diff --git a/ale_linters/po/write-good.vim b/ale_linters/po/write-good.vim deleted file mode 100644 index 5a01cb66..00000000 --- a/ale_linters/po/write-good.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Author: Cian Butler https://github.com/butlerx -" Description: write-good for PO files - -call ale#linter#Define('po', { -\ 'name': 'write-good', -\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', -\ 'command_callback': 'ale#handlers#writegood#GetCommand', -\ 'callback': 'ale#handlers#writegood#Handle', -\}) diff --git a/ale_linters/po/writegood.vim b/ale_linters/po/writegood.vim new file mode 100644 index 00000000..5a01cb66 --- /dev/null +++ b/ale_linters/po/writegood.vim @@ -0,0 +1,9 @@ +" Author: Cian Butler https://github.com/butlerx +" Description: write-good for PO files + +call ale#linter#Define('po', { +\ 'name': 'write-good', +\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', +\ 'command_callback': 'ale#handlers#writegood#GetCommand', +\ 'callback': 'ale#handlers#writegood#Handle', +\}) diff --git a/ale_linters/pod/write-good.vim b/ale_linters/pod/write-good.vim deleted file mode 100644 index 14ed5c0c..00000000 --- a/ale_linters/pod/write-good.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Author: Sumner Evans -" Description: write-good for Pod files - -call ale#linter#Define('pod', { -\ 'name': 'write-good', -\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', -\ 'command_callback': 'ale#handlers#writegood#GetCommand', -\ 'callback': 'ale#handlers#writegood#Handle', -\}) diff --git a/ale_linters/pod/writegood.vim b/ale_linters/pod/writegood.vim new file mode 100644 index 00000000..14ed5c0c --- /dev/null +++ b/ale_linters/pod/writegood.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" Description: write-good for Pod files + +call ale#linter#Define('pod', { +\ 'name': 'write-good', +\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', +\ 'command_callback': 'ale#handlers#writegood#GetCommand', +\ 'callback': 'ale#handlers#writegood#Handle', +\}) diff --git a/ale_linters/rst/write-good.vim b/ale_linters/rst/write-good.vim deleted file mode 100644 index 12137dbf..00000000 --- a/ale_linters/rst/write-good.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Author: Sumner Evans -" Description: write-good for reStructuredText files - -call ale#linter#Define('rst', { -\ 'name': 'write-good', -\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', -\ 'command_callback': 'ale#handlers#writegood#GetCommand', -\ 'callback': 'ale#handlers#writegood#Handle', -\}) diff --git a/ale_linters/rst/writegood.vim b/ale_linters/rst/writegood.vim new file mode 100644 index 00000000..12137dbf --- /dev/null +++ b/ale_linters/rst/writegood.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" Description: write-good for reStructuredText files + +call ale#linter#Define('rst', { +\ 'name': 'write-good', +\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', +\ 'command_callback': 'ale#handlers#writegood#GetCommand', +\ 'callback': 'ale#handlers#writegood#Handle', +\}) diff --git a/ale_linters/ruby/rails_best_practices.vim b/ale_linters/ruby/rails_best_practices.vim index 107753c3..4ba1f3fe 100644 --- a/ale_linters/ruby/rails_best_practices.vim +++ b/ale_linters/ruby/rails_best_practices.vim @@ -1,8 +1,8 @@ " Author: Eddie Lebow https://github.com/elebow " Description: rails_best_practices, a code metric tool for rails projects -let g:ale_ruby_rails_best_practices_options = -\ get(g:, 'ale_ruby_rails_best_practices_options', '') +call ale#Set('ruby_rails_best_practices_options', '') +call ale#Set('ruby_rails_best_practices_executable', 'rails_best_practices') function! ale_linters#ruby#rails_best_practices#Handle(buffer, lines) abort let l:output = [] @@ -22,8 +22,12 @@ 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#handlers#rails_best_practices#GetExecutable(a:buffer) + let l:executable = ale_linters#ruby#rails_best_practices#GetExecutable(a:buffer) let l:exec_args = l:executable =~? 'bundle$' \ ? ' exec rails_best_practices' \ : '' @@ -46,7 +50,7 @@ endfunction call ale#linter#Define('ruby', { \ 'name': 'rails_best_practices', -\ 'executable_callback': 'ale#handlers#rails_best_practices#GetExecutable', +\ 'executable_callback': 'ale_linters#ruby#rails_best_practices#GetExecutable', \ '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/scala/scalastyle.vim b/ale_linters/scala/scalastyle.vim index f78fd749..3232d70b 100644 --- a/ale_linters/scala/scalastyle.vim +++ b/ale_linters/scala/scalastyle.vim @@ -1,11 +1,11 @@ " Author: Kevin Kays - https://github.com/okkays " Description: Support for the scalastyle checker. -let g:ale_scala_scalastyle_options = -\ get(g:, 'ale_scala_scalastyle_options', '') - -let g:ale_scalastyle_config_loc = +call ale#Set('scala_scalastyle_options', '') +" TODO: Remove support for the old option name in ALE 3.0. +call ale#Set('scala_scalastyle_config', \ get(g:, 'ale_scalastyle_config_loc', '') +\) function! ale_linters#scala#scalastyle#Handle(buffer, lines) abort " Look for help output from scalastyle first, which indicates that no @@ -66,23 +66,13 @@ function! ale_linters#scala#scalastyle#GetCommand(buffer) abort " If all else fails, try the global config. if empty(l:scalastyle_config) - let l:scalastyle_config = get(g:, 'ale_scalastyle_config_loc', '') - endif - - " Build the command using the config file and additional options. - let l:command = 'scalastyle' - - if !empty(l:scalastyle_config) - let l:command .= ' --config ' . ale#Escape(l:scalastyle_config) + let l:scalastyle_config = ale#Var(a:buffer, 'scala_scalastyle_config') endif - if !empty(g:ale_scala_scalastyle_options) - let l:command .= ' ' . g:ale_scala_scalastyle_options - endif - - let l:command .= ' %t' - - return l:command + return 'scalastyle' + \ . (!empty(l:scalastyle_config) ? ' --config ' . ale#Escape(l:scalastyle_config) : '') + \ . ale#Pad(ale#Var(a:buffer, 'scala_scalastyle_options')) + \ . ' %t' endfunction call ale#linter#Define('scala', { diff --git a/ale_linters/tex/write-good.vim b/ale_linters/tex/write-good.vim deleted file mode 100644 index dc59de2e..00000000 --- a/ale_linters/tex/write-good.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Author: Sumner Evans -" Description: write-good for TeX files - -call ale#linter#Define('tex', { -\ 'name': 'write-good', -\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', -\ 'command_callback': 'ale#handlers#writegood#GetCommand', -\ 'callback': 'ale#handlers#writegood#Handle', -\}) diff --git a/ale_linters/tex/writegood.vim b/ale_linters/tex/writegood.vim new file mode 100644 index 00000000..dc59de2e --- /dev/null +++ b/ale_linters/tex/writegood.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" Description: write-good for TeX files + +call ale#linter#Define('tex', { +\ 'name': 'write-good', +\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', +\ 'command_callback': 'ale#handlers#writegood#GetCommand', +\ 'callback': 'ale#handlers#writegood#Handle', +\}) diff --git a/ale_linters/texinfo/write-good.vim b/ale_linters/texinfo/write-good.vim deleted file mode 100644 index 8104c634..00000000 --- a/ale_linters/texinfo/write-good.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Author: Sumner Evans -" Description: write-good for Texinfo files - -call ale#linter#Define('texinfo', { -\ 'name': 'write-good', -\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', -\ 'command_callback': 'ale#handlers#writegood#GetCommand', -\ 'callback': 'ale#handlers#writegood#Handle', -\}) diff --git a/ale_linters/texinfo/writegood.vim b/ale_linters/texinfo/writegood.vim new file mode 100644 index 00000000..8104c634 --- /dev/null +++ b/ale_linters/texinfo/writegood.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" Description: write-good for Texinfo files + +call ale#linter#Define('texinfo', { +\ 'name': 'write-good', +\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', +\ 'command_callback': 'ale#handlers#writegood#GetCommand', +\ 'callback': 'ale#handlers#writegood#Handle', +\}) diff --git a/ale_linters/text/write-good.vim b/ale_linters/text/write-good.vim deleted file mode 100644 index ff76ce42..00000000 --- a/ale_linters/text/write-good.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Author: Sumner Evans -" Description: write-good for text files - -call ale#linter#Define('text', { -\ 'name': 'write-good', -\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', -\ 'command_callback': 'ale#handlers#writegood#GetCommand', -\ 'callback': 'ale#handlers#writegood#Handle', -\}) diff --git a/ale_linters/text/writegood.vim b/ale_linters/text/writegood.vim new file mode 100644 index 00000000..ff76ce42 --- /dev/null +++ b/ale_linters/text/writegood.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" Description: write-good for text files + +call ale#linter#Define('text', { +\ 'name': 'write-good', +\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', +\ 'command_callback': 'ale#handlers#writegood#GetCommand', +\ 'callback': 'ale#handlers#writegood#Handle', +\}) diff --git a/ale_linters/thrift/thrift.vim b/ale_linters/thrift/thrift.vim index 741e80ab..a8fe10b6 100644 --- a/ale_linters/thrift/thrift.vim +++ b/ale_linters/thrift/thrift.vim @@ -20,14 +20,12 @@ function! ale_linters#thrift#thrift#GetCommand(buffer) abort let l:generators = ['cpp'] endif - let l:output_dir = ale#util#Tempname() - call mkdir(l:output_dir) - call ale#engine#ManageDirectory(a:buffer, l:output_dir) + let l:output_dir = ale#engine#CreateDirectory(a:buffer) return ale#Escape(ale_linters#thrift#thrift#GetExecutable(a:buffer)) - \ . ' ' . join(map(copy(l:generators), "'--gen ' . v:val")) - \ . ' ' . join(map(copy(l:includes), "'-I ' . v:val")) - \ . ' ' . ale#Var(a:buffer, 'thrift_thrift_options') + \ . ale#Pad(join(map(copy(l:generators), "'--gen ' . v:val"))) + \ . ale#Pad(join(map(copy(l:includes), "'-I ' . v:val"))) + \ . ale#Pad(ale#Var(a:buffer, 'thrift_thrift_options')) \ . ' -out ' . ale#Escape(l:output_dir) \ . ' %t' endfunction diff --git a/ale_linters/typescript/tslint.vim b/ale_linters/typescript/tslint.vim index b28f7cee..ccdca936 100644 --- a/ale_linters/typescript/tslint.vim +++ b/ale_linters/typescript/tslint.vim @@ -1,17 +1,7 @@ " Author: Prashanth Chandra , Jonathan Clem " Description: tslint for TypeScript files -call ale#Set('typescript_tslint_executable', 'tslint') -call ale#Set('typescript_tslint_config_path', '') -call ale#Set('typescript_tslint_rules_dir', '') -call ale#Set('typescript_tslint_use_global', get(g:, 'ale_use_global_executables', 0)) -call ale#Set('typescript_tslint_ignore_empty_files', 0) - -function! ale_linters#typescript#tslint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'typescript_tslint', [ - \ 'node_modules/.bin/tslint', - \]) -endfunction +call ale#handlers#tslint#InitVariables() function! ale_linters#typescript#tslint#Handle(buffer, lines) abort " Do not output any errors for empty files if the option is on. @@ -70,7 +60,7 @@ function! ale_linters#typescript#tslint#GetCommand(buffer) abort \ : '' return ale#path#BufferCdString(a:buffer) - \ . ale#Escape(ale_linters#typescript#tslint#GetExecutable(a:buffer)) + \ . ale#Escape(ale#handlers#tslint#GetExecutable(a:buffer)) \ . ' --format json' \ . l:tslint_config_option \ . l:tslint_rules_option @@ -79,7 +69,7 @@ endfunction call ale#linter#Define('typescript', { \ 'name': 'tslint', -\ 'executable_callback': 'ale_linters#typescript#tslint#GetExecutable', +\ 'executable_callback': 'ale#handlers#tslint#GetExecutable', \ 'command_callback': 'ale_linters#typescript#tslint#GetCommand', \ 'callback': 'ale_linters#typescript#tslint#Handle', \}) diff --git a/ale_linters/xhtml/write-good.vim b/ale_linters/xhtml/write-good.vim deleted file mode 100644 index 83d1863b..00000000 --- a/ale_linters/xhtml/write-good.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Author: Sumner Evans -" Description: write-good for XHTML files - -call ale#linter#Define('xhtml', { -\ 'name': 'write-good', -\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', -\ 'command_callback': 'ale#handlers#writegood#GetCommand', -\ 'callback': 'ale#handlers#writegood#Handle', -\}) diff --git a/ale_linters/xhtml/writegood.vim b/ale_linters/xhtml/writegood.vim new file mode 100644 index 00000000..83d1863b --- /dev/null +++ b/ale_linters/xhtml/writegood.vim @@ -0,0 +1,9 @@ +" Author: Sumner Evans +" Description: write-good for XHTML files + +call ale#linter#Define('xhtml', { +\ 'name': 'write-good', +\ 'executable_callback': 'ale#handlers#writegood#GetExecutable', +\ 'command_callback': 'ale#handlers#writegood#GetCommand', +\ 'callback': 'ale#handlers#writegood#Handle', +\}) diff --git a/ale_linters/xml/xmllint.vim b/ale_linters/xml/xmllint.vim index 63d7f768..9d79438e 100644 --- a/ale_linters/xml/xmllint.vim +++ b/ale_linters/xml/xmllint.vim @@ -11,7 +11,7 @@ endfunction function! ale_linters#xml#xmllint#GetCommand(buffer) abort return ale#Escape(ale_linters#xml#xmllint#GetExecutable(a:buffer)) - \ . ' ' . ale#Var(a:buffer, 'xml_xmllint_options') + \ . ale#Pad(ale#Var(a:buffer, 'xml_xmllint_options')) \ . ' --noout -' endfunction -- cgit v1.2.3