diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | ale_linters/make/checkmake.vim | 24 | ||||
-rw-r--r-- | doc/ale.txt | 1 | ||||
-rw-r--r-- | test/handler/test_checkmake_handler.vader | 19 |
4 files changed, 45 insertions, 0 deletions
@@ -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) !! | diff --git a/ale_linters/make/checkmake.vim b/ale_linters/make/checkmake.vim new file mode 100644 index 00000000..3dd8cc91 --- /dev/null +++ b/ale_linters/make/checkmake.vim @@ -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', +\}) diff --git a/doc/ale.txt b/doc/ale.txt index 68e71a66..42f48b23 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -267,6 +267,7 @@ Notes: * LLVM: `llc` * Lua: `luacheck` * Mail: `proselint` +* Make: `checkmake` * Markdown: `mdl`, `proselint`, `vale`, `remark-lint` * MATLAB: `mlint` * Nim: `nim check`!! diff --git a/test/handler/test_checkmake_handler.vader b/test/handler/test_checkmake_handler.vader new file mode 100644 index 00000000..61fe141a --- /dev/null +++ b/test/handler/test_checkmake_handler.vader @@ -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() |