-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Suggested by @sgaist (thanks!). We have pull requests where contributors may spend a long time trying to fix the build (especially around things like 80 characters-lines, and simple unit tests).
It is simply impossible to wait for the functional tests, or even the unit tests I think, as you wouldn't want to wait 1 minute for a git commit ... to finish. So the hook must be kept as simple as possible.
Example of hooks from other projects:
- JupyterHub
- https://github.com/jupyterhub/jupyterhub/blob/master/.pre-commit-config.yaml
- order imports (some IDE's, linters, and other tools try to keep them in order)
- checks the extra line in the file
- checks that executables have shebangs
- run flake8
- etc
- https://github.com/jupyterhub/jupyterhub/blob/master/.pre-commit-config.yaml
- Tornado
- https://github.com/pandas-dev/pandas/blob/master/.pre-commit-config.yaml
- also runs flake8, black
- sorts imports
- https://github.com/pandas-dev/pandas/blob/master/.pre-commit-config.yaml
- SQLAlchemy
- https://github.com/sqlalchemy/sqlalchemy/blob/master/.pre-commit-config.yaml
- Just blacks and a custom
zimportsscript
- Just blacks and a custom
- https://github.com/sqlalchemy/sqlalchemy/blob/master/.pre-commit-config.yaml
This also means that users contributing to the project are not able to commit without a working environment (well, there's always --no-verify I guess). For JupyterHub, last time I tried to commit something there, it raised an error and asked me to activate my virtualenvironment if I remember well 👍
EDIT: list of projects that would need the pre-commit hooks added:
-
cylc/cylc-flow -
cylc/cylc-uiserver -
cylc/cylc-ui -
cylc/cylc-doc -
cylc/cylc-xtriggers -
cylc/cylc-sphinx-extensions