Skip to content
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

Implement flake8-raise #2347

Closed
2 of 3 tasks
ngnpope opened this issue Jan 30, 2023 · 2 comments · Fixed by #2354
Closed
2 of 3 tasks

Implement flake8-raise #2347

ngnpope opened this issue Jan 30, 2023 · 2 comments · Fixed by #2354
Labels
plugin Implementing a known but unsupported plugin

Comments

@ngnpope
Copy link
Contributor

ngnpope commented Jan 30, 2023

GitHub, PyPI.

  • R100: raise in except handler without from
    • Already implemented via B904 from flake8-bugbear
    • Already implemented via TRY200 from tryceratops
      • This is buggy and only triggers with raise Exception() and not raise Exception (no parentheses)
    • Maybe implementation for one of these should be scrapped with the error code aliased to the other? 🤔
  • R101: use bare raise in except handler
  • R102: unnecessary parentheses on raised exception

So this plugin is mostly implemented. R102 looks like it should be a relatively easy rule to define.

@charliermarsh charliermarsh added the plugin Implementing a known but unsupported plugin label Jan 30, 2023
@charliermarsh
Copy link
Member

Just confirming that in addition to adding R102, we should:

  1. Remove B904, and mark it as an alias of TRY200.
  2. Fix TRY200 to flag raise Exception (without parentheses).

@ngnpope
Copy link
Contributor Author

ngnpope commented Jan 30, 2023

Yeah, sounds good. I guess it makes sense to keep TRY200 over B904 as tryceratops is exception-focused and flake8-bugbear is a random collection of stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin Implementing a known but unsupported plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants