Skip to content

Commit 58c785c

Browse files
authored
Merge pull request #367 from cclauss/patch-2
Travis CI: Run flake8 tests to find syntax errors and undefined names
2 parents 20b3f39 + ae05bd9 commit 58c785c

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

.travis.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,30 @@
1+
sudo: false
12
language: python
23
cache: pip
3-
python:
4-
- "3.6"
5-
- "3.5"
6-
- "3.4"
7-
- "3.3"
8-
- "2.7"
9-
- "2.6"
10-
11-
sudo: false
124

13-
# command to install dependencies, e.g. pip install -r requirements.txt
14-
# These packages only exist on Ubuntu 13.04 and newer:
15-
# No dependencies currently unless using Python 2.6.
5+
matrix:
6+
include:
7+
- python: 2.7
8+
- python: 3.4
9+
- python: 3.5
10+
- python: 3.6
11+
- python: 3.7
12+
dist: xenial # required for Python 3.7 (travis-ci/travis-ci#9069)
13+
sudo: required # required for Python 3.7 (travis-ci/travis-ci#9069)
1614

1715
install:
18-
- if [[ $TRAVIS_PYTHON_VERSION == 2.6* ]]; then pip install -r requirements_py26.txt; fi
1916
- python setup.py install
2017

18+
before_script:
19+
# Run flake8 tests only on Python 2.7 and 3.7...
20+
# 1) stop the build if there are Python syntax errors or undefined names
21+
# 2) exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
22+
- if [[ $TRAVIS_PYTHON_VERSION == *.7 ]]; then
23+
pip install flake8;
24+
flake8 . --count --exit-zero --select=E901,E999,F821,F822,F823 --show-source --statistics;
25+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics;
26+
fi
27+
2128
# command to run tests, e.g. python setup.py test
2229

2330
script:

0 commit comments

Comments
 (0)