Skip to content

Commit 73b06c8

Browse files
committed
Add flake8 check to Travis-CI matrix
Closes kiwix#263
1 parent fc8a924 commit 73b06c8

File tree

3 files changed

+80
-19
lines changed

3 files changed

+80
-19
lines changed

.travis.yml

+20-12
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,30 @@ cache:
2727
- $HOME/.gradle/caches/
2828
- $HOME/.gradle/wrapper/
2929
- $HOME/.android/build-cache
30-
install: if [[ $TRAVIS_OS_NAME != "linux" || $DESKTOP_ONLY != 1 ]]; then travis/install_extra_deps.sh; fi
30+
install:
31+
- if [[ $TRAVIS_OS_NAME != "linux" || $DESKTOP_ONLY != 1 ]]; then travis/install_extra_deps.sh; fi
3132
script:
3233
- |
33-
if [[ $TRAVIS_OS_NAME = "linux" && $DESKTOP_ONLY == 1 ]]
34+
if [[ $TEST_SUITE = "flake8_check" ]]
3435
then
35-
if [[ $PLATFORM = "flatpak" ]]
36-
then
37-
docker build -t kiwix/build -f travis/Dockerfile_flatpak .
38-
else
39-
docker build -t kiwix/build -f travis/Dockerfile .
40-
fi
41-
docker run -e PLATFORM -e NIGHTLY_DATE -e TRAVIS_EVENT_TYPE -e DESKTOP_ONLY -e TRAVIS_TAG --device /dev/fuse --cap-add ALL --privileged kiwix/build
36+
flake8 .
4237
else
43-
if [[ $TRAVIS_OS_NAME = "linux" ]]
38+
if [[ $TRAVIS_OS_NAME = "linux" && $DESKTOP_ONLY == 1 ]]
4439
then
45-
python3.5 travis/compile_all.py
40+
if [[ $PLATFORM = "flatpak" ]]
41+
then
42+
docker build -t kiwix/build -f travis/Dockerfile_flatpak .
43+
else
44+
docker build -t kiwix/build -f travis/Dockerfile .
45+
fi
46+
docker run -e PLATFORM -e NIGHTLY_DATE -e TRAVIS_EVENT_TYPE -e DESKTOP_ONLY -e TRAVIS_TAG --device /dev/fuse --cap-add ALL --privileged kiwix/build
4647
else
47-
python3 travis/compile_all.py
48+
if [[ $TRAVIS_OS_NAME = "linux" ]]
49+
then
50+
python3.5 travis/compile_all.py
51+
else
52+
python3 travis/compile_all.py
53+
fi
4854
fi
4955
fi
5056
after_failure: travis/upload_all_log.sh
@@ -145,6 +151,8 @@ matrix:
145151
os: osx
146152
- env: PLATFORM="iOS_i386"
147153
os: osx
154+
- env: TEST_SUITE="flake8_check"
155+
os: osx
148156

149157
notifications:
150158
irc:

setup.cfg

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[flake8]
2+
ignore =
3+
E201, # whitespace after '{'
4+
E202, # whitespace before '}'
5+
E501, # line too long
6+
E128, # continuation line under-indented for visual indent
7+
E226, # missing whitespace around arithmetic operator
8+
E126, # continuation line over-indented for hanging indent
9+
E203, # whitespace before ':'
10+
E111, # indentation is not a multiple of four
11+
E261, # at least two spaces before inline comment
12+
E124, # closing bracket does not match visual indentation
13+
E731, # do not assign a lambda expression, use a def
14+
E401, # multiple imports on one line
15+
E302, # expected 2 blank lines, found 1
16+
W503, # line break before binary operator
17+
E231, # missing whitespace after ':'
18+
E303, # too many blank lines (2)
19+
E302, # expected 2 blank lines, found 1
20+
E305, # expected 2 blank lines after class or function definition, found 1
21+
F401, # 'X' imported but unused
22+
F821, # undefined name 'X'
23+
E228, # missing whitespace around modulo operator
24+
E999, # SyntaxError: invalid syntax
25+
E225, # missing whitespace around operator
26+
F403, # 'from .base import *' used; unable to detect undefined names
27+
W391, # blank line at end of file
28+
E122, # continuation line missing indentation or outdented
29+
E251, # unexpected spaces around keyword / parameter equals
30+
E713, # test for membership should be 'not in'
31+
E722, # do not use bare except'
32+
E129, # visually indented line with same indent as next logical line
33+
E301, # expected 1 blank line, found 0
34+
E121, # continuation line under-indented for hanging indent
35+
E123, # closing bracket does not match indentation of opening bracket's line
36+
E127, # continuation line over-indented for visual indent
37+
E222, # multiple spaces after operator
38+
E265, # block comment should start with '# '
39+
F811, # redefinition of unused X
40+
E222, # multiple spaces after operator
41+
E117, # over-indented
42+
W504, # line break after binary operator
43+
F405, # 'X' may be undefined, or defined from star imports: X
44+
F841, # local variable 'tlc' is assigned to but never used
45+
W605, # invalid escape sequence '\|'
46+
F402, # import 'X' from line X shadowed by loop variable

travis/install_extra_deps.sh

+14-7
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ set -e
44

55
if [[ "$TRAVIS_OS_NAME" == "osx" ]]
66
then
7-
pip3 install pillow
8-
pip3 install .
7+
if [[ "$TEST_SUITE" == "flake8_check" ]]
8+
then
9+
pip3 install flake8
10+
else
11+
pip3 install pillow
12+
pip3 install .
913

10-
wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip
11-
unzip ninja-mac.zip ninja
14+
wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip
15+
unzip ninja-mac.zip ninja
16+
fi
1217
else
1318
wget https://bootstrap.pypa.io/get-pip.py
1419
python3.5 get-pip.py --user
@@ -21,6 +26,8 @@ else
2126
unzip ninja-linux.zip ninja
2227
fi
2328

24-
mkdir -p $HOME/bin
25-
cp ninja $HOME/bin
26-
29+
if [[ "$TEST_SUITE" != "flake8_check" ]]
30+
then
31+
mkdir -p $HOME/bin
32+
cp ninja $HOME/bin
33+
fi

0 commit comments

Comments
 (0)