-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new check which finds duplicate except clauses (#284)
* Add new check which finds duplicate except clauses Closes #254 * Add sorting
- Loading branch information
Showing
4 changed files
with
82 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
""" | ||
Should emit: | ||
B025 - on lines 15, 22, 31 | ||
""" | ||
|
||
import pickle | ||
|
||
try: | ||
a = 1 | ||
except ValueError: | ||
a = 2 | ||
finally: | ||
a = 3 | ||
|
||
try: | ||
a = 1 | ||
except ValueError: | ||
a = 2 | ||
except ValueError: | ||
a = 2 | ||
|
||
try: | ||
a = 1 | ||
except pickle.PickleError: | ||
a = 2 | ||
except ValueError: | ||
a = 2 | ||
except pickle.PickleError: | ||
a = 2 | ||
|
||
try: | ||
a = 1 | ||
except (ValueError, TypeError): | ||
a = 2 | ||
except ValueError: | ||
a = 2 | ||
except (OSError, TypeError): | ||
a = 2 |
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