From 907e0dd29a99818591a604d4557c70ea33204712 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 2 Nov 2023 20:27:08 -0700 Subject: [PATCH] Fix B026 on attributes (#420) --- README.rst | 6 ++++++ bugbear.py | 3 +-- tests/b026.py | 1 + tests/test_bugbear.py | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 5e47273..b0ddfa7 100644 --- a/README.rst +++ b/README.rst @@ -338,6 +338,12 @@ MIT Change Log ---------- +Unreleased +~~~~~~~~~~ + +* B026: Fix bug where the check was not triggered for calls where the callee + is an attribute + 23.9.16 ~~~~~~~ diff --git a/bugbear.py b/bugbear.py index 9f4b1af..5fbfa19 100644 --- a/bugbear.py +++ b/bugbear.py @@ -440,8 +440,7 @@ def visit_Call(self, node): ): self.errors.append(B010(node.lineno, node.col_offset)) - self.check_for_b026(node) - + self.check_for_b026(node) self.check_for_b028(node) self.check_for_b034(node) self.check_for_b905(node) diff --git a/tests/b026.py b/tests/b026.py index fb8b1dd..a4b7f8f 100644 --- a/tests/b026.py +++ b/tests/b026.py @@ -18,3 +18,4 @@ def foo(bar, baz, bam): foo(bar="bar", baz="baz", bam="bam", *[]) foo(bam="bam", *["bar"], *["baz"]) foo(*["bar"], bam="bam", *["baz"]) +foo.bar(bam="bam", *["bar"]) diff --git a/tests/test_bugbear.py b/tests/test_bugbear.py index c71ff17..49377b4 100644 --- a/tests/test_bugbear.py +++ b/tests/test_bugbear.py @@ -415,6 +415,7 @@ def test_b026(self): B026(19, 15), B026(19, 25), B026(20, 25), + B026(21, 19), ), )