feluelle commented on a change in pull request #4120: [AIRFLOW-XXX] Update 
Contributing Guide - Git Hooks
URL: https://github.com/apache/incubator-airflow/pull/4120#discussion_r229857502
 
 

 ##########
 File path: CONTRIBUTING.md
 ##########
 @@ -183,6 +183,24 @@ docker-compose -f scripts/ci/docker-compose.yml run 
airflow-testing /app/scripts
 Alternatively can also set up [Travis CI](https://travis-ci.org/) on your repo 
to automate this.
 It is free for open source projects.
 
+Another great way of automating linting and testing is to use [Git 
Hooks](https://git-scm.com/book/uz/v2/Customizing-Git-Git-Hooks). For example 
you could create a `pre-commit` file based on the Travis CI Pipeline so that 
before each commit a local pipeline will be executed and if this pipeline 
failed (returned an exit code other than `0`) the commit does not come through.
+This "in theory" has the advantage that you can not commit any code that fails 
that again reduces the errors in the Travis CI Pipelines.
+
+Since there are a lot of tests the script would last very long so you propably 
only should test your new feature locally.
+
+The following example of a `pre-commit` file allows you..
+- to lint your code
+- test your code in a docker container based on python 2
+- test your code in a docker container based on python 3
+
+NOTE: Change the `airflow-py2` and `airflow-py3` to your docker containers or 
remove the `docker exec` if you have set up your environment directly on your 
host system.
+```
 
 Review comment:
   I am going to add `|| exit "$?"` after each command because it is necessary 
to return the exit code from the command to the shell script. So it exits if 
one of the commands return a non-zero exit code.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to