microsoft / MLOS

MLOS is a project to enable autotuning for systems.
https://microsoft.github.io/MLOS
MIT License
136 stars 64 forks source link

Consider replacing various linters/formatters with `pre-commit` and `ruff` #859

Open bpkroth opened 1 week ago

bpkroth commented 1 week ago

We have a decent collection of linters/formatters at this point to ensure good code quality. However, they can take a while to run (pylint in particular) and a selling point for ruff is

⚡️ 10-100x faster than existing linters (like Flake8) and formatters (like Black)

We've worked around that somewhat by using make file rules that can execute in parallel, however that complicates the dev environment and dependencies a tad (which we again workaround using devcontainers).

Another option could be to use something like pre-commit and ruff.

A quick look seems to indicate it would flag a bunch of things off the bat, so we'd have to create a bunch of exceptions and/or cleanup some things at the same time.

We'd also probably want to remove a pile of our exceptions from the code.

And enable the VScode extension.

Anyways, not sure it's worth it, but here's a branch that quickly started that effort:

https://github.com/bpkroth/MLOS/tree/ruff