What do you think about the following edge case? I believe this should not be reported, since Enum members are typically low cardinality and are not garbage collected anyway.
# test.py
import enum
import functools
class Foo(enum.Enum):
ONE = enum.auto()
TWO = enum.auto()
@functools.cache
def bar(self, arg: str) -> str:
return f"{self} - {arg}"
$ ruff --version
ruff 0.2.1
$ ruff check --isolated --select B test.py
test.py:9:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
Found 1 error.