astral-sh / ruff

An extremely fast Python linter and code formatter, written in Rust.

Home Page:https://docs.astral.sh/ruff

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PLE0237 unaware of properties with setter

mal opened this issue · comments

Keywords: PLE0237, setter, property

class Foo:
    __slots__ = ('bar',)

    def __init__(self):
        self.qux = 2

    @property
    def qux(self):
        return self.bar * 2

    @qux.setter
    def qux(self, value):
        self.bar = value / 2
$ ruff --version
ruff 0.4.4
$ ruff check --isolated --extend-select PLE0237 .
foo.py:5:9: PLE0237 Attribute `qux` is not defined in class's `__slots__`
Found 1 error.

Thanks, looks like a bug.