You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lint.sh 944B

1234567891011121314151617181920212223242526272829
  1. #/usr/bin/env bash
  2. #
  3. # Run static analysis of the codebase
  4. #
  5. # This is run on Travis to ensure that pull requests conform to the project coding standards.
  6. # Ideally, this figure should be < 100. I'll keep reducing it as the
  7. # codebase gets tidied up incrementally.
  8. THRESHOLD=795
  9. # Some warnings aren't worth worrying about...
  10. IGNORE="W292,E202"
  11. # Run flake8 and convert the output into a format that the "violations" plugin
  12. # for Jenkins/Hudson can understand. Ignore warnings from migrations we we don't
  13. # really care about those.
  14. ERRORFILE="violations.txt"
  15. flake8 --ignore=$IGNORE oscar | perl -ple "s/: /: [E] /" | grep -v migrations > $ERRORFILE
  16. # Check that the number of violations is acceptable
  17. NUMERRORS=`cat $ERRORFILE | wc -l`
  18. if [ $NUMERRORS -gt $THRESHOLD ]
  19. then
  20. echo
  21. echo "Too many flake8 errors - maximum allowed is $THRESHOLD, found $NUMERRORS"
  22. echo
  23. echo "To fix, run 'make lint' and examine $ERRORFILE"
  24. exit 1
  25. fi