Skip to content

Commit 65157a2

Browse files
committed
Introduces linting (tox/flake8)
Makes sure lint checks are ran before `docker build` so we fail fast. Currently `flake8` errors are ignored except for `E101` and `W191`. This will demonstrate the fail fast case. Next commit will fix these two errors in the code base.
1 parent 45c26bd commit 65157a2

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ services:
66
- docker
77

88
before_install:
9-
- docker build --tag=p4a .
9+
- sudo apt-get update -qq
10+
- sudo apt-get install -qq python-tox
1011

1112
env:
1213
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/android-ndk'
@@ -16,5 +17,10 @@ env:
1617
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/crystax-ndk'
1718
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/crystax-ndk --requirements python3crystax,setuptools,android'
1819

20+
before_script:
21+
# we want to fail fast on tox errors without having to `docker build` first
22+
- tox
23+
1924
script:
25+
- docker build --tag=p4a .
2026
- docker run p4a /bin/sh -c "$COMMAND"

tox.ini

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[tox]
2+
envlist = pep8
3+
# no setup.py to be ran
4+
skipsdist = True
5+
6+
[testenv:pep8]
7+
deps = flake8
8+
commands = flake8 pythonforandroid/
9+
10+
[flake8]
11+
ignore =
12+
E111, E114, E115, E116, E202, E121, E123, E124, E225, E126, E127, E128,
13+
E129, E201, E203, E221, E226, E231, E241, E251, E261, E265, E266, E271,
14+
E302, E303, E305, E401, E402, E501, E502, E703, E722, E741, F401, F403,
15+
F812, F821, F841, F811, W291, W292, W293, W391, W503

0 commit comments

Comments
 (0)