Skip to content

Commit 12477c9

Browse files
committed
Run black --check as part of CI to enforce code style
1 parent 69ad22c commit 12477c9

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ install:
1111
- pip install -r requirements-dev.txt
1212
# mypy can't be installed on pypy
1313
- if [[ "${TRAVIS_PYTHON_VERSION}" != "pypy"* ]] ; then pip install mypy ; fi
14+
- if [[ "${TRAVIS_PYTHON_VERSION}" != *"3.5"* ]] ; then pip install black ; fi
1415
script:
1516
- make ci
1617
after_success:

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
.PHONY: all virtualenv
22
MAX_LINE_LENGTH=110
33
PYTHON_IMPLEMENTATION:=$(shell python -c "import sys;import platform;sys.stdout.write(platform.python_implementation())")
4+
PYTHON_VERSION:=$(shell python -c "import sys;sys.stdout.write('%d.%d' % sys.version_info[:2])")
45

56
LINT_TARGETS:=flake8
7+
68
ifneq ($(findstring PyPy,$(PYTHON_IMPLEMENTATION)),PyPy)
79
LINT_TARGETS:=$(LINT_TARGETS) mypy
810
endif
11+
ifneq ($(findstring 3.5,$(PYTHON_VERSION)),3.5)
12+
LINT_TARGETS:=$(LINT_TARGETS) black_check
13+
endif
914

1015

1116
virtualenv: ./env/requirements.built
@@ -26,6 +31,10 @@ lint: $(LINT_TARGETS)
2631
flake8:
2732
flake8 --max-line-length=$(MAX_LINE_LENGTH) examples *.py
2833

34+
.PHONY: black_check
35+
black_check:
36+
black --check .
37+
2938
mypy:
3039
mypy examples/*.py test_zeroconf.py zeroconf.py
3140

0 commit comments

Comments
 (0)