unsorted-dunder-slots
What it does
Section titled “What it does”Reports a __slots__ list or tuple of strings that is not in natural order.
Why it matters
Section titled “Why it matters”A sorted list is easy to scan for a name, a merge does not put the same name in twice, and an added name has one obvious place.
To fix, sort the list.
Example
Section titled “Example”...
... __slots__ = ("b", "a")
...Configuration
Section titled “Configuration”python: lint: rules: unsorted-dunder-slots: warn # off (default), warn, errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line unsorted-dunder-slots in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| ruff | RUF023 |
full |