Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments more comments! #18

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Comments more comments! #18

wants to merge 3 commits into from

Conversation

Guelakais
Copy link

added more pydoc comments

Copy link
Collaborator

@luca-della-vedova luca-della-vedova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite have the rights to approve the run of the workflow but I tested locally and this makes the CI linter fail:

$ cat build/colcon-ros-cargo/pytest.xml
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="colcon-ros-cargo" errors="0" failures="1" skipped="0" tests="1" time="0.575" timestamp="2024-07-01T09:53:04.257939" hostname="ros.lucadv1"><testcase classname="colcon-ros-cargo.test.test_flake8" name="test_flake8" time="0.468"><failure message="AssertionError: flake8 reported 56 errors&#10;assert not 56">test/test_flake8.py:53: in test_flake8
    assert not total_errors, f'flake8 reported {total_errors} errors'
E   AssertionError: flake8 reported 56 errors
E   assert not 56</failure></testcase></testsuite></testsuites>

I suspect this is due to the line splits being reverted for long lines, the quote style going from single to double.
Can you make sure your PR doesn't make colcon test fail for this package?

@Guelakais
Copy link
Author

Guelakais commented Jul 1, 2024

if your linter can't tell you exactly where errors occur, it's difficult to do anything about it. I can't just change things at the drop of a hat.
So I got the following output with colcon test:

root@steamdeck:/ros_debug_ws/src/colcon-ros-cargo# colcon test
Starting >>> colcon-ros-cargo
[0.897s] ERROR:colcon.colcon_core.task.python.test:Failed to find the following files:
- /ros_debug_ws/src/colcon-ros-cargo/install/colcon-ros-cargo/share/colcon-ros-cargo/package.sh
Check that the following packages have been built:
- colcon-ros-cargo
Failed   <<< colcon-ros-cargo [0.01s, exited with code 1]

Summary: 0 packages finished [0.71s]
  1 package failed: colcon-ros-cargo

To be honest, this output leaves me rather perplexed. The said package.sh does not exist and as far as I can see, this file should not exist either.

@luca-della-vedova
Copy link
Collaborator

Hem OK, that came up a bit rude but I'm sure that wasn't the intention.

The comments are great but your PR does a lot of other changes that are unrelated, make the diff explode and are actually the main reason the code style test is failing.
For example why did you change all the single quotes to double quotes? Why did you change the line breaks?

Before trying to run colcon test did you colcon build as well? Also usually you would run these from the root of your workspace not from inside the package in the src folder.

Anyway the test itself is a flake8 check with a few suppressed warnings, you can also run it as a CLI utility, this is in your branch:

$:~/colcon_ws/src/colcon-ros-cargo$ flake8
./colcon_ros_cargo/__init__.py:1:1: D104 Missing docstring in public package
./colcon_ros_cargo/package_identification/__init__.py:1:1: D104 Missing docstring in public package
./colcon_ros_cargo/package_identification/ament_cargo.py:1:1: D100 Missing docstring in public module
./colcon_ros_cargo/package_identification/ament_cargo.py:3:80: E501 line too long (80 > 79 characters)
./colcon_ros_cargo/package_identification/ament_cargo.py:4:80: E501 line too long (82 > 79 characters)
./colcon_ros_cargo/package_identification/ament_cargo.py:17:74: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/package_identification/ament_cargo.py:24:80: E501 line too long (87 > 79 characters)
./colcon_ros_cargo/package_identification/ament_cargo.py:25:80: E501 line too long (89 > 79 characters)
./colcon_ros_cargo/package_identification/ament_cargo.py:26:80: E501 line too long (85 > 79 characters)
./colcon_ros_cargo/package_identification/ament_cargo.py:30:80: E501 line too long (80 > 79 characters)
./colcon_ros_cargo/package_identification/ament_cargo.py:32:59: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/package_identification/ament_cargo.py:35:38: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/package_identification/ament_cargo.py:39:39: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/package_identification/ament_cargo.py:43:25: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/package_identification/ament_cargo.py:47:33: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/package_identification/ament_cargo.py:48:31: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/package_identification/ament_cargo.py:48:80: E501 line too long (80 > 79 characters)
./colcon_ros_cargo/package_identification/ament_cargo.py:49:31: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/package_identification/ament_cargo.py:50:31: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/__init__.py:1:1: D104 Missing docstring in public package
./colcon_ros_cargo/task/ament_cargo/__init__.py:1:1: D104 Missing docstring in public package
./colcon_ros_cargo/task/ament_cargo/build.py:1:1: D100 Missing docstring in public module
./colcon_ros_cargo/task/ament_cargo/build.py:40:80: E501 line too long (80 > 79 characters)
./colcon_ros_cargo/task/ament_cargo/build.py:44:71: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:57:13: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:58:20: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:59:18: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:60:13: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:61:13: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:62:13: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:101:13: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:104:13: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:106:18: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:112:39: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:115:13: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:116:13: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:118:13: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:119:13: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:121:13: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:123:13: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:133:22: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:134:16: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:134:26: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:135:31: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:137:42: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:139:51: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:150:37: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:153:13: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:154:13: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:162:22: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:162:32: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:162:48: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:162:67: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:162:80: E501 line too long (81 > 79 characters)
./colcon_ros_cargo/task/ament_cargo/build.py:171:27: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:171:43: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:191:56: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:194:56: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:198:14: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:200:56: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:201:35: Q000 Double quotes found but single quotes preferred
./colcon_ros_cargo/task/ament_cargo/build.py:201:46: Q000 Double quotes found but single quotes preferred
./setup.py:1:1: D100 Missing docstring in public module
./test/test_flake8.py:1:1: D100 Missing docstring in public module
./test/test_flake8.py:12:1: D103 Missing docstring in public function

By contrast this is what it currently outputs on main:

$:~/colcon_ws/src/colcon-ros-cargo$ flake8 .
./colcon_ros_cargo/__init__.py:1:1: D104 Missing docstring in public package
./colcon_ros_cargo/package_identification/__init__.py:1:1: D104 Missing docstring in public package
./colcon_ros_cargo/package_identification/ament_cargo.py:1:1: D100 Missing docstring in public module
./colcon_ros_cargo/task/__init__.py:1:1: D104 Missing docstring in public package
./colcon_ros_cargo/task/ament_cargo/__init__.py:1:1: D104 Missing docstring in public package
./colcon_ros_cargo/task/ament_cargo/build.py:1:1: D100 Missing docstring in public module
./setup.py:1:1: D100 Missing docstring in public module
./test/test_flake8.py:1:1: D100 Missing docstring in public module
./test/test_flake8.py:12:1: D103 Missing docstring in public function

Note that the test_flake8.py suppresses these issues, so it ends up being green.
As you can see there are a lot more issues introduced, I suspect they would all be fixed if you just reverted all the spurious changes and only left the new comments.

@Guelakais
Copy link
Author

I also wanted to modernise the code. Then, when I get round to it, I'll just delete all the commits that change the code and push it again. Basically, the python interpreter doesn't care whether you make single or double quotes, for example. For Python, there is only one str data type for letter sequences, which is then cast against the actual corresponding c data type via ducktyping.

@@ -34,10 +34,25 @@ class AmentCargoBuildTask(CargoBuildTask):
"""

def __init__(self): # noqa: D107
"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is just a line-by-line read of the code, doesn't add anything

@esteve
Copy link
Collaborator

esteve commented Aug 29, 2024

@Guelakais

if your linter can't tell you exactly where errors occur, it's difficult to do anything about it. I can't just change things at the drop of a hat.

Watch your tone, @luca-della-vedova gave you constructive feedback.

The linter we use is the most common one (flake8), familiarize yourself with the Python tooling and conventions (pep8), and next time try to be more polite. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants