-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: Update RUF055 to do var == value #15605
Conversation
This commit fixes RUF055 rule to format re.fullmatch(pattern, var) to var == pattern instead of current pattern == var behaviour. This is more idiomatic and easy to understand.
|
@ntBre would you mind reviewing this one? |
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.
This looks great, thanks for fixing this! I had a couple of small suggestions, but otherwise this looks good to me.
crates/ruff_linter/src/rules/ruff/rules/unnecessary_regular_expression.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/ruff/rules/unnecessary_regular_expression.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.
This looks great, thank you again!
* main: Separate grouped and ungrouped nodes more clearly in AST generator (#15646) [`flake8-simplify`] Mark fixes as unsafe (`SIM201`, `SIM202`) (#15626) [red-knot] mdtest runner: include stderr for crashing tests (#15644) Change `EnvironmentOptions::venv-path` to `Option<SystemPathBuf>` (#15631) [`flake8-type-checking`] Fix some safe fixes being labeled unsafe (#15638) feat: Update RUF055 to do var == value (#15605)
This commit fixes RUF055 rule to format
re.fullmatch(pattern, var)
tovar == pattern
instead of the currentpattern == var
behaviour. This is more idiomatic and easy to understand.Summary
This changes the current formatting behaviour of
re.fullmatch(pattern, var)
to format it tovar == pattern
instead ofpattern == var
.Test Plan
I used a code file locally to see the updated formatting behaviour.
Fixes #14733