-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
B022: No arguments passed to contextlib.suppress (#231)
* B022: No arguments passed to contextlib.suppress * Update README.rst * Disclaimer note on rule scope
- Loading branch information
Showing
4 changed files
with
54 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,19 @@ | ||
""" | ||
Should emit: | ||
B022 - on lines 8 | ||
""" | ||
|
||
import contextlib | ||
|
||
with contextlib.suppress(): | ||
raise ValueError | ||
|
||
with contextlib.suppress(ValueError): | ||
raise ValueError | ||
|
||
exceptions_to_suppress = [] | ||
if True: | ||
exceptions_to_suppress.append(ValueError) | ||
|
||
with contextlib.suppress(*exceptions_to_suppress): | ||
raise ValueError |
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