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

Tweak E712 docs #8613

Merged
merged 2 commits into from
Mar 6, 2024
Merged

Tweak E712 docs #8613

merged 2 commits into from
Mar 6, 2024

Conversation

tjkuson
Copy link
Contributor

@tjkuson tjkuson commented Nov 11, 2023

Recommends if predicate: over if predicate is True: in the rule message.

Closes #8164.

@tjkuson tjkuson marked this pull request as ready for review November 11, 2023 09:32
Copy link
Contributor

github-actions bot commented Nov 11, 2023

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@charliermarsh charliermarsh added the documentation Improvements or additions to documentation label Nov 12, 2023
Copy link
Member

@AlexWaygood AlexWaygood 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 I think you'll need to update the snapshots!

Recommend `if predicate:` over `if predicate is True:` in the
diagnostic message.
|
1 | #: E712
2 | if res == True:
| ^^^^ E712
3 | pass
4 | #: E712
|
= help: Replace with `cond is True`
= help: Replace with `cond`
Copy link
Member

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>
Copy link
Member

@AlexWaygood AlexWaygood left a 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!

@AlexWaygood AlexWaygood enabled auto-merge (squash) March 6, 2024 17:48
@AlexWaygood AlexWaygood merged commit f999b1b into astral-sh:main Mar 6, 2024
17 checks passed
@tjkuson
Copy link
Contributor Author

tjkuson commented Mar 6, 2024

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.

@tjkuson tjkuson deleted the e712-doc-tweak branch March 6, 2024 17:55
nkxxll pushed a commit to nkxxll/ruff that referenced this pull request Mar 10, 2024
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve message for 'true-false-comparison' (E712)
3 participants