keras-tuner icon indicating copy to clipboard operation
keras-tuner copied to clipboard

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

Open jkittner opened this issue 1 year ago • 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: https://github.com/keras-team/keras-tuner/blob/8169d599bb82f96142f0bfdfb1a66196771c1721/.devcontainer/setup.sh#L3 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.

jkittner avatar Mar 06 '23 20:03 jkittner