PyCQA / flake8-bugbear

A plugin for Flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle.
MIT License
1.05k stars 103 forks source link

B026 False negative on class methods #417

Closed Klim314 closed 8 months ago

Klim314 commented 8 months ago

Summary

B026 does not apply to class methods, only to functions

Version

Replicated on version 23.9.16

Sample code

def foo(a, b, c):
    pass
foo(a=1, b=2, c=3, *[1])  # linting error here

class Bar:
    def foo(self, a, b, c):
        pass

Bar().foo(a=1, b=2, c=3, *[1])  # no linting error
JelleZijlstra commented 8 months ago

Good catch. This is likely fixable by unindenting https://github.com/PyCQA/flake8-bugbear/blob/78d08a741fc5053d2571a85f27e18f4625c1c269/bugbear.py#L443 by one level (plus adding some tests).