diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index df0b72a..e0ee61e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,12 +3,12 @@ ci: repos: - repo: https://github.com/pycqa/isort - rev: 5.10.1 + rev: 5.11.1 hooks: - id: isort - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 22.12.0 hooks: - id: black args: diff --git a/bugbear.py b/bugbear.py index 2bc12c9..82749e3 100644 --- a/bugbear.py +++ b/bugbear.py @@ -168,8 +168,10 @@ def should_warn(self, code): return True LOG.info( - "Optional warning %s not present in selected warnings: %r. Not " - "firing it at all.", + ( + "Optional warning %s not present in selected warnings: %r. Not " + "firing it at all." + ), code, self.options.select, ) diff --git a/tests/b023.py b/tests/b023.py index 61d3c10..35a1e5b 100644 --- a/tests/b023.py +++ b/tests/b023.py @@ -155,6 +155,7 @@ def myfunc(x): sorted(functools.reduce(lambda y: x | y, range(3))) frozenset(functools.reduce(lambda y: x | y, range(3))) + # OK because the lambda which references a loop variable is defined in a `return` # statement, and after we return the loop variable can't be redefined. # In principle we could do something fancy with `break`, but it's not worth it. diff --git a/tests/b906.py b/tests/b906.py index a4bf0d1..35cfe42 100644 --- a/tests/b906.py +++ b/tests/b906.py @@ -4,6 +4,7 @@ # which has subfields, and contains no call to a method name containing `visit` # anywhere in it's body + # error def visit_For(): ... diff --git a/tests/test_bugbear.py b/tests/test_bugbear.py index 0c40efa..58931f6 100644 --- a/tests/test_bugbear.py +++ b/tests/test_bugbear.py @@ -307,7 +307,7 @@ def test_b019(self): def test_b020(self): filename = Path(__file__).absolute().parent / "b020.py" bbc = BugBearChecker(filename=str(filename)) - errors = list(e for e in bbc.run() if e[2][:4] == "B020") + errors = [e for e in bbc.run() if e[2][:4] == "B020"] self.assertEqual( errors, self.errors( @@ -366,8 +366,8 @@ def test_b023(self): B023(115, 36, vars=("x",)), B023(116, 37, vars=("x",)), B023(117, 36, vars=("x",)), - B023(167, 28, vars=("name",)), # known false alarm - B023(170, 28, vars=("i",)), + B023(168, 28, vars=("name",)), # known false alarm + B023(171, 28, vars=("i",)), ) self.assertEqual(errors, expected) @@ -515,7 +515,7 @@ def test_b906(self): bbc = BugBearChecker(filename=str(filename)) errors = list(bbc.run()) expected = [ - B906(8, 0), + B906(9, 0), ] self.assertEqual(errors, self.errors(*expected))