empa-scientific-it / python-tutorial

Material for a Jupyter-based Python tutorial
MIT License
33 stars 26 forks source link

Reconfigure pre-commit hooks #155

Open baffelli opened 1 year ago

baffelli commented 1 year ago

I think the current configuration of pre-commit hooks isn't very ergonomic: every time it runs, it creates a new commit in the remote repository. This means that after a push, my local changes are automatically out of sync with the remote. We should disable the pre-commit bot from producing a commit and using it only as a CI step / gate.

edoardob90 commented 1 year ago

But it should create a commit with the stuff it fixes, no? Otherwise what's the point? Only having a badge that says "your commit is good"?

baffelli commented 1 year ago

I think the user should do this if the check fails. Pre-commit hooks should only modify files locally on the development environment. Other than this, I prefer that CI/CD is stateless as far as the files in the repository are concerned. I'd rather have a commit fail to merge and have to edit the files locally than always having pre-commit creating additional commits that don't have any extra changes other than formatting and styling.

The current workflow makes it more complex than necessary to work using multiple commits in a draft PR because of the additional remote commits that are created automatically.