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

New check which find duplicate except clauses #254

Closed
kasium opened this issue Apr 13, 2022 · 3 comments · Fixed by #284
Closed

New check which find duplicate except clauses #254

kasium opened this issue Apr 13, 2022 · 3 comments · Fixed by #284

Comments

@kasium
Copy link
Contributor

kasium commented Apr 13, 2022

flake8-bugbear already find duplicate exeptions in the same tuple, but across different except's this is not done

Examples:

try:
    pass
except ValueError:
    pass
except ValueError:
    pass
try:
    pass
except (ValueError, TypeError):
    pass
except (ValueError, UnicodeError):
    pass

I'm happy tp contribute this check 😄

@cooperlees
Copy link
Collaborator

cooperlees commented Apr 14, 2022

I guess this is doable, so sure, would accept this. Should be easy to make not noisey.

Please add description to README and add unit tests for the new checks please for it to be accepted.

@kasium
Copy link
Contributor Author

kasium commented May 16, 2022

Thanks for your comment. Let me give it a try

kasium added a commit to kasium/flake8-bugbear that referenced this issue May 16, 2022
kasium added a commit to kasium/flake8-bugbear that referenced this issue Sep 10, 2022
cooperlees pushed a commit that referenced this issue Sep 11, 2022
* Add new check which finds duplicate except clauses

Closes #254

* Add sorting
@cooperlees
Copy link
Collaborator

Released in 22.9.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants