mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-21 09:08:34 +08:00
add: support config option for checkmake linter (#4351)
`checkmake` by default checks config file "in the same folder it's executed in" unless `--config` option is set. This commit allows setting the `--config` option with an option variable (with documentation updated).
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
" 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 = []
|
||||
@@ -17,9 +19,19 @@ function! ale_linters#make#checkmake#Handle(buffer, lines) abort
|
||||
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': 'checkmake %s --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}{{\"\r\n\"}}"',
|
||||
\ 'command': function('ale_linters#make#checkmake#GetCommand'),
|
||||
\ 'callback': 'ale_linters#make#checkmake#Handle',
|
||||
\})
|
||||
|
||||
Reference in New Issue
Block a user