Skip to content

STYLE: Add auto fix to ruff #51814

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

Closed
luke396 opened this issue Mar 7, 2023 · 5 comments · Fixed by #51894
Closed

STYLE: Add auto fix to ruff #51814

luke396 opened this issue Mar 7, 2023 · 5 comments · Fixed by #51894

Comments

@luke396
Copy link
Contributor

luke396 commented Mar 7, 2023

How about add fix/autofix ruff?

I recently worked on STYLE enable ruff TCH and found that ruff reports some error could (eg: Trailing whitespace, ) been easily autofixed, by adding --fix (or more specific flags) as argument to config.

I must admit that these errors can also be fixed manually. However, if the automation does not significantly slow down the process, why not let them be fixed automatically? It is worth noting that automatic fixes are still being developed and modified, and whether they should be used or not may require further discussion.

Some maybe related:
ruff-tried-to-fix-something-but-it-broke-my-code?
Usage - Ruff
Configuration - Ruff

@MarcoGorelli
Copy link
Member

sure, if there's a way to not auto-fix E721, I'm all for it

@twoertwein
Copy link
Member

ruff allows to black-list unfixable rules

unfixable = ["E721"]

@MarcoGorelli
Copy link
Member

awesome! is there anything ruff can't do? 😄

@luke396
Copy link
Contributor Author

luke396 commented Mar 8, 2023

I would like to try doing this, and if we decide to move forward with it ( may need some assistance...).

@MarcoGorelli
Copy link
Member

sure go ahead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants