2 ###############################################################################
3 # git diff style checker
4 # ----------------------
5 # This script runs a style check within our Drone setup, or within the
8 # Since the codebase has a substantial body of non-conformant code, style
9 # checks are only ran on the diffs (compared to master). As a consequence of
10 # this, style checks also only run on non-master branches.
11 ###############################################################################
13 if [[ ${CI_BRANCH} = "master" ]]; then
14 echo "Skipping style checks on commit(s) to the master branch."
18 if [[ ${CI_REPO:=} = "" ]]; then
19 # This assumed to be `drone exec`.
20 echo "Running style checks on staged local changes..."
21 git
diff --cached | pep8
--diff
23 echo "Running style checks within Drone..."
24 git fetch
--no-tags --depth=10 origin master
25 git
diff origin
/${CI_BRANCH} origin
/master | pep8
--diff
29 if [[ ${error_encountered} = 1 ]]; then
30 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
31 echo "pep8 issues found. reddit follows pep8: https://github.com/reddit/styleguide"
32 echo " Please commit a fix or ignore inline with: noqa"
33 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
37 echo "Style checks passed. Good jerb!"