Skip to content

Commit 5e90943

Browse files
authored
Merge pull request #88 from compas-dev/linting
Enforce code linting
2 parents 58f0cb9 + 2424a19 commit 5e90943

34 files changed

+200
-403
lines changed

.github/pull_request_template.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@
77
- [ ] Bug fix in a **backwards-compatible** manner.
88
- [ ] New feature in a **backwards-compatible** manner.
99
- [ ] Breaking change: bug fix or new feature that involve incompatible API changes.
10+
- [ ] Other (e.g. doc update, configuration, etc)
1011

1112
### Checklist
1213

13-
1. [ ] Add the change to the `CHANGELOG.rst` file in the `Unreleased` section under the most fitting heading: `Added`, `Changed`, `Removed`.
14-
1. [ ] Run all tests on your computer (i.e. `invoke test`).
15-
1. [ ] If you add new functions/classes, check that:
16-
1. [ ] Are available on a second-level import, e.g. `compas_fab.robots.Configuration`.
17-
1. [ ] Add unit tests (especially important for algorithm implementations).
14+
_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._
15+
16+
- [ ] I added a line to the `CHANGELOG.rst` file in the `Unreleased` section under the most fitting heading (e.g. `Added`, `Changed`, `Removed`).
17+
- [ ] I ran all tests on my computer and it's all green (i.e. `invoke test`).
18+
- [ ] I ran lint on my computer and there are no errors (i.e. `invoke lint`) .
19+
- [ ] I added new functions/classes and made them available on a second-level import, e.g. `compas_fab.robots.Configuration`.
20+
- [ ] I have added tests that prove my fix is effective or that my feature works.
21+
- [ ] I have added necessary documentation (if appropriate)

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ script:
5353
- python -c "from compas_fab.backends.vrep.remote_api import vrep"
5454
- python -c "import compas_fab.robots"
5555
- python -c "import compas_fab.utilities"
56-
- pytest
56+
- invoke lint
57+
- invoke test --no-doctest
5758
- if [[ "$TRAVIS_GENERATE_DOCS" == "true" ]]; then
5859
invoke docs;
5960
fi

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

src/compas_fab/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@
2525

2626
import os
2727

28-
from .__version__ import __author__, __author_email__, __copyright__, __description__, __license__, __title__, __url__, __version__
28+
from .__version__ import __author__
29+
from .__version__ import __author_email__
30+
from .__version__ import __copyright__
31+
from .__version__ import __description__
32+
from .__version__ import __license__
33+
from .__version__ import __title__
34+
from .__version__ import __url__
35+
from .__version__ import __version__
2936

3037
HERE = os.path.dirname(__file__)
3138
DATA = os.path.abspath(os.path.join(HERE, 'data'))

src/compas_fab/backends/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@
5050
5151
"""
5252

53-
from .exceptions import *
54-
from .tasks import *
55-
from .ros.client import *
56-
from .ros.exceptions import *
57-
from .ros.fileserver_loader import *
58-
from .vrep.client import *
53+
from .exceptions import * # noqa: F401,F403
54+
from .tasks import * # noqa: F401,F403
55+
from .ros.client import * # noqa: F401,F403
56+
from .ros.exceptions import * # noqa: F401,F403
57+
from .ros.fileserver_loader import * # noqa: F401,F403
58+
from .vrep.client import * # noqa: F401,F403
5959

6060
__all__ = [name for name in dir() if not name.startswith('_')]

src/compas_fab/backends/ros/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919

2020
from __future__ import absolute_import
2121

22-
from .client import *
23-
from .exceptions import *
24-
from .fileserver_loader import *
25-
from .direct_ur_action_client import *
26-
from .messages import *
22+
from .client import * # noqa: F401,F403
23+
from .exceptions import * # noqa: F401,F403
24+
from .fileserver_loader import * # noqa: F401,F403
25+
from .direct_ur_action_client import * # noqa: F401,F403
26+
from .messages import * # noqa: F401,F403
2727

2828
__all__ = [name for name in dir() if not name.startswith('_')]

src/compas_fab/backends/ros/client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ def load_robot(self, load_geometry=False, urdf_param_name='/robot_description',
169169

170170
return Robot(model, semantics=semantics, client=self)
171171

172-
173172
def inverse_kinematics(self, frame, base_link, group,
174173
joint_names, joint_positions, avoid_collisions=True,
175174
constraints=None, attempts=8,
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
from __future__ import absolute_import
22

3-
from .actionlib_msgs import *
4-
from .control_msgs import *
5-
from .geometry_msgs import *
6-
from .moveit_msgs import *
7-
from .object_recognition_msgs import *
8-
from .octomap_msgs import *
9-
from .sensor_msgs import *
10-
from .shape_msgs import *
11-
from .std_msgs import *
12-
from .trajectory_msgs import *
13-
14-
from .services import *
3+
from .actionlib_msgs import * # noqa: F401,F403
4+
from .control_msgs import * # noqa: F401,F403
5+
from .geometry_msgs import * # noqa: F401,F403
6+
from .moveit_msgs import * # noqa: F401,F403
7+
from .object_recognition_msgs import * # noqa: F401,F403
8+
from .octomap_msgs import * # noqa: F401,F403
9+
from .sensor_msgs import * # noqa: F401,F403
10+
from .services import * # noqa: F401,F403
11+
from .shape_msgs import * # noqa: F401,F403
12+
from .std_msgs import * # noqa: F401,F403
13+
from .trajectory_msgs import * # noqa: F401,F403

src/compas_fab/backends/ros/messages/actionlib_msgs.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@
44
from .std_msgs import Header
55
from .std_msgs import Time
66

7+
78
class GoalID(ROSmsg):
89
"""http://docs.ros.org/api/actionlib_msgs/html/msg/GoalID.html
910
"""
11+
1012
def __init__(self, stamp=Time(), id=""):
1113
self.stamp = stamp
1214
self.id = id
13-
15+
1416
@classmethod
1517
def from_msg(cls, msg):
1618
stamp = Time.from_msg(msg['stamp'])
1719
id = msg['id']
1820
return cls(stamp, id)
1921

22+
2023
class GoalStatus(ROSmsg):
2124
"""http://docs.ros.org/api/actionlib_msgs/html/msg/GoalStatus.html
2225
"""
@@ -36,7 +39,7 @@ def __init__(self, goal_id=GoalID(), status=0, text=''):
3639
self.goal_id = goal_id
3740
self.status = status
3841
self.text = text
39-
42+
4043
@classmethod
4144
def from_msg(cls, msg):
4245
goal_id = GoalID.from_msg(msg['goal_id'])
@@ -52,18 +55,21 @@ def human_readable(self):
5255
return k
5356
return ''
5457

58+
5559
class GoalStatusArray(ROSmsg):
5660
"""http://docs.ros.org/api/actionlib_msgs/html/msg/GoalStatusArray.html
5761
"""
62+
5863
def __init__(self, header=Header(), status_list=[]):
5964
self.header = header
6065
self.status_list = status_list
6166

67+
6268
"""
6369
rostopic info /follow_joint_trajectory/cancel
6470
Type: actionlib_msgs/GoalID
6571
6672
rostopic info /follow_joint_trajectory/status
6773
Type: actionlib_msgs/GoalStatusArray
6874
69-
"""
75+
"""

0 commit comments

Comments
 (0)