Skip to content

Commit bbfaae0

Browse files
author
cclauss
committed
Travis CI: Use flake8 to find syntax errors and undefined names
Currently __app__ and __self__ are _undefined names_. Is there a way to use __global__ or __import__ or __# noqa__ to resolve this? __E901,E999,F821,F822,F823__ are the "_showstopper_" [flake8](http://flake8.pycqa.org) issues that can halt the runtime with a SyntaxError, NameError, etc. Most other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety. * F821: undefined name `name` * F822: undefined name `name` in `__all__` * F823: local variable name referenced before assignment * E901: SyntaxError or IndentationError * E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
1 parent 874c126 commit bbfaae0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.travis.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,22 @@ matrix:
3333
# - BREW_INSTALL=python3
3434

3535
install:
36-
- pip install tox
36+
- pip install flake8 tox
3737
# - |
3838
# if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
3939
# if [[ -n "$BREW_INSTALL" ]]; then
4040
# brew update
4141
# brew install "$BREW_INSTALL"
4242
# fi
4343
# fi
44-
# pip install tox
44+
45+
before_script:
46+
# stop the build if there are Python syntax errors or undefined names
47+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
48+
if [[ $TOXENV == py37 ]]; then
49+
flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics ;
50+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics ;
51+
fi
4552

4653
script:
4754
- tox

0 commit comments

Comments
 (0)