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

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

Merged
merged 2 commits into from
Jan 21, 2025
Merged

Conversation

kiran-4444
Copy link
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.
Copy link
Contributor

github-actions bot commented Jan 20, 2025

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
Member

@ntBre would you mind reviewing this one?

Copy link
Contributor

@ntBre ntBre left a 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.

Copy link
Contributor

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

@ntBre ntBre merged commit cff9c13 into astral-sh:main Jan 21, 2025
21 checks passed
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