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

Make bugbear slightly more polite #298

Merged
merged 2 commits into from
Oct 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions bugbear.py
Original file line number Diff line number Diff line change
Expand Up @@ -1192,8 +1192,8 @@ def visit_Lambda(self, node):
}
B015 = Error(
message=(
"B015 Pointless comparison. This comparison does nothing but waste "
"CPU instructions. Either prepend `assert` or remove it."
Copy link
Collaborator

@cooperlees cooperlees Oct 17, 2022

Choose a reason for hiding this comment

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

I personally feel the blunt nature of the message makes it clearer of what the check looks for.
The new message will make people think into it more and possibly over complicate their actions. But open to others thoughts …

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I definitely see the tradeoff here, and agree that the cause of the error should be the first thing the user sees. The aim with the change of wording was to retain that, while softening the order to a suggestion.

"B015 Result of comparison is not used. This line doesn't do"
"anything. Did you intend to prepend it with assert?"
)
)
B016 = Error(
Expand All @@ -1213,7 +1213,8 @@ def visit_Lambda(self, node):
)
B018 = Error(
message=(
"B018 Found useless expression. Either assign it to a variable or remove it."
"B018 Found useless expression. Consider either assigning it to a "
"variable or removing it."
)
)
B019 = Error(
Expand Down