Skip to content

Commit 1733b83

Browse files
committed
Add flake8 linting.
Modify .travis.yml so that it uses Makefile to test and lint.
1 parent 3e6700d commit 1733b83

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

.travis.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ before_script:
3636
jobs:
3737
include:
3838
- stage: test
39-
name: "Black Formatting"
39+
name: "Code Formatting"
4040
python: 3.6
4141
script:
42-
- pip install black
43-
- black --check .
42+
- make lint
4443
- stage: test
4544
name: "Type Check"
4645
python: 3.6
@@ -52,7 +51,7 @@ jobs:
5251
name: "Test 3.5"
5352
python: "3.5"
5453
script:
55-
- py.test tests --cov rasa -v
54+
- make test
5655
- <<: *run-tests
5756
name: "Test 3.6"
5857
python: '3.6'

Makefile

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
.PHONY: clean test lint init check-readme
22

3-
TEST_PATH=./
4-
53
help:
64
@echo " clean"
75
@echo " Remove python artifacts and build artifacts."
6+
@echo " formatter"
7+
@echo " Apply black formatting to code."
88
@echo " lint"
99
@echo " Check style with flake8."
10+
@echo " types"
11+
@echo " Check for type errors using pytype."
1012
@echo " test"
1113
@echo " Run py.test"
1214
@echo " check-readme"
1315
@echo " Check if the readme can be converted from md to rst for pypi"
14-
@echo " init"
15-
@echo " Install Rasa Core"
16-
17-
init:
18-
pip install -r requirements.txt
1916

2017
clean:
2118
find . -name '*.pyc' -exec rm -f {} +
@@ -24,22 +21,28 @@ clean:
2421
rm -rf build/
2522
rm -rf .pytype/
2623
rm -rf dist/
27-
rm -rf *.egg-info
2824
rm -rf docs/_build
2925

26+
formatter:
27+
black rasa tests
28+
29+
# TODO: Remove '--exit-zero'
3030
lint:
31-
black .
31+
flake8 rasa tests --exit-zero
32+
black --check rasa tests
33+
34+
types:
35+
pytype --keep-going rasa
3236

3337
test: clean
34-
py.test tests --verbose --color=yes $(TEST_PATH)
35-
black --check .
38+
py.test tests --cov rasa
3639

3740
doctest: clean
3841
cd docs && make doctest
3942

4043
livedocs:
4144
cd docs && make livehtml
4245

46+
# if this runs through we can be sure the readme is properly shown on pypi
4347
check-readme:
44-
# if this runs through we can be sure the readme is properly shown on pypi
4548
python setup.py check --restructuredtext --strict

requirements-dev.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ nbsphinx==0.3.2
1212
aioresponses==0.6.0
1313
moto==1.3.8
1414

15+
# lint/format
16+
black==19.3b0; python_version>='3.6'
17+
flake8==3.7.7
18+
1519
# pipeline dependencies
1620
spacy==2.1.4
1721
jieba==0.39

setup.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ log_cli_level = DEBUG
2020
[metadata]
2121
description-file = README.md
2222
license_file = LICENSE.txt
23+
24+
[flake8]
25+
max-line-length = 88
26+
ignore = W503, E121, E126, E211, E225, E501, E203, W391, E402

0 commit comments

Comments
 (0)