All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: Thyme-87 <thyme-87@posteo.me>
2 " Description: use checkov for providing warnings via ale
4 call ale#Set('terraform_checkov_executable', 'checkov')
5 call ale#Set('terraform_checkov_options', '')
7 function! ale_linters#terraform#checkov#GetExecutable(buffer) abort
8 return ale#Var(a:buffer, 'terraform_checkov_executable')
11 function! ale_linters#terraform#checkov#GetCommand(buffer) abort
12 return '%e ' . '-f %t -o json --quiet ' . ale#Var(a:buffer, 'terraform_checkov_options')
15 function! ale_linters#terraform#checkov#Handle(buffer, lines) abort
18 let l:results = get(get(ale#util#FuzzyJSONDecode(a:lines, {}), 'results', []), 'failed_checks', [])
20 for l:violation in l:results
22 \ 'filename': l:violation['file_path'],
23 \ 'lnum': l:violation['file_line_range'][0],
24 \ 'end_lnum': l:violation['file_line_range'][1],
25 \ 'text': l:violation['check_name'] . ' [' . l:violation['check_id'] . ']',
26 \ 'detail': l:violation['check_id'] . ': ' . l:violation['check_name'] . "\n" .
27 \ 'For more information, see: '. l:violation['guideline'],
35 call ale#linter#Define('terraform', {
37 \ 'output_stream': 'stdout',
38 \ 'executable': function('ale_linters#terraform#checkov#GetExecutable'),
39 \ 'command': function('ale_linters#terraform#checkov#GetCommand'),
40 \ 'callback': 'ale_linters#terraform#checkov#Handle',