diff --git a/.travis.yml b/.travis.yml index c0e6f0ece..8b3b4cc44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ matrix: fast_finish: true include: - - name: Run rust tests + - name: Run Rust tests language: rust rust: stable cache: cargo @@ -16,7 +16,7 @@ matrix: # To test the snippets, we use Travis' Python environment (because # installing rust ourselves is a lot easier than installing Python) - - name: python test snippets + - name: Python test snippets language: python python: 3.6 cache: @@ -28,7 +28,7 @@ matrix: - CODE_COVERAGE=false script: tests/.travis-runner.sh - - name: Check rust code style with rustfmt + - name: Check Rust code style with rustfmt language: rust rust: stable cache: cargo @@ -39,7 +39,7 @@ matrix: env: - JOBCACHE=3 - - name: Lint code with clippy + - name: Lint Rust code with clippy language: rust rust: stable cache: cargo @@ -50,7 +50,15 @@ matrix: env: - JOBCACHE=8 - - name: publish documentation + - name: Lint Python code with flake8 + language: python + python: 3.6 + cache: pip + env: JOBCACHE=9 + install: pip install flake8 + script: flake8 . --count --exclude=./.*,./Lib,./vm/Lib --select=E9,F63,F7,F82 --show-source --statistics + + - name: Publish documentation language: rust rust: stable cache: cargo @@ -109,7 +117,7 @@ matrix: - TRAVIS_RUST_VERSION=nightly - CODE_COVERAGE=true - - name: test WASM + - name: Test WASM language: python python: 3.6 cache: diff --git a/tests/snippets/bools.py b/tests/snippets/bools.py index 23f22dce7..67811ded2 100644 --- a/tests/snippets/bools.py +++ b/tests/snippets/bools.py @@ -34,13 +34,13 @@ class Falsey: assert not Falsey() -assert (True or fake) +assert (True or fake) # noqa: F821 assert (False or True) assert not (False or False) assert ("thing" or 0) == "thing" assert (True and True) -assert not (False and fake) +assert not (False and fake) # noqa: F821 assert (True and 5) == 5 # Bools are also ints. diff --git a/tests/snippets/builtins_module.py b/tests/snippets/builtins_module.py index e3bdcdc16..d3daffc54 100644 --- a/tests/snippets/builtins_module.py +++ b/tests/snippets/builtins_module.py @@ -6,7 +6,7 @@ with assertRaises(AttributeError): __builtins__.__builtins__ __builtins__.x = 'new' -assert x == 'new' +assert x == 'new' # noqa: F821 exec('assert "__builtins__" in globals()', dict()) exec('assert __builtins__ == 7', {'__builtins__': 7}) @@ -23,6 +23,6 @@ assert namespace['__builtins__'] == __builtins__.__dict__ # __builtins__ is deletable but names are alive del __builtins__ with assertRaises(NameError): - __builtins__ + __builtins__ # noqa: F821 assert print diff --git a/tests/snippets/delete.py b/tests/snippets/delete.py index aa7ae0536..2e476c7a1 100644 --- a/tests/snippets/delete.py +++ b/tests/snippets/delete.py @@ -14,8 +14,8 @@ assert not hasattr(foo, 'bar') x = 1 y = 2 del (x, y) -assert_raises(NameError, lambda: x) -assert_raises(NameError, lambda: y) +assert_raises(NameError, lambda: x) # noqa: F821 +assert_raises(NameError, lambda: y) # noqa: F821 with assertRaises(NameError): - del y + del y # noqa: F821 diff --git a/tests/snippets/dismod.py b/tests/snippets/dismod.py index eac1d3f72..88282d3eb 100644 --- a/tests/snippets/dismod.py +++ b/tests/snippets/dismod.py @@ -10,7 +10,7 @@ dis.dis(compile("f(x=1, y=2)", "", "eval")) print("\n") def f(): - with g(): + with g(): # noqa: F821 try: for a in {1: 4, 2: 5}: yield [True and False or True, []] @@ -21,7 +21,7 @@ dis.dis(f) class A(object): def f(): - x += 1 + x += 1 # noqa: F821 pass def g(): for i in range(5): diff --git a/tests/snippets/test_exec.py b/tests/snippets/test_exec.py index 506882e16..289f878cc 100644 --- a/tests/snippets/test_exec.py +++ b/tests/snippets/test_exec.py @@ -1,5 +1,5 @@ exec("def square(x):\n return x * x\n") -assert 16 == square(4) +assert 16 == square(4) # noqa: F821 d = {} exec("def square(x):\n return x * x\n", {}, d) @@ -39,8 +39,8 @@ else: g = globals() g['x'] = 2 exec('x += 2') -assert x == 4 -assert g['x'] == x +assert x == 4 # noqa: F821 +assert g['x'] == x # noqa: F821 exec("del x") assert 'x' not in g diff --git a/tests/snippets/try_exceptions.py b/tests/snippets/try_exceptions.py index e520ebdf2..a4b2f5d6a 100644 --- a/tests/snippets/try_exceptions.py +++ b/tests/snippets/try_exceptions.py @@ -15,7 +15,7 @@ except ZeroDivisionError as ex: class E(Exception): def __init__(self): - asdf + asdf # noqa: F821 try: raise E