From 83e6807d02c4f86f5625a28998441cbf571988bc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 14 Dec 2022 22:24:43 -0800 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#322) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pycqa/isort: 5.10.1 → 5.11.1](https://github.com/pycqa/isort/compare/5.10.1...5.11.1) - [github.com/psf/black: 22.10.0 → 22.12.0](https://github.com/psf/black/compare/22.10.0...22.12.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix error line nunbers (due to new formatting) and swap generator with direct list comprehencion due to C400 lint Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Cooper Lees --- .pre-commit-config.yaml | 4 ++-- bugbear.py | 6 ++++-- tests/b023.py | 1 + tests/b906.py | 1 + tests/test_bugbear.py | 8 ++++---- 5 files changed, 12 insertions(+), 8 deletions(-) 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))