Closed tomiszili closed 1 year ago
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.76.0
hooks:
- id: terraform_checkov
args:
- --args=--quiet
- --args=--framework terraform
exclude: '/examples/'
That's what you need
https://pre-commit.com/#config-exclude
https://pre-commit.com/#regular-expressions
--directory __GIT_WORKING_DIR__/
- useless, because pre-commit hooks run only on changed files (in case with some TF hooks - on changed dirs)
If you'd like to have --directory __GIT_WORKING_DIR__/
, which the same as pre-commit run --all
, you also need include always_run
Hello,
Describe the bug
I have tried several different options to exclude my
examples
directory under any folder, but somehow checkov checks them as this argument haven't provided at all in the pre-commit config file.How can we reproduce it?
An option to reproduce this bug: delete some checkov skip comments in your folder and run
git add -A
and after thatpre-commit run
.Environment information
OS:
uname -a
and/orsysteminfo | Select-String "^OS"
output:.pre-commit-config.yaml
:file content
```bash repos: - repo: https://github.com/antonbabenko/pre-commit-terraform rev: v1.76.0 hooks: - id: terraform_checkov args: - --args=--directory __GIT_WORKING_DIR__/ - --args=--skip-path '/examples/.*' # not working... - --args=--skip-path ".*/examples/.*", # not working... - --args=--skip-path "(../|./|/|.*)*examples(/.*)*", # not working... - --args=--skip-path '__GIT_WORKING_DIR__/.*/examples/.*' # not working - --args=--quiet - --args=--framework terraform ```