Keywords: extend-immutable-calls, B008, script, module, __main__
Ruff version: 0.3.7
Working MWE
In a directory containing just the file test.py:
from other_module import A
def f(a=A()):
pass
checking with:
ruff check --isolated --select=B008 \
--config 'lint.flake8-bugbear.extend-immutable-calls=["other_module.A"]' \
test.py
yields no errors.
Buggy MWE
If I declare A in the script instead of importing it:
class A: pass
def f(a=A()):
pass
now ruff will find a B008 error in the def line, no matter what I configure in extend-immutable-calls. I tried A, test.A, __main__.A, and even builtins.A and __builtins__.A. Nothing makes it recognize A() as an immutable call.