Merge branch 'aurieh-master'

This commit is contained in:
w0rp 2017-10-24 22:45:30 +01:00
commit 1a5ef969a5
4 changed files with 45 additions and 0 deletions

View File

@ -110,6 +110,7 @@ formatting.
| LLVM | [llc](https://llvm.org/docs/CommandGuide/llc.html) |
| Lua | [luacheck](https://github.com/mpeterv/luacheck) |
| Mail | [proselint](http://proselint.com/) |
| Make | [checkmake](https://github.com/mrtazz/checkmake) |
| Markdown | [mdl](https://github.com/mivok/markdownlint), [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale), [remark-lint](https://github.com/wooorm/remark-lint) !! |
| MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) |
| Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! |

View File

@ -0,0 +1,24 @@
" Author: aurieh - https://github.com/aurieh
function! ale_linters#make#checkmake#Handle(buffer, lines) abort
let l:pattern = '\v^(\d+):(.+):(.+)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:text = l:match[2] . ': ' . l:match[3]
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
\ 'type': 'E',
\ 'text': l:text,
\})
endfor
return l:output
endfunction
call ale#linter#Define('make', {
\ 'name': 'checkmake',
\ 'executable': 'checkmake',
\ 'command': 'checkmake %s --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}"',
\ 'callback': 'ale_linters#make#checkmake#Handle',
\})

View File

@ -267,6 +267,7 @@ Notes:
* LLVM: `llc`
* Lua: `luacheck`
* Mail: `proselint`
* Make: `checkmake`
* Markdown: `mdl`, `proselint`, `vale`, `remark-lint`
* MATLAB: `mlint`
* Nim: `nim check`!!

View File

@ -0,0 +1,19 @@
Execute(Parsing checkmake errors should work):
runtime ale_linters/make/checkmake.vim
silent file Makefile
AssertEqual
\ [
\ {
\ 'bufnr': 42,
\ 'lnum': 1,
\ 'type': 'E',
\ 'text': 'woops: an error has occurred',
\ }
\ ],
\ ale_linters#make#checkmake#Handle(42, [
\ 'This shouldnt match',
\ '1:woops:an error has occurred',
\ ])
After:
call ale#linter#Reset()