Skip to content

Commit

Permalink
Merge pull request #40 from jamescooke/linting-and-packages
Browse files Browse the repository at this point in the history
Linting and packages
  • Loading branch information
jamescooke committed Aug 20, 2018
2 parents 2094209 + 32a4b5d commit 0358b46
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 30 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ venv:
virtualenv venv --python=python3
venv/bin/pip install -U pip

venv2:
virtualenv venv2 --python=python2
venv/bin/pip install -U pip

venv/bin/pip-sync: venv
venv/bin/pip install pip-tools

Expand All @@ -22,7 +26,7 @@ lint:
@echo "=== flake8 ==="
flake8 $(lint_files) examples
@echo "=== pylint ==="
./run_pylint.sh
./run_pylint.sh flake8_aaa
@echo "=== isort ==="
isort --quiet --recursive --diff $(lint_files) > isort.out
if [ "$$(wc -l isort.out)" != "0 isort.out" ]; then cat isort.out; exit 1; fi
Expand Down
2 changes: 1 addition & 1 deletion flake8_aaa/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def load_act_block(self):
"""
act_blocks = ActBlock.build_body(self.node.body)

if len(act_blocks) < 1:
if not act_blocks:
raise ValidationError(self.node.lineno, self.node.col_offset, 'AAA01 no Act block found in test')

# Allow `pytest.raises` and `self.assertRaises()` in assert blocks - if
Expand Down
5 changes: 5 additions & 0 deletions requirements/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
objects = $(wildcard *.in)
outputs := $(objects:.in=.txt)
compile_cmd = ../venv/bin/pip-compile
compile_cmd2 = ../venv2/bin/pip-compile

.PHONY: all
all: $(outputs)
Expand All @@ -11,3 +12,7 @@ all: $(outputs)
# Dependency chain
test.txt: base.txt
dev.txt: test.txt

# Special command for python 2 requirements
test2.txt: base.txt test.in
$(compile_cmd2) -v --output-file test2.txt test.in
2 changes: 1 addition & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
asttokens>=1.1.10
asttokens>=1.1.11
flake8>=3
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# pip-compile --output-file base.txt base.in
#
asttokens==1.1.10
asttokens==1.1.11
flake8==3.5.0
mccabe==0.6.1 # via flake8
pycodestyle==2.3.1 # via flake8
Expand Down
30 changes: 16 additions & 14 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
# pip-compile --output-file dev.txt dev.in
#
alabaster==0.7.11
astroid==1.6.5
asttokens==1.1.10
astroid==2.0.4
asttokens==1.1.11
atomicwrites==1.1.5
attrs==18.1.0
babel==2.6.0
backcall==0.1.0 # via ipython
certifi==2018.4.16
certifi==2018.8.13
chardet==3.0.4
click==6.7 # via pip-tools
decorator==4.3.0 # via ipython, traitlets
Expand All @@ -22,45 +22,47 @@ idna==2.7
imagesize==1.0.0
ipdb==0.11
ipython-genutils==0.2.0 # via traitlets
ipython==6.4.0
ipython==6.5.0
isort==4.3.4
jedi==0.12.0 # via ipython
jedi==0.12.1 # via ipython
jinja2==2.10
lazy-object-proxy==1.3.1
markupsafe==1.0
mccabe==0.6.1
more-itertools==4.2.0
more-itertools==4.3.0
packaging==17.1
parso==0.2.1 # via jedi
parso==0.3.1 # via jedi
pathlib2==2.3.2
pexpect==4.6.0 # via ipython
pickleshare==0.7.4 # via ipython
pip-tools==2.0.2
pkginfo==1.4.2 # via twine
pluggy==0.6.0
pluggy==0.7.1
prompt-toolkit==1.0.15 # via ipython
ptyprocess==0.6.0 # via pexpect
py==1.5.4
pycodestyle==2.3.1
pyflakes==1.6.0
pygments==2.2.0
pylint==1.9.2
pylint==2.1.1
pyparsing==2.2.0
pytest-flake8dir==1.2.0
pytest==3.6.2
pytest==3.7.2
pytz==2018.5
requests-toolbelt==0.8.0 # via twine
requests==2.19.1
restructuredtext-lint==1.1.3
simplegeneric==0.8.1 # via ipython
six==1.11.0
snowballstemmer==1.2.1
sphinx-rtd-theme==0.4.0
sphinx==1.7.5
sphinx-rtd-theme==0.4.1
sphinx==1.7.7
sphinxcontrib-websupport==1.1.0
tox==3.0.0
tqdm==4.23.4 # via twine
tox==3.2.1
tqdm==4.24.0 # via twine
traitlets==4.3.2 # via ipython
twine==1.11.0
typed-ast==1.1.0
urllib3==1.23
virtualenv==16.0.0
wcwidth==0.1.7 # via prompt-toolkit
Expand Down
22 changes: 12 additions & 10 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
# pip-compile --output-file test.txt test.in
#
alabaster==0.7.11 # via sphinx
astroid==1.6.5 # via pylint
asttokens==1.1.10
astroid==2.0.4 # via pylint
asttokens==1.1.11
atomicwrites==1.1.5 # via pytest
attrs==18.1.0 # via pytest
babel==2.6.0 # via sphinx
certifi==2018.4.16 # via requests
certifi==2018.8.13 # via requests
chardet==3.0.4 # via requests
docutils==0.14 # via restructuredtext-lint, sphinx
flake8==3.5.0
Expand All @@ -21,26 +21,28 @@ jinja2==2.10 # via sphinx
lazy-object-proxy==1.3.1 # via astroid
markupsafe==1.0 # via jinja2
mccabe==0.6.1
more-itertools==4.2.0 # via pytest
more-itertools==4.3.0 # via pytest
packaging==17.1 # via sphinx
pluggy==0.6.0 # via pytest, tox
pathlib2==2.3.2 # via pytest
pluggy==0.7.1 # via pytest, tox
py==1.5.4 # via pytest, tox
pycodestyle==2.3.1
pyflakes==1.6.0
pygments==2.2.0
pylint==1.9.2
pylint==2.1.1
pyparsing==2.2.0 # via packaging
pytest-flake8dir==1.2.0
pytest==3.6.2
pytest==3.7.2
pytz==2018.5 # via babel
requests==2.19.1 # via sphinx
restructuredtext-lint==1.1.3
six==1.11.0
snowballstemmer==1.2.1 # via sphinx
sphinx-rtd-theme==0.4.0
sphinx==1.7.5
sphinx-rtd-theme==0.4.1
sphinx==1.7.7
sphinxcontrib-websupport==1.1.0 # via sphinx
tox==3.0.0
tox==3.2.1
typed-ast==1.1.0 # via astroid
urllib3==1.23 # via requests
virtualenv==16.0.0 # via tox
wrapt==1.10.11 # via astroid
Expand Down
56 changes: 56 additions & 0 deletions requirements/test2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file test2.txt test.in
#
alabaster==0.7.11 # via sphinx
astroid==1.6.5 # via pylint
asttokens==1.1.11
atomicwrites==1.1.5 # via pytest
attrs==18.1.0 # via pytest
babel==2.6.0 # via sphinx
backports.functools-lru-cache==1.5 # via astroid, pylint
certifi==2018.8.13 # via requests
chardet==3.0.4 # via requests
configparser==3.5.0 # via flake8, pylint
docutils==0.14 # via restructuredtext-lint, sphinx
enum34==1.1.6 # via astroid, flake8
flake8==3.5.0
funcsigs==1.0.2 # via pytest
futures==3.2.0 # via isort
idna==2.7 # via requests
imagesize==1.0.0 # via sphinx
isort==4.3.4
jinja2==2.10 # via sphinx
lazy-object-proxy==1.3.1 # via astroid
markupsafe==1.0 # via jinja2
mccabe==0.6.1
more-itertools==4.3.0 # via pytest
packaging==17.1 # via sphinx
pathlib2==2.3.2 # via pytest
pluggy==0.7.1 # via pytest, tox
py==1.5.4 # via pytest, tox
pycodestyle==2.3.1
pyflakes==1.6.0
pygments==2.2.0
pylint==1.9.3
pyparsing==2.2.0 # via packaging
pytest-flake8dir==1.2.0
pytest==3.7.2
pytz==2018.5 # via babel
requests==2.19.1 # via sphinx
restructuredtext-lint==1.1.3
scandir==1.9.0 # via pathlib2
singledispatch==3.4.0.3 # via astroid, pylint
six==1.11.0
snowballstemmer==1.2.1 # via sphinx
sphinx-rtd-theme==0.4.1
sphinx==1.7.7
sphinxcontrib-websupport==1.1.0 # via sphinx
tox==3.2.1
typing==3.6.4 # via sphinx
urllib3==1.23 # via requests
virtualenv==16.0.0 # via tox
wrapt==1.10.11 # via astroid
yapf==0.22.0
2 changes: 1 addition & 1 deletion run_pylint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ USAGE_ERROR=32
echo "> Raising on FATAL_MESSAGE, ERROR_MESSAGE, CONVENTION_MESSAGE, USAGE_ERROR"

set +e
pylint flake8_aaa
pylint "$1"
lint_code=$?
set -e

Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
envlist = py{27,36}-{install,test,lint}
[testenv]
deps =
test,lint: -rrequirements/test.txt
py36-{test,lint}: -rrequirements/test.txt
py27-{test,lint}: -rrequirements/test2.txt
commands =
install: flake8 --version
install: flake8 tests examples/good
Expand Down

0 comments on commit 0358b46

Please sign in to comment.