-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Tweak E712
docs
#8613
Tweak E712
docs
#8613
Conversation
|
crates/ruff_linter/src/rules/pycodestyle/rules/literal_comparisons.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but I think you'll need to update the snapshots!
Recommend `if predicate:` over `if predicate is True:` in the diagnostic message.
crates/ruff_linter/src/rules/pycodestyle/rules/literal_comparisons.rs
Outdated
Show resolved
Hide resolved
| | ||
1 | #: E712 | ||
2 | if res == True: | ||
| ^^^^ E712 | ||
3 | pass | ||
4 | #: E712 | ||
| | ||
= help: Replace with `cond is True` | ||
= help: Replace with `cond` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possibly outside the scope of this PR (you can leave it for now, if you like), but this suggestion is pretty confusing. There's no variable named "cond" in scope here, and I don't think it's obvious that this means "replace if res == True
with if res
", especially when the carets only point to True
rather than res == True
.
…sons.rs Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! A followup PR to address https://github.com/astral-sh/ruff/pull/8613/files#r1514915070 would be very welcome, if you're up to it!
Sure! I'll give it go. |
Recommends
if predicate:
overif predicate is True:
in the rule message.Closes #8164.