From 5181c97281e964da0b89176a50d476819039d658 Mon Sep 17 00:00:00 2001 From: Matt Layher Date: Tue, 28 Jun 2016 00:25:12 -0400 Subject: [PATCH 1/2] Fix PEP 8 error in DCIM tests --- netbox/dcim/tests/test_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/dcim/tests/test_models.py b/netbox/dcim/tests/test_models.py index ca841ea8f..2f3d8def6 100644 --- a/netbox/dcim/tests/test_models.py +++ b/netbox/dcim/tests/test_models.py @@ -64,7 +64,7 @@ class RackTestCase(TestCase): rack=rack1, position=10, face=RACK_FACE_REAR, - ) + ) device1.save() # Validate rack height From f1857dd189442211c4a9a377ed1ee853a4424309 Mon Sep 17 00:00:00 2001 From: Matt Layher Date: Tue, 28 Jun 2016 00:20:02 -0400 Subject: [PATCH 2/2] Add CI check for PEP 8 compliance --- .travis.yml | 1 + scripts/cibuild.sh | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/.travis.yml b/.travis.yml index a7f9cda45..01fb25d8f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,5 +3,6 @@ python: - "2.7" install: - pip install -r requirements.txt + - pip install pep8 script: - ./scripts/cibuild.sh diff --git a/scripts/cibuild.sh b/scripts/cibuild.sh index b3f50152e..4f4fe1ca3 100755 --- a/scripts/cibuild.sh +++ b/scripts/cibuild.sh @@ -21,6 +21,16 @@ if [[ ! -z $SYNTAX ]]; then EXIT=1 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 CONFIG="netbox/netbox/configuration.py" cp netbox/netbox/configuration.example.py $CONFIG