ACEsuit / mace

MACE - Fast and accurate machine learning interatomic potentials with higher order equivariant message passing.
Other
481 stars 181 forks source link

Move to ruff for linting and formating? #534

Open CompRhys opened 1 month ago

CompRhys commented 1 month ago

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

ilyes319 commented 1 month ago

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

CompRhys commented 1 month ago

It doesn't yet implement all the rules in pylint (https://github.com/astral-sh/ruff/issues/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 commented 1 month ago

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

stenczelt commented 2 weeks ago

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 commented 2 weeks ago

@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.