dolphinscheduler icon indicating copy to clipboard operation
dolphinscheduler copied to clipboard

[Feature][Development] Install pre-commit hook automatically and add doc checks

Open EricGao888 opened this issue 3 years ago • 6 comments

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 hook script into their .git/hooks directory. 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 hook to 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

EricGao888 avatar Aug 08 '22 07:08 EricGao888

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

github-actions[bot] avatar Aug 08 '22 07:08 github-actions[bot]

IMHO, by performing some easy checks in pre-commit hook, we could reduce the stress of remote CI a bit.

EricGao888 avatar Aug 08 '22 07:08 EricGao888

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-config file 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 and pre-commit-config when then change the check rule

zhongjiajie avatar Aug 08 '22 08:08 zhongjiajie

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

zhongjiajie avatar Aug 08 '22 08:08 zhongjiajie

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-config file 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 and pre-commit-config when 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.

EricGao888 avatar Aug 08 '22 08:08 EricGao888

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

zhongjiajie avatar Aug 08 '22 08:08 zhongjiajie