Skip to content

Commit c991716

Browse files
committed
Add flake8-bandit to report common security issues
1 parent 2b12f17 commit c991716

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

.bandit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# unfortunately, flake8-bandit does not support pyproject.toml
2+
3+
[bandit]
4+
exclude = /tests

.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# unfortunately, flake8 does not support pyproject.toml
2+
13
[flake8]
24
ignore = E203,W503
35
exclude = .git,.mypy_cache,.pytest_cache,.tox,.venv,__pycache__,build,dist,docs

pyproject.toml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ packages = [
2525
{ include = "graphql", from = "src" },
2626
{ include = "tests", format = "sdist" },
2727
{ include = "docs", format = "sdist" },
28-
{ include = '.bumpversion.cfg', format = "sdist" },
29-
{ include = '.editorconfig', format = "sdist" },
30-
{ include = '.flake8', format = "sdist" },
31-
{ include = '.readthedocs.yaml', format = "sdist" },
32-
{ include = 'poetry.lock', format = "sdist" },
33-
{ include = 'tox.ini', format = "sdist" },
34-
{ include = 'CODEOWNERS', format = "sdist" },
35-
{ include = 'SECURITY.md', format = "sdist" }
28+
{ include = ".bumpversion.cfg", format = "sdist" },
29+
{ include = ".editorconfig", format = "sdist" },
30+
{ include = ".flake8", format = "sdist" },
31+
{ include = ".readthedocs.yaml", format = "sdist" },
32+
{ include = "poetry.lock", format = "sdist" },
33+
{ include = "tox.ini", format = "sdist" },
34+
{ include = "CODEOWNERS", format = "sdist" },
35+
{ include = "SECURITY.md", format = "sdist" }
3636
]
3737

3838
[tool.poetry.urls]
@@ -62,6 +62,7 @@ optional = true
6262
[tool.poetry.group.lint.dependencies]
6363
black = "22.8.0"
6464
flake8 = "^5.0"
65+
flake8-bandit = "^4.1"
6566
isort = "^5.10"
6667
mypy = "0.971"
6768
bump2version = ">=1.0,<2"
@@ -74,8 +75,11 @@ optional = true
7475
sphinx = ">= 4.3,<6"
7576
sphinx_rtd_theme = ">=1,<2"
7677

78+
[tool.bandit]
79+
exclude_dirs = ["tests"]
80+
7781
[tool.black]
78-
target-version = ['py37', 'py38', 'py39', 'py310']
82+
target-version = ["py37", "py38", "py39", "py310"]
7983

8084
[tool.coverage.run]
8185
branch = true

tox.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ commands =
1717

1818
[testenv:flake8]
1919
basepython = python3.9
20-
deps = flake8>=5,<6
20+
deps =
21+
flake8>=5,<6
22+
flake8-bandit>=4.1,<6
2123
commands =
2224
flake8 src tests
2325

0 commit comments

Comments
 (0)