[Feature][Development] Install pre-commit hook automatically and add doc checks
Search before asking
- [X] I had searched in the issues and found no similar feature requirement.
Description
- Currently we need developers to copy example
pre-commit hookscript into their.git/hooksdirectory. For convenience, we could do this for developers by triggering a script to copy the hook during first-time compilation of the project. - We could add doc checks in
pre-commit hookto make sure updated docs are cool before developers pushing them and triggering the remote CI.
Use case
- Already described above.
Related issues
No response
Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Thank you for your feedback, we have received your issue, Please wait patiently for a reply.
- In order for us to understand your request as soon as possible, please provide detailed information、version or pictures.
- If you haven't received a reply for a long time, you can join our slack and send your question to channel
#troubleshooting
IMHO, by performing some easy checks in pre-commit hook, we could reduce the stress of remote CI a bit.
Maybe you can see the pre-commit project https://pre-commit.com. But I have had some bad experiences with it, such as:
- Slow: Obviously, because we have to check locally
- Update: when
pre-commit-configfile change, development have to update the pre-commit hook, otherwise they will failed in the github action. Also developer have to update both github action andpre-commit-configwhen then change the check rule
you can see it here https://github.com/apache/airflow/blob/a562cc396212e4d21484088ac5f363ade9ac2b8d/.pre-commit-config.yaml#L300-L308 about how to run local script into pre-commit
Maybe you can see the pre-commit project https://pre-commit.com. But I have had some bad experiences with it, such as:
- Slow: Obviously, because we have to check locally
- Update: when
pre-commit-configfile change, development have to update the pre-commit hook, otherwise they will failed in the github action. Also developer have to update both github action andpre-commit-configwhen then change the check rule
Thanks for the information. I agree that we should not have too many checks in pre-commit hook to avoid it getting too slow. Currently our pre-commit hook takes about 1 minute in total to run mvn spotless:apply and I think it's fine.
And in module dolphinscheudler-python we also have https://github.com/apache/dolphinscheduler/blob/cfb5918e7492b209db118d528878663ff808ca8e/dolphinscheduler-python/pydolphinscheduler/.pre-commit-config.yaml#L25-L35 but in barely use it. One reason is that I have tox for better choices https://github.com/apache/dolphinscheduler/blob/cfb5918e7492b209db118d528878663ff808ca8e/dolphinscheduler-python/pydolphinscheduler/tox.ini#L24-L29.
But I do not find some tool in Java, so maybe we can use pre-commit for a shot