Browse Source

Add CI check for PEP 8 compliance

Matt Layher 8 years ago
parent
commit
f1857dd189
2 changed files with 11 additions and 0 deletions
  1. 1 0
      .travis.yml
  2. 10 0
      scripts/cibuild.sh

+ 1 - 0
.travis.yml

@@ -3,5 +3,6 @@ python:
   - "2.7"
   - "2.7"
 install:
 install:
   - pip install -r requirements.txt
   - pip install -r requirements.txt
+  - pip install pep8
 script:
 script:
   - ./scripts/cibuild.sh
   - ./scripts/cibuild.sh

+ 10 - 0
scripts/cibuild.sh

@@ -21,6 +21,16 @@ if [[ ! -z $SYNTAX ]]; then
 	EXIT=1
 	EXIT=1
 fi
 fi
 
 
+# Check all python source files for PEP 8 compliance, but explicitly
+# ignore:
+#  - E501: line greater than 80 characters in length
+pep8 --ignore=E501 netbox/
+RC=$?
+if [[ $RC != 0 ]]; then
+	echo -e "\n$(info) one or more PEP 8 errors detected, failing build."
+	EXIT=$RC
+fi
+
 # Prepare configuration file for use in CI
 # Prepare configuration file for use in CI
 CONFIG="netbox/netbox/configuration.py"
 CONFIG="netbox/netbox/configuration.py"
 cp netbox/netbox/configuration.example.py $CONFIG
 cp netbox/netbox/configuration.example.py $CONFIG