-
-
Notifications
You must be signed in to change notification settings - Fork 15
add Github Action for ruff formatting #47
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
Conversation
|
I am marking this as a draft until all outstanding PRs have been merged to avoid unnecessary merge conflicts. |
|
I did actually move to use ruff in my other projects. Let's do that if you don't mind. |
|
Could you please consider adding to pyproject.toml: [tool.black]
skip-string-normalization = trueto help prevent excessive changes? |
@ido50 I replaced black with ruff and did a tree-wide formatting using ruff. |
|
Could you please consider adding to pyproject.toml: [tool.ruff.format]
quote-style = "preserve"to help prevent excessive changes? |
The difference is ~30 changed lines. I wouldn't call that excessive and it really impairs readability and long-term maintainability if you do not have a unified code style. |
This is a basic CI for checking formatting with black, together with a dependabot configuration to keep it updated.
I will try to expand it using ruff or pylint or flake8 in the coming days.
Line length of 80 vs 88
I removed the line-length of 80 from the pyproject.toml, as it reduced the changes down to 60% (182 vs 117 inserts):
With a line-length of 80:
With black's default (=88):
Ruff instead of Black
Alternatively, we can also use ruff for formatting. It includes auto-formatting of includes which is usually very nice.
In the code that is formatted with both black and ruff, it is usually compatible with black. This code base would only have this difference:
I'm happy to change this PR to ruff if you prefer.