1
0
Fork 0
mirror of synced 2024-11-14 13:08:59 -05:00
ultimate-vim/sources_non_forked/ale/ale_linters/make/checkmake.vim

38 lines
1.1 KiB
VimL
Raw Normal View History

" Author: aurieh - https://github.com/aurieh
2022-11-20 06:21:23 -05:00
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
2018-09-24 20:40:17 -04:00
return l:output
endfunction
2022-11-20 06:21:23 -05:00
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',
2022-11-20 06:21:23 -05:00
\ 'command': function('ale_linters#make#checkmake#GetCommand'),
\ 'callback': 'ale_linters#make#checkmake#Handle',
\})