MetroRobots / ros_glint

Make your ROS code sparkle!
BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

Parse exception on service definition with whitespace #18

Closed Achllle closed 2 months ago

Achllle commented 2 months ago

I ran glint_ros on a set of ROS1 packages and got the following error.

Traceback (most recent call last):
  File "/usr/local/bin/glint_ros", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.8/site-packages/ros_glint/main.py", line 123, in main
    pkgs = list(find_packages(args.folder))
  File "/usr/local/lib/python3.8/dist-packages/ros_introspect/package.py", line 270, in find_packages
    yield Package(package_root)
  File "/usr/local/lib/python3.8/dist-packages/ros_introspect/package.py", line 151, in __init__
    self.add_file(infer_package_file(root / subpath, self))
  File "/usr/local/lib/python3.8/dist-packages/ros_introspect/package.py", line 129, in infer_package_file
    return subtype(path, package)
  File "/usr/local/lib/python3.8/dist-packages/ros_introspect/components/ros_interface.py", line 89, in __init__
    self.sections[-1].add_line(line)
  File "/usr/local/lib/python3.8/dist-packages/ros_introspect/components/ros_interface.py", line 69, in add_line
    raise Exception('Unable to parse interface line: ' + repr(line))  # pragma: no cover
Exception: Unable to parse interface line: '--- '

When I ran grep -r -e "--- " in the same directory, I found that it was erroring out because of a trailing white space in a .srv file's request - response divider ---.

The error message could probably be improved / fixed as it's not part of the linting output.

Achllle commented 2 months ago

This doesn't seem to be fixed yet. pip3 show ros_introspect --> Version: 0.2.2

I'm getting the exact same error.

Stepts to repro:

catkin_create_pkg test_pkg
mkdir -p test_pkg/srv
echo "--- " > test_pkg/srv/test.srv
glint_ros
DLu commented 2 months ago

I fixed the bug properly, but I did the release badly. Following your steps ros_introspect v0.2.3 works.