-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
It's probably a quite common case to use a custom logging.Filter, either to add context to log records or to decide if a given Record is to be logged (cf. Python documentation).
However, Ruff currently considers it breaks the A003 rule:
Class attribute `filter` is shadowing a Python builtinRuff [A003](https://beta.ruff.rs/docs/rules/builtin-attribute-shadowing)
This issue seems to be somewhat related to #5956 and I'm aware that it's probably low-priority.
Here's a minimal reproducible example of the problem:
from logging import Filter, LogRecord
class CustomFilter(Filter):
def filter(self, record: LogRecord) -> bool: # noqa: A003 is required here
return super().filter(self, record)
I'm using ruff 0.0.280.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels