Skip to content

CI/STYLE: Add auto-fix to ruff #51894

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

Merged
merged 5 commits into from
Mar 12, 2023

Conversation

luke396
Copy link
Contributor

@luke396 luke396 commented Mar 11, 2023

@luke396
Copy link
Contributor Author

luke396 commented Mar 11, 2023

It seems that ruff's fix are duplicates of some of our existing autofix. Maybe we need to make some choices between existing methods and ruff?

@MarcoGorelli
Copy link
Member

It seems that ruff's fix are duplicates of some of our existing autofix. Maybe we need to make some choices between existing methods and ruff?

I don't undertstand what you mean, sorry, could you clarify please?

You'll also need to add exit-non-zero-on-fix (check the ruff docs for the exact name, it's something like that)

@luke396
Copy link
Contributor Author

luke396 commented Mar 12, 2023

I don't undertstand what you mean, sorry, could you clarify please?

You'll also need to add exit-non-zero-on-fix (check the ruff docs for the exact name, it's something like that)

I have noticed that some of the rules that ruff automatically fixes may be duplicates of the rules we have already added to the main branch. However, this is just an intuitive observation, and I have not confirmed it further.
(It is very likely that my intuition was wrong because I did not specifically compare what both would fix automatically)

And --exit-non-zero-on-fix has added.

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

thanks @luke396

pyproject.toml Outdated
@@ -197,6 +197,8 @@ exclude = '''
line-length = 88
update-check = false
target-version = "py38"
fix-only = true
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fix-only = true
fix = true

@MarcoGorelli MarcoGorelli added this to the 2.1 milestone Mar 12, 2023
@MarcoGorelli MarcoGorelli added the Code Style Code style, linting, code_checks label Mar 12, 2023
@MarcoGorelli MarcoGorelli merged commit 6169cba into pandas-dev:main Mar 12, 2023
@luke396 luke396 deleted the add-autofix-to-ruff branch March 12, 2023 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

STYLE: Add auto fix to ruff
2 participants