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

Move to ruff for linting and formating? #534

Open
CompRhys opened this issue Jul 27, 2024 · 5 comments
Open

Move to ruff for linting and formating? #534

CompRhys opened this issue Jul 27, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@CompRhys
Copy link
Contributor

Adopt ruff as a linter and formatter for the codebase as a more modern and faster alternative to black+pylint.

@ilyes319
Copy link
Contributor

ilyes319 commented Aug 5, 2024

@CompRhys I know ruff is faster but is it less accurate than pylint? I had experiences where it was not as accurate.

@CompRhys
Copy link
Contributor Author

CompRhys commented Aug 5, 2024

It doesn't yet implement all the rules in pylint (astral-sh/ruff#970) but has more rules overall and the speed is a big plus.

FWIW even pylint now uses ruff to lint it's own codebase (https://github.com/pylint-dev/pylint/blob/47cb11f4cb01a61f83d915d88e828f103a479980/pyproject.toml)

@janosh
Copy link
Contributor

janosh commented Aug 5, 2024

fwiw, ruff has been running for months on pymatgen, atomate2, chgnet and others. it's been a great experience everywhere.

@stenczelt
Copy link
Contributor

Agreed, using ruff in professional codebases is very good as well, you can pick what you want to turn on from it, which we did gradually and alongside pylint, flake8, & isort running in the CI still.

black's formatter was kept alongside though, partly due to better integration with IDEs and because it's not "fixing" everything else it has opinions/rules about, but only reformats the code. So you can have black . and ruff check --fix as separate actions, having the former run on save of files.

@stenczelt
Copy link
Contributor

@CompRhys I know ruff is faster but is it less accurate than pylint? I had experiences where it was not as accurate.

You can get "inaccurate" behaviour from just turning it on on it's own and not turning on specific rules. I haven't dug deep into what differences there are in their rules and if ruff implements absolutely everything that pylint does.

@ilyes319 ilyes319 added the enhancement New feature or request label Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants