Add checkov linter for cloudformation

Co-Authored-By: jhandsel <64368631+jhandsel@users.noreply.github.com>
This commit is contained in:
w0rp
2025-08-14 17:33:36 +01:00
parent 37e64b5caf
commit 3539f39d4d
7 changed files with 191 additions and 0 deletions

View File

@@ -41,5 +41,51 @@ Just put the following in `ftdetect/cloudformation.vim`: >
This will get both cloudformation and yaml linters to work on any file with
`.template.yaml` extension.
===============================================================================
checkov *ale-cloudformation-checkov*
*ale-options.cloudformation_checkov_executable*
*g:ale_cloudformation_checkov_executable*
*b:ale_cloudformation_checkov_executable*
cloudformation_checkov_executable
g:ale_cloudformation_checkov_executable
Type: |String|
Default: `'checkov'`
This variable can be changed to use a different executable for checkov.
*ale-options.cloudformation_checkov_options*
*g:ale_cloudformation_checkov_options*
*b:ale_cloudformation_checkov_options*
cloudformation_checkov_options
g:ale_cloudformation_checkov_options
Type: |String|
Default: `''`
This variable can be changed to set additional options for checkov.
-------------------------------------------------------------------------------
Configuration
To get chekov to work with cloudformation files (rather than general yaml
files) we must set the buffer |filetype| to `yaml.cloudformation`. This
causes ALE to lint the file with linters configured for cloudformation and
YAML files.
One option is to put the following in `ftdetect/cloudformation.vim`: >
au BufRead,BufNewFile *.template.yaml set filetype=yaml.cloudformation
This will get both cloudformation and yaml linters to work on any file with
`.template.yaml` extension.
Another option is to check for the presence of 'AWSTemplateFormatVersion' in
the yaml file: >
au BufRead,BufNewFile *.yaml,*.yml if search('AWSTemplateFormatVersion', 'nw') | set filetype=yaml.cloudformation | endif
<
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -121,6 +121,7 @@ Notes:
* `joker`
* CloudFormation
* `cfn-python-lint`
* `checkov`
* CMake
* `cmake-format`
* `cmake-lint`

View File

@@ -3419,6 +3419,7 @@ documented in additional help files.
joker.................................|ale-clojure-joker|
cloudformation..........................|ale-cloudformation-options|
cfn-python-lint.......................|ale-cloudformation-cfn-python-lint|
checkov...............................|ale-cloudformation-checkov|
cmake...................................|ale-cmake-options|
cmakelint.............................|ale-cmake-cmakelint|
cmake-lint............................|ale-cmake-cmake-lint|