Skip to content

Commit

Permalink
Add flake8 check to Travis-CI matrix
Browse files Browse the repository at this point in the history
Closes kiwix#263
  • Loading branch information
refeed committed Mar 24, 2019
1 parent fc8a924 commit 3f22452
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 27 deletions.
25 changes: 5 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,10 @@ cache:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache
install: if [[ $TRAVIS_OS_NAME != "linux" || $DESKTOP_ONLY != 1 ]]; then travis/install_extra_deps.sh; fi
script:
- |
if [[ $TRAVIS_OS_NAME = "linux" && $DESKTOP_ONLY == 1 ]]
then
if [[ $PLATFORM = "flatpak" ]]
then
docker build -t kiwix/build -f travis/Dockerfile_flatpak .
else
docker build -t kiwix/build -f travis/Dockerfile .
fi
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
else
if [[ $TRAVIS_OS_NAME = "linux" ]]
then
python3.5 travis/compile_all.py
else
python3 travis/compile_all.py
fi
fi
install:
- if [[ $TRAVIS_OS_NAME != "linux" || $DESKTOP_ONLY != 1 ]]; then travis/install_extra_deps.sh; fi
- if [[ $TEST_SUITE == "flake8_check" ]]; then python3 -m pip install flake8; fi
script: travis/travis_script.sh
after_failure: travis/upload_all_log.sh
deploy:
- provider: script
Expand Down Expand Up @@ -145,6 +129,7 @@ matrix:
os: osx
- env: PLATFORM="iOS_i386"
os: osx
- env: TEST_SUITE="flake8_check"

notifications:
irc:
Expand Down
40 changes: 40 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[flake8]
ignore =
E201, # whitespace after '{'
E202, # whitespace before '}'
E501, # line too long
E128, # continuation line under-indented for visual indent
E226, # missing whitespace around arithmetic operator
E126, # continuation line over-indented for hanging indent
E203, # whitespace before ':'
E111, # indentation is not a multiple of four
E261, # at least two spaces before inline comment
E124, # closing bracket does not match visual indentation
E731, # do not assign a lambda expression, use a def
E401, # multiple imports on one line
E302, # expected 2 blank lines, found 1
W503, # line break before binary operator
E231, # missing whitespace after ':'
E303, # too many blank lines (2)
E302, # expected 2 blank lines, found 1
E305, # expected 2 blank lines after class or function definition, found 1
F401, # 'X' imported but unused
F821, # undefined name 'X'
E228, # missing whitespace around modulo operator
E999, # SyntaxError: invalid syntax
E225, # missing whitespace around operator
F403, # 'from .base import *' used; unable to detect undefined names
W391, # blank line at end of file
E122, # continuation line missing indentation or outdented
E251, # unexpected spaces around keyword / parameter equals
E713, # test for membership should be 'not in'
E722, # do not use bare except'
E129, # visually indented line with same indent as next logical line
E301, # expected 1 blank line, found 0
E121, # continuation line under-indented for hanging indent
E123, # closing bracket does not match indentation of opening bracket's line
E127, # continuation line over-indented for visual indent
E222, # multiple spaces after operator
E265, # block comment should start with '# '
F811, # redefinition of unused X
E222, # multiple spaces after operator
21 changes: 14 additions & 7 deletions travis/install_extra_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ set -e

if [[ "$TRAVIS_OS_NAME" == "osx" ]]
then
pip3 install pillow
pip3 install .
if [[ "$TEST_SUITE" == "flake8_check" ]]
then
pip3 install flake8
else
pip3 install pillow
pip3 install .

wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip
unzip ninja-mac.zip ninja
wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip
unzip ninja-mac.zip ninja
fi
else
wget https://bootstrap.pypa.io/get-pip.py
python3.5 get-pip.py --user
Expand All @@ -21,6 +26,8 @@ else
unzip ninja-linux.zip ninja
fi

mkdir -p $HOME/bin
cp ninja $HOME/bin

if [[ "$TEST_SUITE" != "flake8_check" ]]
then
mkdir -p $HOME/bin
cp ninja $HOME/bin
fi
23 changes: 23 additions & 0 deletions travis/travis_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
if [[ $TEST_SUITE = "flake8_check" ]]
then
flake8 .
else
if [[ $TRAVIS_OS_NAME = "linux" && $DESKTOP_ONLY == 1 ]]
then
if [[ $PLATFORM = "flatpak" ]]
then
docker build -t kiwix/build -f travis/Dockerfile_flatpak .
else
docker build -t kiwix/build -f travis/Dockerfile .
fi
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
else
if [[ $TRAVIS_OS_NAME = "linux" ]]
then
python3.5 travis/compile_all.py
else
python3 travis/compile_all.py
fi
fi
fi

0 comments on commit 3f22452

Please sign in to comment.