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

Add new check which finds duplicate except clauses #258

Closed
wants to merge 1 commit into from

Conversation

kasium
Copy link
Contributor

@kasium kasium commented May 16, 2022

Closes #254

@kasium
Copy link
Contributor Author

kasium commented May 16, 2022

@cooperlees I just realized that B014 does partially the same job. The difference is, that it doesn't consider multiple except clauses. I would suggest to tune B014 to also consider multiple except's. This would mean that the error message would change. Is that fine?

@cooperlees
Copy link
Collaborator

I think since B014 looks for duplication per exception clause I'm a fan of the more explicit error message of the new B023 stating that it's a redundant clause in a new except. Let me take a look at the wording to ensure this is explicit as it can be.

Thanks for asking.

Copy link
Collaborator

@cooperlees cooperlees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - but tests show we've hit B014 being triggered at the same time. I feel this would be annoying for users. So I feel we either extend B014 or if B023 is hit, clear B014?

  • OR, do people like the two explicit errors?

I personally think getting the two lints, since they are so similar annoying - So maybe combining would be preferential?

Also, some minor suggestions in the error output + README.

README.rst Show resolved Hide resolved
bugbear.py Show resolved Hide resolved
bugbear.py Show resolved Hide resolved
@kasium
Copy link
Contributor Author

kasium commented Sep 10, 2022

I'm very sorry for the late pickup. Since this is heavily outdated, let me open a new PR

@kasium kasium closed this Sep 10, 2022
@kasium kasium deleted the issue-254 branch September 10, 2022 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New check which find duplicate except clauses
2 participants