Skip to content

Commit a85bf40

Browse files
committed
enable flake8-bandit and apply
1 parent 449f657 commit a85bf40

File tree

2 files changed

+5
-28
lines changed

2 files changed

+5
-28
lines changed

pyproject.toml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,47 +14,26 @@ lint.select = [
1414
"W", # see: https://pypi.org/project/pycodestyle
1515
"F", # see: https://pypi.org/project/pyflakes
1616
"I", #see: https://pypi.org/project/isort/
17+
"S", # see: https://pypi.org/project/flake8-bandit
1718
# "D", # see: https://pypi.org/project/pydocstyle
1819
# "N", # see: https://pypi.org/project/pep8-naming
19-
# "S", # see: https://pypi.org/project/flake8-bandit
2020
]
2121
#lint.extend-select = [
2222
# "A", # see: https://pypi.org/project/flake8-builtins
2323
# "B", # see: https://pypi.org/project/flake8-bugbear
2424
# "C4", # see: https://pypi.org/project/flake8-comprehensions
2525
# "PT", # see: https://pypi.org/project/flake8-pytest-style
2626
# "RET", # see: https://pypi.org/project/flake8-return
27-
# "SIM", # see: https://pypi.org/project/flake8-simplify
28-
# "YTT", # see: https://pypi.org/project/flake8-2020
2927
# "ANN", # see: https://pypi.org/project/flake8-annotations
30-
# "TID", # see: https://pypi.org/project/flake8-tidy-imports/
31-
# "T10", # see: https://pypi.org/project/flake8-debugger
32-
# "Q", # see: https://pypi.org/project/flake8-quotes
33-
# "RUF", # Ruff-specific rules
34-
# "EXE", # see: https://pypi.org/project/flake8-executable
35-
# "ISC", # see: https://pypi.org/project/flake8-implicit-str-concat
36-
# "PIE", # see: https://pypi.org/project/flake8-pie
37-
# "PLE", # see: https://pypi.org/project/pylint/
38-
# "PERF", # see: https://pypi.org/project/perflint/
39-
# "PYI", # see: https://pypi.org/project/flake8-pyi/
4028
#]
4129
#lint.ignore = [
4230
# "E731", # Do not assign a lambda expression, use a def
43-
# "D100", # todo: Missing docstring in public module
44-
# "D104", # todo: Missing docstring in public package
45-
# "D107", # Missing docstring in `__init__`
46-
# "ANN101", # Missing type annotation for `self` in method
47-
# "S301", # todo: `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue # todo
48-
# "S310", # todo: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. # todo
49-
# "B905", # todo: `zip()` without an explicit `strict=` parameter
5031
#]
5132
lint.ignore-init-module-imports = true
5233
lint.unfixable = ["F401"]
5334

54-
#[tool.ruff.lint.per-file-ignores]
55-
#"setup.py" = ["ANN202", "ANN401"]
56-
#"src/**" = ["ANN401"]
57-
#"tests/**" = ["S101", "ANN001", "ANN201", "ANN202", "ANN401"]
35+
[tool.ruff.lint.per-file-ignores]
36+
"test_*.py" = ["S101", "S311"]
5837

5938
[tool.ruff.lint.pydocstyle]
6039
# Use Google-style docstrings.

pytest_rerunfailures.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def evaluate_condition(item, mark, condition: object) -> bool:
188188
try:
189189
filename = f"<{mark.name} condition>"
190190
condition_code = compile(condition, filename, "eval")
191-
result = eval(condition_code, globals_)
191+
result = eval(condition_code, globals_) # noqa: S307
192192
except SyntaxError as exc:
193193
msglines = [
194194
"Error evaluating %r condition" % mark.name,
@@ -365,9 +365,7 @@ def __init__(self):
365365

366366
def _hash(self, crashitem: str) -> str:
367367
if crashitem not in self.hmap:
368-
self.hmap[crashitem] = hashlib.sha1(
369-
crashitem.encode(),
370-
).hexdigest()[:10]
368+
self.hmap[crashitem] = hashlib.sha1(crashitem.encode()).hexdigest()[:10] # noqa: S324
371369

372370
return self.hmap[crashitem]
373371

0 commit comments

Comments
 (0)