-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
good first issueGood for newcomersGood for newcomersruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
Bad code:
# case 1
try:
do_thing()
except Exception:
raise# case 2
try:
do_thing()
except:
raise# case 3
try:
do_thing()
except SomeKindOfException:
raiseFix:
remove the try/except, as it has no effect.
do_thing()In cases 1&2, all exceptions are raised immediately, and in case 3 only a subset of exceptions is caught, then reraised immediately.
Notes:
- This shouldn't run if there's any other code in the
exceptblock. - If there are multiple excpt cases, empty ones (with only
raise) should be removed, and others should remain.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomersruleImplementing or modifying a lint ruleImplementing or modifying a lint rule