-
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.
Supported starred exceptions in length-one tuple detection (#7080)
- Loading branch information
1 parent
b70dde4
commit b0d171a
Showing
4 changed files
with
49 additions
and
17 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
41 changes: 30 additions & 11 deletions
41
.../src/rules/flake8_bugbear/snapshots/ruff__rules__flake8_bugbear__tests__B013_B013.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,24 +1,43 @@ | ||
--- | ||
source: crates/ruff/src/rules/flake8_bugbear/mod.rs | ||
--- | ||
B013.py:3:8: B013 [*] A length-one tuple literal is redundant. Write `except ValueError` instead of `except (ValueError,)`. | ||
B013.py:5:8: B013 [*] A length-one tuple literal is redundant in exception handlers | ||
| | ||
1 | try: | ||
2 | pass | ||
3 | except (ValueError,): | ||
| ^^^^^^^^^^^^^ B013 | ||
3 | try: | ||
4 | pass | ||
5 | except AttributeError: | ||
5 | except (ValueError,): | ||
| ^^^^^^^^^^^^^ B013 | ||
6 | pass | ||
7 | except AttributeError: | ||
| | ||
= help: Replace with `except ValueError` | ||
|
||
ℹ Fix | ||
1 1 | try: | ||
2 2 | pass | ||
3 |-except (ValueError,): | ||
3 |+except ValueError: | ||
2 2 | | ||
3 3 | try: | ||
4 4 | pass | ||
5 5 | except AttributeError: | ||
5 |-except (ValueError,): | ||
5 |+except ValueError: | ||
6 6 | pass | ||
7 7 | except AttributeError: | ||
8 8 | pass | ||
|
||
B013.py:11:8: B013 [*] A length-one tuple literal is redundant in exception handlers | ||
| | ||
9 | except (ImportError, TypeError): | ||
10 | pass | ||
11 | except (*retriable_exceptions,): | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ B013 | ||
12 | pass | ||
| | ||
= help: Replace with `except retriable_exceptions` | ||
|
||
ℹ Fix | ||
8 8 | pass | ||
9 9 | except (ImportError, TypeError): | ||
10 10 | pass | ||
11 |-except (*retriable_exceptions,): | ||
11 |+except retriable_exceptions: | ||
12 12 | pass | ||
|
||
|
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