keras-team/keras-tuner

use pre-commit (the framework) for linting and code formatting and in CI

jkittner opened this issue · 0 comments

Is your feature request related to a problem? Please describe.

When trying to run the shell/lint.sh and shell/format.sh commands, I ran into a bunch of issues, with tools missing, isort trying to format my entire virtual environment etc. etc.

Describe the solution you'd like

I can see, that you are already setting one of the scripts up as a pre-commit hook:

echo "sh shell/lint.sh" > .git/hooks/pre-commit

I would suggest using pre-commit.com (the framework), which manages all installations and makes the tools reproducible for every contributor. For CI, one could use pre-commit.ci which runs the checks very quickly (in seconds) and also applies autofixes, to a PR, if the user did non run pre-commit (which is opt in, the user has to run pre-commit install first to set it up as a pre-commit hook). You can also get frequent autoupdates as a PR, keeping the tools in the config up to date.

If you're interested in using this, I'd be happy to set this up and contribute with another PR.