CI: Run flake8 on Python 3.7

Yet another attempt at #7131 because without automated test, these _undefined names_ keep creeping back into the codebase: #9225, #9226, #9229, #9788, #10038, and a new one below...

[flake8](http://flake8.pycqa.org) testing of https://github.com/ArduPilot/ardupilot on Python 3.7.1

$ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__
```
./Tools/autotest/sim_vehicle.py:396:39: F821 undefined name 'autotest'
    swarminit_filepath = os.path.join(autotest, "swarminit.txt")
                                      ^
1     F821 undefined name 'autotest'
```
__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
This commit is contained in:
cclauss 2019-01-18 11:46:11 +01:00 committed by Andrew Tridgell
parent f98bfb1a35
commit f5d23f8701
1 changed files with 9 additions and 0 deletions

View File

@ -70,3 +70,12 @@ matrix:
- if: type != cron
compiler: "clang"
env: CI_BUILD_TARGET="sitltest-rover sitltest-sub""
- language: python
python: 3.7
addons: # speedup: This test does not need addons
compiler:
dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069)
before_install: pip install flake8
script:
- EXCLUDE=./.*,./modules/gtest,./modules/ChibiOS/test,./modules/uavcan/libuavcan
- flake8 . --count --exclude=$EXCLUDE --select=E901,E999,F821,F822,F823 --show-source --statistics