diff options
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/elm/make.vim | 4 | ||||
-rw-r--r-- | ale_linters/llvm/llc.vim | 35 | ||||
-rw-r--r-- | ale_linters/lua/luacheck.vim | 6 | ||||
-rw-r--r-- | ale_linters/markdown/remark_lint.vim | 28 | ||||
-rw-r--r-- | ale_linters/scala/scalastyle.vim | 13 |
5 files changed, 83 insertions, 3 deletions
diff --git a/ale_linters/elm/make.vim b/ale_linters/elm/make.vim index 4038e3b4..3783b5e3 100644 --- a/ale_linters/elm/make.vim +++ b/ale_linters/elm/make.vim @@ -71,11 +71,11 @@ function! ale_linters#elm#make#GetCommand(buffer) abort " The elm-make compiler, at the time of this writing, uses '/dev/null' as " a sort of flag to tell the compiler not to generate an output file, - " which is why this is hard coded here. + " which is why this is hard coded here. It does not use NUL on Windows. " Source: https://github.com/elm-lang/elm-make/blob/master/src/Flags.hs let l:elm_cmd = ale#Escape(l:elm_exe) \ . ' --report=json' - \ . ' --output=' . ale#Escape(g:ale#util#nul_file) + \ . ' --output=/dev/null' return l:dir_set_cmd . ' ' . l:elm_cmd . ' %t' endfunction diff --git a/ale_linters/llvm/llc.vim b/ale_linters/llvm/llc.vim new file mode 100644 index 00000000..0a4903eb --- /dev/null +++ b/ale_linters/llvm/llc.vim @@ -0,0 +1,35 @@ +" Author: rhysd <https://rhysd.github.io> +" Description: Support for checking LLVM IR with llc + +call ale#Set('llvm_llc_executable', 'llc') + +function! ale_linters#llvm#llc#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'llvm_llc_executable') +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) +endfunction + +function! ale_linters#llvm#llc#HandleErrors(buffer, lines) abort + " Handle '{path}: {file}:{line}:{col}: error: {message}' format + let l:pattern = '\v^[a-zA-Z]?:?[^:]+: [^:]+:(\d+):(\d+): (.+)$' + let l:matches = ale#util#GetMatches(a:lines, l:pattern) + + return map(l:matches, "{ + \ 'lnum': str2nr(v:val[1]), + \ 'col': str2nr(v:val[2]), + \ 'text': v:val[3], + \ 'type': 'E', + \}") +endfunction + +call ale#linter#Define('llvm', { +\ 'name': 'llc', +\ 'executable_callback': 'ale_linters#llvm#llc#GetExecutable', +\ 'output_stream': 'stderr', +\ 'command_callback': 'ale_linters#llvm#llc#GetCommand', +\ 'callback': 'ale_linters#llvm#llc#HandleErrors', +\}) diff --git a/ale_linters/lua/luacheck.vim b/ale_linters/lua/luacheck.vim index e15b7301..9f9ca4c4 100644 --- a/ale_linters/lua/luacheck.vim +++ b/ale_linters/lua/luacheck.vim @@ -26,6 +26,12 @@ function! ale_linters#lua#luacheck#Handle(buffer, lines) abort let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) + if !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + \ && l:match[3] is# 'W' + \ && index(range(611, 614), str2nr(l:match[4])) >= 0 + continue + endif + call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, diff --git a/ale_linters/markdown/remark_lint.vim b/ale_linters/markdown/remark_lint.vim new file mode 100644 index 00000000..5b3b3d47 --- /dev/null +++ b/ale_linters/markdown/remark_lint.vim @@ -0,0 +1,28 @@ +" Author rhysd https://rhysd.github.io/ +" Description: remark-lint for Markdown files + +function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort + " matches: ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint' + let l:pattern = '^ \+\(\d\+\):\(\d\+\) \(warning\|error\) \(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'type': l:match[3] is# 'error' ? 'E' : 'W', + \ 'text': l:match[4], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('markdown', { +\ 'name': 'remark-lint', +\ 'executable': 'remark', +\ 'command': 'remark --no-stdout --no-color %s', +\ 'callback': 'ale_linters#markdown#remark_lint#Handle', +\ 'lint_file': 1, +\ 'output_stream': 'stderr', +\}) diff --git a/ale_linters/scala/scalastyle.vim b/ale_linters/scala/scalastyle.vim index ea56c0e4..f78fd749 100644 --- a/ale_linters/scala/scalastyle.vim +++ b/ale_linters/scala/scalastyle.vim @@ -8,10 +8,21 @@ let g:ale_scalastyle_config_loc = \ 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 + " configuration file was found. + for l:line in a:lines[:10] + if l:line =~# '-c, --config' + return [{ + \ 'lnum': 1, + \ 'text': '(See :help ale-scala-scalastyle)' + \ . ' No scalastyle configuration file was found.', + \}] + endif + endfor + " Matches patterns like the following: " " warning file=/home/blurble/Doop.scala message=Missing or badly formed ScalaDoc: Extra @param foobles line=190 - let l:patterns = [ \ '^\(.\+\) .\+ message=\(.\+\) line=\(\d\+\)$', \ '^\(.\+\) .\+ message=\(.\+\) line=\(\d\+\) column=\(\d\+\)$', |