]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/make/checkmake.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit 'd49e95aa7ba744f0a7f544aca43afdb6aab41f24' as '.vim/bundle/asyncomplete...
[etc/vim.git] / .vim / bundle / ale / ale_linters / make / checkmake.vim
1 " Author: aurieh - https://github.com/aurieh
2
3 call ale#Set('make_checkmake_config', '')
4
5 function! ale_linters#make#checkmake#Handle(buffer, lines) abort
6     let l:pattern = '\v^(\d+):(.+):(.+)$'
7     let l:output = []
8
9     for l:match in ale#util#GetMatches(a:lines, l:pattern)
10         call add(l:output, {
11         \    'bufnr': a:buffer,
12         \    'lnum': l:match[1] + 0,
13         \    'type': 'E',
14         \    'code': l:match[2],
15         \    'text': l:match[3],
16         \})
17     endfor
18
19     return l:output
20 endfunction
21
22 function! ale_linters#make#checkmake#GetCommand(buffer) abort
23     let l:config = ale#Var(a:buffer, 'make_checkmake_config')
24     let l:cmd = 'checkmake'
25     \   . ' --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}{{\"\r\n\"}}"'
26     \   . (!empty(l:config) ? ' --config="' . l:config . '"' : '')
27     \   . ' %s'
28
29     return l:cmd
30 endfunction
31
32 call ale#linter#Define('make', {
33 \   'name': 'checkmake',
34 \   'executable': 'checkmake',
35 \   'command': function('ale_linters#make#checkmake#GetCommand'),
36 \   'callback': 'ale_linters#make#checkmake#Handle',
37 \})