X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/0ee596c5c5e11fc79598407eaf22f83d279f7e9e..5a4872f466ebd76ddd532bdf2798554421c53df4:/.vim/bundle/ale/ale_linters/make/checkmake.vim?ds=sidebyside diff --git a/.vim/bundle/ale/ale_linters/make/checkmake.vim b/.vim/bundle/ale/ale_linters/make/checkmake.vim new file mode 100644 index 00000000..fed01b5f --- /dev/null +++ b/.vim/bundle/ale/ale_linters/make/checkmake.vim @@ -0,0 +1,37 @@ +" Author: aurieh - https://github.com/aurieh + +call ale#Set('make_checkmake_config', '') + +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) + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:match[1] + 0, + \ 'type': 'E', + \ 'code': l:match[2], + \ 'text': l:match[3], + \}) + endfor + + return l:output +endfunction + +function! ale_linters#make#checkmake#GetCommand(buffer) abort + let l:config = ale#Var(a:buffer, 'make_checkmake_config') + let l:cmd = 'checkmake' + \ . ' --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}{{\"\r\n\"}}"' + \ . (!empty(l:config) ? ' --config="' . l:config . '"' : '') + \ . ' %s' + + return l:cmd +endfunction + +call ale#linter#Define('make', { +\ 'name': 'checkmake', +\ 'executable': 'checkmake', +\ 'command': function('ale_linters#make#checkmake#GetCommand'), +\ 'callback': 'ale_linters#make#checkmake#Handle', +\})