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

Respect operator precedence in FURB110 #11464

Merged
merged 1 commit into from
May 19, 2024
Merged

Respect operator precedence in FURB110 #11464

merged 1 commit into from
May 19, 2024

Conversation

charliermarsh
Copy link
Member

Summary

Ensures that we parenthesize expressions (if necessary) to preserve operator precedence in FURB110.

Closes #11398.

@charliermarsh charliermarsh added the bug Something isn't working label May 19, 2024
@charliermarsh charliermarsh enabled auto-merge (squash) May 19, 2024 03:15
@charliermarsh charliermarsh merged commit 48b0660 into main May 19, 2024
16 of 17 checks passed
@charliermarsh charliermarsh deleted the charlie/furb branch May 19, 2024 03:17
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check encountered linter errors. (no lint changes; 1 project error)

commaai/openpilot (error)

Failed to clone commaai/openpilot: fatal: active `post-checkout` hook found during `git clone`:
	/home/runner/work/ruff/ruff/checkouts/commaai:openpilot/.git/hooks/post-checkout
For security reasons, this is disallowed by default.
If this is intentional and the hook should actually be run, please
run the command again with `GIT_CLONE_PROTECTION_ACTIVE=false`
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

Linter (preview)

✅ ecosystem check detected no linter changes.

/// the parentheses are required.
///
/// See: <https://docs.python.org/3/reference/expressions.html#operator-precedence>
fn parenthesize_test<'a>(
Copy link
Member

Choose a reason for hiding this comment

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

Not specific to this PR but I think we should build out some infrastructure that given an Expr returns a comparable Precedence. This would allow updating the precedence once instead of in many places (generator, parser, here, other places?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FURB110 may break code
2 participants