Skip to content

Commit ffa65de

Browse files
authored
Merge pull request #412 from staticdev/feature/separate-bandit
Feature/separate bandit
2 parents e19f65f + a63ddd5 commit ffa65de

File tree

6 files changed

+150
-206
lines changed

6 files changed

+150
-206
lines changed

.flake8

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[flake8]
2-
select = B,B9,C,D,DAR,E,F,N,RST,S,W
2+
select = B,B9,C,D,DAR,E,F,N,RST,W
33
ignore = E203,E501,RST201,RST203,RST301,W503
44
max-line-length = 80
55
max-complexity = 10
66
docstring-convention = google
77
; TODO open upstream issue for N806 on Enum
8-
per-file-ignores = tests/*:S101, times.py:N806
8+
per-file-ignores = times.py:N806

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
repos:
22
- repo: local
33
hooks:
4+
- id: bandit
5+
name: bandit
6+
entry: bandit
7+
language: system
8+
types: [python]
9+
require_serial: true
10+
args: ["-c", "bandit.yml"]
411
- id: black
512
name: black
613
entry: black

bandit.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
assert_used:
2+
skips: ["*/test_*.py"]

noxfile.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
4646
Args:
4747
session: The Session object.
4848
"""
49-
assert session.bin is not None # noqa: S101
49+
assert session.bin is not None # nosec
5050

5151
# Only patch hooks containing a reference to this session's bindir. Support
5252
# quoting rules for Python and bash, but strip the outermost quotes so we
@@ -110,15 +110,15 @@ def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
110110
break
111111

112112

113-
@session(name="pre-commit", python="3.10")
113+
@session(name="pre-commit", python=python_versions[0])
114114
def precommit(session: Session) -> None:
115115
"""Lint using pre-commit."""
116116
args = session.posargs or ["run", "--all-files", "--show-diff-on-failure"]
117117
session.install(
118+
"bandit",
118119
"black",
119120
"darglint",
120121
"flake8",
121-
"flake8-bandit",
122122
"flake8-bugbear",
123123
"flake8-docstrings",
124124
"flake8-rst-docstrings",
@@ -133,7 +133,7 @@ def precommit(session: Session) -> None:
133133
activate_virtualenv_in_precommit_hooks(session)
134134

135135

136-
@session(python="3.10")
136+
@session(python=python_versions[0])
137137
def safety(session: Session) -> None:
138138
"""Scan dependencies for insecure packages."""
139139
requirements = session.poetry.export_requirements()
@@ -211,7 +211,7 @@ def docs_build(session: Session) -> None:
211211
session.run("sphinx-build", *args)
212212

213213

214-
@session(python="3.10")
214+
@session(python=python_versions[0])
215215
def docs(session: Session) -> None:
216216
"""Build and serve the documentation with live reloading on file changes."""
217217
args = session.posargs or ["--open-browser", "docs", "docs/_build"]

0 commit comments

Comments
 (0)