From f5d23f8701966f72524cf6d8c72403bb08abb5ae Mon Sep 17 00:00:00 2001 From: cclauss Date: Fri, 18 Jan 2019 11:46:11 +0100 Subject: [PATCH] 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 --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index e32baa6f50..c0829a2d66 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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