Skip to content

Commit

Permalink
Reintroduce a treshold for PEP8 warnings
Browse files Browse the repository at this point in the history
To avoid littering the codebase with 'Fix PEP8' commits, we've decided
to reintroduce a treshold so PEP8 fixes can be batched together.
  • Loading branch information
maiksprenger committed Jan 9, 2014
1 parent 2b5cc46 commit 974e1fe
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lint.sh
Expand Up @@ -4,18 +4,21 @@
#
# This is run on Travis to ensure that pull requests conform to the project coding standards.

# Ideally, this figure should be 0. But to keep the amount of "Fix PEP8" commits
# low, we only fail Travis after a certain amount of warnings have accumulated
THRESHOLD=15

# Run flake8 and convert the output into a format that the "violations" plugin
# for Jenkins/Hudson can understand. Ignore warnings from migrations we we don't
# really care about those.
# for Jenkins/Hudson can understand.
# flake8 is configured in [flake8] section in tox.ini
ERROR_FILE="violations.txt"
THRESHOLD=0
flake8 --max-complexity=10 oscar | perl -ple "s/: /: [E] /" > $ERROR_FILE
flake8 oscar | perl -ple "s/: /: [E] /" > $ERROR_FILE
cat $ERROR_FILE

# Check that the number of violations is acceptable
NUMERRORS=`cat $ERROR_FILE | wc -l`
if [ $NUMERRORS -gt $THRESHOLD ]
then
echo "The following flake8 errors need to be fixed"
cat $ERROR_FILE
echo "Too many flake8 errors - maximum allowed is $THRESHOLD, found $NUMERRORS"
exit 1
fi

0 comments on commit 974e1fe

Please sign in to comment.