-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Check for raise Exception or BaseException #7494
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
Comments
That would be |
Isn't |
Ha, right ! |
What should the linter name be here, |
I'm thinking that we could rename broad-except to broad-exception-caught and name this one broad-exception-raised. We need to use 'old-names' for that. |
That's a way to handle backward compat, right? Or since this is a breaking change would this only be released in pylint 3.x? Trying to understand where to put this PR to |
Yes, old names handle the backward compatibility so that it's not a breaking change. See C0111 /missing-docstring for example. |
Just curious since I've used this msg as an example. Should code using |
We could replace it by the three new names yes (not in tests because sometime we're testing that the old_names work for multiple new name with this message). |
Current problem
Linting a codebase with a lot of
raise Exception()
statements. This is a bad practice as it makes it impossible to write narrow exception clauses.Desired solution
Forgive me if I missed it, but as far as I can tell, a check doesn't currently exist. The check should fail when an instance of
Exception
orBaseException
is raised directly.The text was updated successfully, but these errors were encountered: