mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-02-01 02:59:17 +01:00
Use flake8 to find Python syntax errors or undefined names
This commit is contained in:
parent
93b969a049
commit
d11f5b9d16
@ -7,7 +7,13 @@ python:
|
|||||||
- pypy
|
- pypy
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- travis_retry pip install -q pytest mock
|
- travis_retry pip install -q flake8 pytest mock
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
# stop the build if there are Python syntax errors or undefined names.
|
||||||
|
- if [[ $TRAVIS_PYTHON_VERSION != '2.6' ]]; then flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics; fi
|
||||||
|
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide.
|
||||||
|
- if [[ $TRAVIS_PYTHON_VERSION != '2.6' ]]; then flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics; fi
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- PYTHONPATH=. py.test
|
- PYTHONPATH=. py.test
|
||||||
|
@ -2,9 +2,9 @@ import sys
|
|||||||
import zlib
|
import zlib
|
||||||
import imp
|
import imp
|
||||||
|
|
||||||
|
verbosity = verbosity # noqa: F821 must be a previously defined global
|
||||||
z = zlib.decompressobj()
|
z = zlib.decompressobj()
|
||||||
while 1:
|
while 1:
|
||||||
global verbosity
|
|
||||||
name = sys.stdin.readline().strip()
|
name = sys.stdin.readline().strip()
|
||||||
if name:
|
if name:
|
||||||
name = name.decode("ASCII")
|
name = name.decode("ASCII")
|
||||||
@ -22,7 +22,7 @@ while 1:
|
|||||||
setattr(sys.modules[parent], parent_name, module)
|
setattr(sys.modules[parent], parent_name, module)
|
||||||
|
|
||||||
code = compile(content, name, "exec")
|
code = compile(content, name, "exec")
|
||||||
exec(code, module.__dict__) # nosec
|
exec(code, module.__dict__) # nosec
|
||||||
sys.modules[name] = module
|
sys.modules[name] = module
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user