-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid recommending
__slots__
for classes that inherit from more tha…
- Loading branch information
1 parent
998bfe0
commit 1fe4a5f
Showing
3 changed files
with
50 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 20 additions & 6 deletions
26
...s/flake8_slots/snapshots/ruff_linter__rules__flake8_slots__tests__SLOT002_SLOT002.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,30 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_slots/mod.rs | ||
--- | ||
SLOT002.py:5:7: SLOT002 Subclasses of `collections.namedtuple()` should define `__slots__` | ||
SLOT002.py:6:7: SLOT002 Subclasses of `collections.namedtuple()` should define `__slots__` | ||
| | ||
5 | class Bad(namedtuple("foo", ["str", "int"])): # SLOT002 | ||
6 | class Bad(namedtuple("foo", ["str", "int"])): # SLOT002 | ||
| ^^^ SLOT002 | ||
6 | pass | ||
7 | pass | ||
| | ||
|
||
SLOT002.py:9:7: SLOT002 Subclasses of call-based `typing.NamedTuple()` should define `__slots__` | ||
SLOT002.py:10:7: SLOT002 Subclasses of call-based `typing.NamedTuple()` should define `__slots__` | ||
| | ||
9 | class UnusualButStillBad(NamedTuple("foo", [("x", int, "y", int)])): # SLOT002 | ||
10 | class UnusualButStillBad(NamedTuple("foo", [("x", int, "y", int)])): # SLOT002 | ||
| ^^^^^^^^^^^^^^^^^^ SLOT002 | ||
10 | pass | ||
11 | pass | ||
| | ||
|
||
SLOT002.py:30:7: SLOT002 Subclasses of `collections.namedtuple()` should define `__slots__` | ||
| | ||
30 | class UnusualButStillBad(namedtuple("foo", ["str", "int"]), NamedTuple("foo", [("x", int, "y", int)])): | ||
| ^^^^^^^^^^^^^^^^^^ SLOT002 | ||
31 | pass | ||
| | ||
|
||
SLOT002.py:34:7: SLOT002 Subclasses of `collections.namedtuple()` should define `__slots__` | ||
| | ||
34 | class UnusualButStillBad(namedtuple("foo", ["str", "int"]), object): | ||
| ^^^^^^^^^^^^^^^^^^ SLOT002 | ||
35 | pass | ||
| |