ruff
5f63b8bf - Ignore some common builtin overrides on standard library subclasses (#6074)

Comment changes are shownComment changes are hidden
Commit
1 year ago
Ignore some common builtin overrides on standard library subclasses (#6074) ## Summary If a user subclasses `threading.Event`, e.g. with: ```python from threading import Event class CustomEvent(Event): def set(self) -> None: ... ``` They no control over the method name (`set`). This PR allows `threading.Event#set` and `logging.Filter#filter` overrides, and avoids flagging A003 in such cases. Ideally, we'd avoid flagging all overridden methods, but... that's a lot more difficult, and this is at least _better_ than what we do now. Closes https://github.com/astral-sh/ruff/issues/6057. Closes https://github.com/astral-sh/ruff/issues/5956.
Author
Parents
  • crates/ruff
    • resources/test/fixtures/flake8_builtins
      • File
        A003.py
    • src/rules/flake8_builtins
      • rules
        • File
          builtin_attribute_shadowing.rs
      • snapshots
        • ruff__rules__flake8_builtins__tests__A003_A003.py.snap
        • ruff__rules__flake8_builtins__tests__A003_A003.py_builtins_ignorelist.snap