diff options
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/awk/gawk.vim | 6 | ||||
-rw-r--r-- | ale_linters/c/flawfinder.vim | 3 | ||||
-rw-r--r-- | ale_linters/cpp/flawfinder.vim | 2 | ||||
-rw-r--r-- | ale_linters/go/gosimple.vim | 8 | ||||
-rw-r--r-- | ale_linters/go/gotype.vim | 25 | ||||
-rw-r--r-- | ale_linters/go/govet.vim | 19 | ||||
-rw-r--r-- | ale_linters/go/staticcheck.vim | 2 | ||||
-rw-r--r-- | ale_linters/markdown/textlint.vim | 23 | ||||
-rw-r--r-- | ale_linters/typescript/tslint.vim | 2 |
9 files changed, 51 insertions, 39 deletions
diff --git a/ale_linters/awk/gawk.vim b/ale_linters/awk/gawk.vim index ac6e9154..3e9987b3 100644 --- a/ale_linters/awk/gawk.vim +++ b/ale_linters/awk/gawk.vim @@ -12,7 +12,11 @@ function! ale_linters#awk#gawk#GetExecutable(buffer) abort endfunction 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) + \ . " --source 'BEGIN { exit } END { exit 1 }'" \ . ' ' . ale#Var(a:buffer, 'awk_gawk_options') \ . ' ' . '-f %t --lint /dev/null' endfunction @@ -21,6 +25,6 @@ call ale#linter#Define('awk', { \ 'name': 'gawk', \ 'executable_callback': 'ale_linters#awk#gawk#GetExecutable', \ 'command_callback': 'ale_linters#awk#gawk#GetCommand', -\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat', +\ 'callback': 'ale#handlers#gawk#HandleGawkFormat', \ 'output_stream': 'both' \}) diff --git a/ale_linters/c/flawfinder.vim b/ale_linters/c/flawfinder.vim index 27f269f5..df6fbebe 100644 --- a/ale_linters/c/flawfinder.vim +++ b/ale_linters/c/flawfinder.vim @@ -4,6 +4,7 @@ call ale#Set('c_flawfinder_executable', 'flawfinder') call ale#Set('c_flawfinder_options', '') call ale#Set('c_flawfinder_minlevel', 1) +call ale#Set('c_flawfinder_error_severity', 6) function! ale_linters#c#flawfinder#GetExecutable(buffer) abort return ale#Var(a:buffer, 'c_flawfinder_executable') @@ -26,5 +27,5 @@ call ale#linter#Define('c', { \ 'output_stream': 'stdout', \ 'executable_callback': 'ale_linters#c#flawfinder#GetExecutable', \ 'command_callback': 'ale_linters#c#flawfinder#GetCommand', -\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat', \}) diff --git a/ale_linters/cpp/flawfinder.vim b/ale_linters/cpp/flawfinder.vim index a19f5962..c63ecb38 100644 --- a/ale_linters/cpp/flawfinder.vim +++ b/ale_linters/cpp/flawfinder.vim @@ -26,5 +26,5 @@ call ale#linter#Define('cpp', { \ 'output_stream': 'stdout', \ 'executable_callback': 'ale_linters#cpp#flawfinder#GetExecutable', \ 'command_callback': 'ale_linters#cpp#flawfinder#GetCommand', -\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat', \}) diff --git a/ale_linters/go/gosimple.vim b/ale_linters/go/gosimple.vim index 8a4c01e1..dbdc3fcf 100644 --- a/ale_linters/go/gosimple.vim +++ b/ale_linters/go/gosimple.vim @@ -1,11 +1,15 @@ " Author: Ben Reedy <https://github.com/breed808> " Description: gosimple for Go files +function! ale_linters#go#gosimple#GetCommand(buffer) abort + return ale#path#BufferCdString(a:buffer) . ' gosimple .' +endfunction + call ale#linter#Define('go', { \ 'name': 'gosimple', \ 'executable': 'gosimple', -\ 'command': 'gosimple %s', -\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\ 'command_callback': 'ale_linters#go#gosimple#GetCommand', +\ 'callback': 'ale#handlers#go#Handler', \ 'output_stream': 'both', \ 'lint_file': 1, \}) diff --git a/ale_linters/go/gotype.vim b/ale_linters/go/gotype.vim index 731f4c92..f4bb274e 100644 --- a/ale_linters/go/gotype.vim +++ b/ale_linters/go/gotype.vim @@ -1,23 +1,20 @@ " Author: Jelte Fennema <github-public@jeltef.nl> " Description: gotype for Go files -call ale#linter#Define('go', { -\ 'name': 'gotype', -\ 'output_stream': 'stderr', -\ 'executable': 'gotype', -\ 'command_callback': 'ale_linters#go#gotype#GetCommand', -\ 'callback': 'ale#handlers#unix#HandleAsError', -\}) - -"\ 'command': function! ale_linters#go#gotype#GetCommand(buffer) abort - let l:cur_file = expand('#' . a:buffer . ':p') - if l:cur_file =~# '_test\.go$' + if expand('#' . a:buffer . ':p') =~# '_test\.go$' return endif - let l:module_files = globpath(expand('#' . a:buffer . ':p:h'), '*.go', 0, 1) - let l:other_module_files = filter(l:module_files, 'v:val isnot# ' . ale#util#EscapeVim(l:cur_file) . ' && v:val !~# "_test\.go$"') - return 'gotype %t ' . join(map(l:other_module_files, 'ale#Escape(v:val)')) + return ale#path#BufferCdString(a:buffer) . ' gotype .' endfunction + +call ale#linter#Define('go', { +\ 'name': 'gotype', +\ 'output_stream': 'stderr', +\ 'executable': 'gotype', +\ 'command_callback': 'ale_linters#go#gotype#GetCommand', +\ 'callback': 'ale#handlers#go#Handler', +\ 'lint_file': 1, +\}) diff --git a/ale_linters/go/govet.vim b/ale_linters/go/govet.vim index aae5969d..edf9eb66 100644 --- a/ale_linters/go/govet.vim +++ b/ale_linters/go/govet.vim @@ -8,28 +8,11 @@ function! ale_linters#go#govet#GetCommand(buffer) abort return ale#path#BufferCdString(a:buffer) . ' go vet .' endfunction -function! ale_linters#go#govet#Handler(buffer, lines) abort - let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? ?(.+)$' - let l:output = [] - let l:dir = expand('#' . a:buffer . ':p:h') - - for l:match in ale#util#GetMatches(a:lines, l:pattern) - call add(l:output, { - \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), - \ 'lnum': l:match[2] + 0, - \ 'col': l:match[3] + 0, - \ 'text': l:match[4], - \ 'type': 'E', - \}) - endfor - return l:output -endfunction - call ale#linter#Define('go', { \ 'name': 'go vet', \ 'output_stream': 'stderr', \ 'executable': 'go', \ 'command_callback': 'ale_linters#go#govet#GetCommand', -\ 'callback': 'ale_linters#go#govet#Handler', +\ 'callback': 'ale#handlers#go#Handler', \ 'lint_file': 1, \}) diff --git a/ale_linters/go/staticcheck.vim b/ale_linters/go/staticcheck.vim index ce9e6e38..a3464015 100644 --- a/ale_linters/go/staticcheck.vim +++ b/ale_linters/go/staticcheck.vim @@ -27,7 +27,7 @@ call ale#linter#Define('go', { \ 'name': 'staticcheck', \ 'executable': 'staticcheck', \ 'command_callback': 'ale_linters#go#staticcheck#GetCommand', -\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\ 'callback': 'ale#handlers#go#Handler', \ 'output_stream': 'both', \ 'lint_file': 1, \}) diff --git a/ale_linters/markdown/textlint.vim b/ale_linters/markdown/textlint.vim new file mode 100644 index 00000000..4899fb53 --- /dev/null +++ b/ale_linters/markdown/textlint.vim @@ -0,0 +1,23 @@ +" Author: tokida https://rouger.info +" Description: textlint, a proofreading tool (https://textlint.github.io/) + +function! ale_linters#markdown#textlint#GetCommand(buffer) abort + let l:cmd_path = ale#path#FindNearestFile(a:buffer, '.textlintrc') + + if !empty(l:cmd_path) + return 'textlint' + \ . ' -c ' + \ . l:cmd_path + \ . ' -f json %t' + endif + + return '' +endfunction + + +call ale#linter#Define('markdown', { +\ 'name': 'textlint', +\ 'executable': 'textlint', +\ 'command_callback': 'ale_linters#markdown#textlint#GetCommand', +\ 'callback': 'ale#handlers#textlint#HandleTextlintOutput', +\}) diff --git a/ale_linters/typescript/tslint.vim b/ale_linters/typescript/tslint.vim index f4b48169..6f94fbae 100644 --- a/ale_linters/typescript/tslint.vim +++ b/ale_linters/typescript/tslint.vim @@ -70,7 +70,7 @@ function! ale_linters#typescript#tslint#GetCommand(buffer) abort \ : '' return ale#path#BufferCdString(a:buffer) - \ . ale_linters#typescript#tslint#GetExecutable(a:buffer) + \ . ale#Escape(ale_linters#typescript#tslint#GetExecutable(a:buffer)) \ . ' --format json' \ . l:tslint_config_option \ . l:tslint_rules_option |