Skip to content

feat: Update RUF055 to do var == value - #15605

Merged
ntBre merged 2 commits into
astral-sh:mainfrom
kiran-4444:ruf055-fix
Jan 21, 2025
Merged

feat: Update RUF055 to do var == value#15605
ntBre merged 2 commits into
astral-sh:mainfrom
kiran-4444:ruf055-fix

Conversation

@kiran-4444

Copy link
Copy Markdown
Contributor

This commit fixes RUF055 rule to format re.fullmatch(pattern, var) to var == pattern instead of the current pattern == 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 to var == pattern instead of pattern == var.

Test Plan

I used a code file locally to see the updated formatting behaviour.

Fixes #14733

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.
@github-actions

github-actions Bot commented Jan 20, 2025

Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser
MichaReiser requested a review from ntBre January 20, 2025 09:47
@MichaReiser MichaReiser added the fixes Related to suggested fixes for violations label Jan 20, 2025
@MichaReiser

Copy link
Copy Markdown
Member

@ntBre would you mind reviewing this one?

@ntBre ntBre left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread crates/ruff_linter/src/rules/ruff/rules/unnecessary_regular_expression.rs Outdated
Comment thread crates/ruff_linter/src/rules/ruff/rules/unnecessary_regular_expression.rs Outdated

@ntBre ntBre left a comment

Copy link
Copy Markdown
Contributor

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!

@ntBre
ntBre merged commit cff9c13 into astral-sh:main Jan 21, 2025
dcreager added a commit that referenced this pull request Jan 21, 2025
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fixes Related to suggested fixes for violations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update unncessary-regular-expression (RUF055) fix to use var == value

3 participants