Merge pull request #1167 from cclauss/patch-1

Travis CI: Lint Python code with flake8
This commit is contained in:
Windel Bouwman
2019-07-24 09:04:48 +02:00
committed by GitHub
7 changed files with 27 additions and 19 deletions

View File

@@ -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:

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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):

View File

@@ -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

View File

@@ -15,7 +15,7 @@ except ZeroDivisionError as ex:
class E(Exception):
def __init__(self):
asdf
asdf # noqa: F821
try:
raise E