-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[new rule] pylint W0133: Exception statement has no effect #10145
Labels
rule
Implementing or modifying a lint rule
Comments
I could take a look at this. Let’s see, if this can be reasonably extended to the B018. Otherwise, this may require a separate rule? |
If you ask me then I do not not have any preferences, so it could be either separate rule something like |
charliermarsh
pushed a commit
that referenced
this issue
Mar 1, 2024
## Summary This review contains a new rule for handling `useless exception statements` (`PLW0133`). Is it based on the following pylint's rule: [W0133](https://pylint.readthedocs.io/en/latest/user_guide/messages/warning/pointless-exception-statement.html) Note: this rule does not cover the case if an error is a custom exception class. See: [Rule request](#10145) ## Test Plan ```bash cargo test & manually ```
nkxxll
pushed a commit
to nkxxll/ruff
that referenced
this issue
Mar 10, 2024
…sh#10176) ## Summary This review contains a new rule for handling `useless exception statements` (`PLW0133`). Is it based on the following pylint's rule: [W0133](https://pylint.readthedocs.io/en/latest/user_guide/messages/warning/pointless-exception-statement.html) Note: this rule does not cover the case if an error is a custom exception class. See: [Rule request](astral-sh#10145) ## Test Plan ```bash cargo test & manually ```
Done in #10176 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This rule already requested into the #8674, however suggested replacement
B018
can not handle all the cases.For example this snippet do not violate any of
B018
checks: https://play.ruff.rs/bef7e65b-09c6-4e8f-84e9-48a75be4e0b9In the other hand
pylint
ruleW0133
catch all useless exceptions and warningsIt would be nice if it possible to have this rule as part of the
ruff
, this might help to found such a mistakes in codebase of pretty big projects.The text was updated successfully, but these errors were encountered: