You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss@petri.apache.org by GitBox <gi...@apache.org> on 2021/05/05 21:22:33 UTC

[GitHub] [petri] jbampton opened a new pull request #38: feat(ci): add pre-commit Python framework

jbampton opened a new pull request #38:
URL: https://github.com/apache/petri/pull/38


   Official -> "Git hook scripts are useful for identifying simple issues before submission to code review. We run our hooks on every commit to automatically point out issues in code such as missing semicolons, trailing whitespace, and debug statements. By pointing these issues out before code review, this allows a code reviewer to focus on the architecture of a change while not wasting time with trivial style nitpicks."
   
   https://pre-commit.com/
   
   Adding `pre-commit` gives us a larger array of checks or tests and pre-commit runs on both the local machine and with GitHub Actions.  `pre-commit` speeds up development since it can automatically fix issues in commits and you don't have to wait for the GitHub Actions to run since it runs on your local machine really quickly and gives instant feedback.
   
   `pre-commit` can be installed in multiple ways even with `pip` so in future could be added to the `requirements.txt`.  Also we are currently running `Flake8` on GitHub Actions and this can be moved to the `pre-commit` framework in future and maybe also added to the `requirements.txt`. 
   
   Apache Airflow has a best in class `pre-commit` framework and Airflow is mainly written in Python.
   
   https://github.com/apache/airflow/blob/master/.pre-commit-config.yaml
   
   Running `pre-commit run --all-files` on this commit on my local machine:
   
   <img width="894" alt="Screen Shot 2021-05-06 at 7 00 17 am" src="https://user-images.githubusercontent.com/418747/117210632-4c386580-ae3b-11eb-9c90-5e5f7e10d3f4.png">
   
   <img width="893" alt="Screen Shot 2021-05-06 at 7 00 03 am" src="https://user-images.githubusercontent.com/418747/117210685-5d817200-ae3b-11eb-8064-d69b13581434.png">


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org