-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Account for other property-like decorators as well
- Loading branch information
1 parent
ac94d4a
commit 20b13fd
Showing
3 changed files
with
69 additions
and
42 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
52 changes: 26 additions & 26 deletions
52
...s/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.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,42 +1,42 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_return/mod.rs | ||
--- | ||
RET501.py:7:5: RET501 [*] Do not explicitly `return None` in function if it is the only possible return value | ||
RET501.py:4:5: RET501 [*] Do not explicitly `return None` in function if it is the only possible return value | ||
| | ||
5 | if not y: | ||
6 | return | ||
7 | return None # error | ||
2 | if not y: | ||
3 | return | ||
4 | return None # error | ||
| ^^^^^^^^^^^ RET501 | ||
| | ||
= help: Remove explicit `return None` | ||
|
||
ℹ Safe fix | ||
4 4 | def x(y): | ||
5 5 | if not y: | ||
6 6 | return | ||
7 |- return None # error | ||
7 |+ return # error | ||
8 8 | | ||
9 9 | | ||
10 10 | class BaseCache: | ||
1 1 | def x(y): | ||
2 2 | if not y: | ||
3 3 | return | ||
4 |- return None # error | ||
4 |+ return # error | ||
5 5 | | ||
6 6 | | ||
7 7 | class BaseCache: | ||
|
||
RET501.py:17:9: RET501 [*] Do not explicitly `return None` in function if it is the only possible return value | ||
RET501.py:14:9: RET501 [*] Do not explicitly `return None` in function if it is the only possible return value | ||
| | ||
15 | def get(self, key: str) -> None: | ||
16 | print(f"{key} not found") | ||
17 | return None | ||
12 | def get(self, key: str) -> None: | ||
13 | print(f"{key} not found") | ||
14 | return None | ||
| ^^^^^^^^^^^ RET501 | ||
18 | | ||
19 | @property | ||
15 | | ||
16 | @property | ||
| | ||
= help: Remove explicit `return None` | ||
|
||
ℹ Safe fix | ||
14 14 | | ||
15 15 | def get(self, key: str) -> None: | ||
16 16 | print(f"{key} not found") | ||
17 |- return None | ||
17 |+ return | ||
18 18 | | ||
19 19 | @property | ||
20 20 | def prop(self) -> None: | ||
11 11 | | ||
12 12 | def get(self, key: str) -> None: | ||
13 13 | print(f"{key} not found") | ||
14 |- return None | ||
14 |+ return | ||
15 15 | | ||
16 16 | @property | ||
17 17 | def prop(self) -> None: |