Skip to content

Commit 2468b69

Browse files
committed
move bandit excludes to pyproject.toml
Move the list of excluded files from --exclude in tox.ini to exclude_dirs in pyproject.toml to centralize configuration in pyproject.toml and make it accessible to tools and bandit invocations outside of tox. - Remove the comment that exclude is ignored by bandit 1.6.3+, which was fixed by PyCQA/bandit#722 in bandit 1.7.1. - Change exclude (which only works for INI files) to exclude_dirs (which only works for TOML and YAML files), as described in PyCQA/bandit#876 - Add /.git/ and /__pycache__/ to exclude_dirs to match --exclude. - Remove --exclude from invocation in tox.ini Signed-off-by: Kevin Locke <[email protected]>
1 parent 6209c86 commit 2468b69

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ requires = [
1818
build-backend = 'setuptools.build_meta'
1919

2020
[tool.bandit]
21-
# Note: exclude is ignored by bandit 1.6.3 and later.
22-
# See https://github.com/PyCQA/bandit/issues/657
23-
exclude = [
21+
exclude_dirs = [
22+
'/.git/',
2423
'/.tox/',
2524
'/.venv/',
25+
'/__pycache__/',
2626
]
2727
skips = [
2828
'B101', # assert_used (needed for pytest, arguably useful outside)

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ commands =
4444
# List files and top-level packages/directories explicitly for now.
4545
pylint docs setup.py src/packagename tests
4646
isort --check --diff .
47-
bandit -c pyproject.toml -f txt --exclude /.git/,/.tox/,/.venv/,/__pycache__/ -r .
47+
bandit -c pyproject.toml -f txt -r .
4848
pyroma .
4949
vulture --exclude */docs/*,*/tests/*,*/.tox/*,*/.venv*/* .
5050
black --check --diff .

0 commit comments

Comments
 (0)