mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-08 21:44:47 +08:00
When using actionlint look for & use a config file (#4858)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Actionlint supports a config file and it lives in a very searchable path, as the only files it acts on are in the `.github` directory already. Look for an `actionlint.yml` and `.yaml` in that path, and use the config if its there.
This commit is contained in:
@@ -20,9 +20,32 @@ function! ale_linters#yaml#actionlint#GetCommand(buffer) abort
|
|||||||
let l:options .= ale#Pad('-oneline')
|
let l:options .= ale#Pad('-oneline')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let l:configfile = ale_linters#yaml#actionlint#GitRepoHasConfig(a:buffer)
|
||||||
|
|
||||||
|
if !empty(l:configfile)
|
||||||
|
let l:options .= ale#Pad('-config-file ' . l:configfile)
|
||||||
|
endif
|
||||||
|
|
||||||
return '%e' . ale#Pad(l:options) . ' - '
|
return '%e' . ale#Pad(l:options) . ' - '
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" If we have a actionlint.yml or actionlint.yaml in our github directory
|
||||||
|
" use that as our config file.
|
||||||
|
function! ale_linters#yaml#actionlint#GitRepoHasConfig(buffer) abort
|
||||||
|
let l:filename = expand('#' . a:buffer . ':p')
|
||||||
|
let l:configfilebase = substitute(l:filename, '\.github/.*', '.github/actionlint.','')
|
||||||
|
|
||||||
|
for l:ext in ['yml', 'yaml']
|
||||||
|
let l:configfile = l:configfilebase . l:ext
|
||||||
|
|
||||||
|
if filereadable(l:configfile)
|
||||||
|
return l:configfile
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#yaml#actionlint#Handle(buffer, lines) abort
|
function! ale_linters#yaml#actionlint#Handle(buffer, lines) abort
|
||||||
" Matches patterns line the following:
|
" Matches patterns line the following:
|
||||||
".github/workflows/main.yml:19:0: could not parse as YAML: yaml: line 19: mapping values are not allowed in this context [yaml-syntax]
|
".github/workflows/main.yml:19:0: could not parse as YAML: yaml: line 19: mapping values are not allowed in this context [yaml-syntax]
|
||||||
|
|||||||
Reference in New Issue
Block a user