[flake8-bugbear] Add checks from flake8 bugbear

This commit is contained in:
Pierre Sassoulas 2024-02-04 11:24:47 +01:00
parent e28f35c296
commit 7eef4619d5
1 changed files with 16 additions and 0 deletions

View File

@ -128,6 +128,7 @@ ignore = "W009"
src = ["src"] src = ["src"]
line-length = 88 line-length = 88
select = [ select = [
"B", # bugbear
"D", # pydocstyle "D", # pydocstyle
"E", # pycodestyle "E", # pycodestyle
"F", # pyflakes "F", # pyflakes
@ -137,6 +138,20 @@ select = [
"W", # pycodestyle "W", # pycodestyle
] ]
ignore = [ ignore = [
# bugbear ignore
"B004", # Using `hasattr(x, "__call__")` to test if x is callable is unreliable.
"B005", # Using `.strip()` with multi-character strings is misleading
"B006", # Do not use mutable data structures for argument defaults
"B007", # Loop control variable `i` not used within loop body
"B009", # Do not call `getattr` with a constant attribute value
"B010", # [*] Do not call `setattr` with a constant attribute value.
"B011", # Do not `assert False` (`python -O` removes these calls)
"B015", # Pointless comparison. Did you mean to assign a value?
"B017", # `pytest.raises(Exception)` should be considered evil
"B018", # Found useless expression.
"B023", # Function definition does not bind loop variable `warning`
"B028", # No explicit `stacklevel` keyword argument found
"B904", # Within an `except` clause, raise exceptions with `raise ... from err`
# pycodestyle ignore # pycodestyle ignore
# pytest can do weird low-level things, and we usually know # pytest can do weird low-level things, and we usually know
# what we're doing when we use type(..) is ... # what we're doing when we use type(..) is ...
@ -181,3 +196,4 @@ lines-after-imports = 2
[tool.ruff.lint.per-file-ignores] [tool.ruff.lint.per-file-ignores]
"src/_pytest/_version.py" = ["I001"] "src/_pytest/_version.py" = ["I001"]
"src/_pytest/_py/**/*.py" = ["B", "PYI"]