-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add ruff as default linting + formatting option #387
base: master
Are you sure you want to change the base?
Conversation
…oject.toml config and not command line args
I'm in favor of having the default to be Ruff. It's clear that Ruff is the emerging standard, and they describe themselves as production-ready. There are major projects that are fully using Ruff for linting and formatting. Lots of other major projects (e.g., pip, matplotlib, PyTorch) are using Ruff for linting over flake8, though are still using black for now. |
It seems that slight adjustments to the linter rules are necessary to ensure similar behavior as the flake8/black/isort alternative. Most of the rules that flake8 ignores in the If I am not wrong, these additional lines in [tool.ruff.lint]
ignore = [
"E731" # lambda-assignment: Do not assign a lambda expression, use a def
] Update: Additionally, the [tool.ruff.lint]
ignore = ["E731"] # Ignore lambda-assignment
extend-select = ["I"] # Add sorting imports (isort ruleset) to defaults |
…toml instead of specifying module in m akefile command
@szapp thanks for catching the isort fix! I've opted to keep the default selections in ruff for now - I don't know that we're necessarily aiming for exact parity with black, as opposed to just a good starting point for a project. |
Closes #374
Closes #388
This PR adds ruff as the default linting and formatting option for new ccds projects.
Implementation notes
pyproject.toml
and removedsetup.cfg
if using ruff since it's no longer needed.Discussion
As mentioned, this PR makes ruff the default option. I think there's good arguments for this that mostly boil down to "it's simpler + faster":
setup.cfg
file so everything can live inpyproject.toml
However, ruff is still (relatively) new, whereas flake8/black/isort is more mature, and most projects won't notice the speed difference until they get quite large. I could be persuaded that we should introduce ruff without making it the default option.