Skip to content

Commit f48cc9f

Browse files
committed
Configure linting and add to pyinvoke
1 parent f38b6e4 commit f48cc9f

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

CONTRIBUTING.rst

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ We love pull requests from everyone! Here's a quick guide to improve the code:
2929

3030
invoke test
3131

32-
7. Add yourself to ``AUTHORS.rst``.
33-
8. Commit your changes and push your branch to GitHub.
34-
9. Create a `pull request <https://help.github.com/articles/about-pull-requests/>`_ through the GitHub website.
32+
7. Check there are no linter errors:
33+
34+
::
35+
36+
invoke lint
37+
38+
8. Add yourself to ``AUTHORS.rst``.
39+
9. Commit your changes and push your branch to GitHub.
40+
10. Create a `pull request <https://help.github.com/articles/about-pull-requests/>`_ through the GitHub website.
3541

3642

3743
During development, use `pyinvoke <http://docs.pyinvoke.org/>`_ tasks on the
@@ -40,6 +46,7 @@ command prompt to ease recurring operations:
4046
* ``invoke clean``: Clean all generated artifacts.
4147
* ``invoke check``: Run various code and documentation style checks.
4248
* ``invoke docs``: Generate documentation.
49+
* ``invoke lint``: Run code linter for coding style checks.
4350
* ``invoke test``: Run all tests and checks in one swift command.
4451
* ``invoke``: Show available tasks.
4552

setup.cfg

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@ universal = 1
33

44
[flake8]
55
max-line-length = 180
6-
exclude = */migrations/*
6+
exclude =
7+
.git,
8+
__pycache__,
9+
docs,
10+
build,
11+
temp,
12+
dist,
13+
src/compas_fab/backends/vrep/remote_api/*,
14+
src/compas_fab/ghpython/path_planning.py
715

816
[tool:pytest]
917
testpaths = tests

tasks.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,24 @@ def docs(ctx, doctest=False, rebuild=False, check_links=False):
152152
ctx.run('sphinx-build -b linkcheck docs dist/docs')
153153

154154

155+
@task()
156+
def lint(ctx):
157+
"""Check the consistency of coding style."""
158+
log.write('Running flake8 python linter...')
159+
ctx.run('flake8 src')
160+
161+
155162
@task()
156163
def check(ctx):
157164
"""Check the consistency of documentation, coding style and a few other things."""
165+
lint(ctx)
166+
158167
log.write('Checking MANIFEST.in...')
159168
ctx.run('check-manifest --ignore-bad-ideas=remoteApi.so')
160169

161170
log.write('Checking ReStructuredText formatting...')
162171
ctx.run('python setup.py check --strict --metadata --restructuredtext')
163172

164-
# log.write('Running flake8 python linter...')
165-
# ctx.run('flake8 src setup.py')
166-
167173
# log.write('Checking python imports...')
168174
# ctx.run('isort --check-only --diff --recursive src tests setup.py')
169175

@@ -192,14 +198,10 @@ def deploy_docs(ctx):
192198

193199

194200
@task(help={
195-
'checks': 'True to run all checks before testing, otherwise False.',
196201
'doctest': 'True to run doctest modules, otherwise False.',
197202
})
198-
def test(ctx, checks=False, doctest=True):
203+
def test(ctx, doctest=True):
199204
"""Run all tests."""
200-
if checks:
201-
check(ctx)
202-
203205
if doctest:
204206
ctx.run('pytest --doctest-modules')
205207
else:

0 commit comments

Comments
 (0)