diff options
author | Yining <zhang.yining@gmail.com> | 2022-11-06 08:32:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-06 09:32:51 +0900 |
commit | edffffac2570cf837badf4195fb3d55ae439af7d (patch) | |
tree | 7bb57352a3f1224ceb5c05b8c3a74aaf513d7e46 /ale_linters | |
parent | 07bd24d0fd767e9c584a45d43f23e8d5956665fe (diff) | |
download | ale-edffffac2570cf837badf4195fb3d55ae439af7d.zip |
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).
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/make/checkmake.vim | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/ale_linters/make/checkmake.vim b/ale_linters/make/checkmake.vim index d5f95d6f..fed01b5f 100644 --- a/ale_linters/make/checkmake.vim +++ b/ale_linters/make/checkmake.vim @@ -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', \}) |