added black for lint check

This commit is contained in:
Yun Xu 2018-10-13 18:10:43 -07:00
parent aa9bf04dfe
commit 272f6e195d
3 changed files with 9 additions and 3 deletions

4
setup.cfg Normal file
View File

@ -0,0 +1,4 @@
[flake8]
# https://github.com/ambv/black#slices
# https://github.com/ambv/black#line-breaks--binary-operators
ignore = E203, W503

View File

@ -21,7 +21,7 @@ def open_local(paths, mode='r', encoding='utf8'):
with open_local(['sanic', '__init__.py'], encoding='latin1') as fp: with open_local(['sanic', '__init__.py'], encoding='latin1') as fp:
try: try:
version = re.findall(r"^__version__ = '([^']+)'\r?$", version = re.findall(r"^__version__ = \"([^']+)\"\r?$",
fp.read(), re.M)[0] fp.read(), re.M)[0]
except IndexError: except IndexError:
raise RuntimeError('Unable to determine version.') raise RuntimeError('Unable to determine version.')

View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = py35, py36, py37, {py35,py36,py37}-no-ext, flake8, check envlist = py35, py36, py37, {py35,py36,py37}-no-ext, lint, check
[testenv] [testenv]
usedevelop = True usedevelop = True
@ -21,12 +21,14 @@ commands =
- coverage combine --append - coverage combine --append
coverage report -m coverage report -m
[testenv:flake8] [testenv:lint]
deps = deps =
flake8 flake8
black
commands = commands =
flake8 sanic flake8 sanic
black --check --verbose sanic
[testenv:check] [testenv:check]
deps = deps =