Skip to content

Commit 2bcc0ca

Browse files
authored
Merge pull request #245 from cisagov/bugfix/make-bandit-pre-commit-check-useful-again
Make the `bandit` `pre-commit` hook useful again
2 parents edbdb35 + b7f5fec commit 2bcc0ca

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

.pre-commit-config.yaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,27 @@ repos:
128128
- id: shellcheck
129129

130130
# Python hooks
131+
# Run bandit on the Molecule tests
131132
- repo: https://github.com/PyCQA/bandit
132133
rev: 1.9.1
133134
hooks:
134135
- id: bandit
135-
# Bandit complains about the use of assert() in tests. This should cover
136-
# the tests/ subdirectory for any molecule scenario.
137-
exclude: molecule/[^/]+/tests
136+
name: bandit (Molecule tests)
137+
files: molecule/[^/]+/tests
138138
args:
139-
- --config=.bandit.yml
139+
# Skip "assert used" check since assertions are used
140+
# frequently in pytests.
141+
- --skip=B101
142+
# Run bandit on everything except the Molecule tests
143+
- repo: https://github.com/PyCQA/bandit
144+
rev: 1.8.6
145+
hooks:
146+
- id: bandit
147+
name: bandit (everything else)
148+
# Bandit complains about the use of assert() in tests. This
149+
# should cover the tests/ subdirectory for any molecule
150+
# scenario.
151+
exclude: molecule/[^/]+/tests
140152
- repo: https://github.com/psf/black-pre-commit-mirror
141153
rev: 25.11.0
142154
hooks:

0 commit comments

Comments
 (0)