ament / ament_lint

Apache License 2.0
38 stars 107 forks source link

ament_flake8 fails with flake8>=6.0.0 #460

Closed nwn closed 11 months ago

nwn commented 1 year ago

After upgrading to flake8 version 6.0.0, we see the following error when running ament_flake8:

Traceback (most recent call last):
  File "/NIX/STORE/RKGSHK3W2KKRGX8CZ33F0GMR4YCM4I9H-ament_flake8/bin/ament_flake8", line 33, in <module>
    sys.exit(load_entry_point('ament-flake8==0.15.1', 'console_scripts', 'ament_flake8')())
  File "/NIX/STORE/RKGSHK3W2KKRGX8CZ33F0GMR4YCM4I9H-ament_flake8/lib/python3.10/site-packages/ament_flake8/main.py", line 31, in main
    rc, _ = main_with_errors(argv=argv)
  File "/NIX/STORE/RKGSHK3W2KKRGX8CZ33F0GMR4YCM4I9H-ament_flake8/lib/python3.10/site-packages/ament_flake8/main.py", line 88, in main_with_errors
    report = generate_flake8_report(
  File "/NIX/STORE/RKGSHK3W2KKRGX8CZ33F0GMR4YCM4I9H-ament_flake8/lib/python3.10/site-packages/ament_flake8/main.py", line 231, in generate_flake8_report
    opts, _ = parse_config_file(config_file)
  File "/NIX/STORE/RKGSHK3W2KKRGX8CZ33F0GMR4YCM4I9H-ament_flake8/lib/python3.10/site-packages/ament_flake8/main.py", line 199, in parse_config_file
    opts_manager = manager.OptionManager(
TypeError: OptionManager.__init__() missing 1 required keyword-only argument: 'formatter_names'

The problem comes from this initializer, which doesn't include the new formatter_names parameter added in version 6.0.0. It shouldn't be too difficult to fix this in a version dependent way as is already done in that function. However, there may be more breakages that appear beyond this point.

For now, sticking with flake8 version 5.0.4 resolves the issue.

abrzozowski commented 12 months ago

Take a look at https://github.com/ament/ament_lint/pull/459

clalancette commented 11 months ago

Closing this since it was solved with #459

Ryanf55 commented 10 months ago

When will this make it into humble binaries? This bug is preventing me from passing tests in launch_ros.

$ apt show ros-humble-ament-flake8
Package: ros-humble-ament-flake8
Version: 0.12.9-1jammy.20231117.163433
Priority: optional
Section: misc
Maintainer: Michael Jeronimo <michael.jeronimo@openrobotics.org>
Installed-Size: 62.5 kB
Depends: python3-flake8, ros-humble-ament-lint, ros-humble-ros-workspace
Download-Size: 15.4 kB
APT-Manual-Installed: no
APT-Sources: http://packages.ros.org/ros2/ubuntu jammy/main amd64 Packages
Description: The ability to check code for style and syntax conventions with flake8.

Looks like @clalancette only updated rosdistro for rolling. https://github.com/ros/rosdistro/pull/39385

abrzozowski commented 10 months ago

@Ryanf55 Check the latest commit from the humble branch https://github.com/ament/ament_lint/commits/humble/

The change is already there, but it's not tagged. So, it's probably not released, but I don't know how often releases are performed.

Ryanf55 commented 10 months ago

@Ryanf55 Check the latest commit from the humble branch https://github.com/ament/ament_lint/commits/humble/

The change is already there, but it's not tagged. So, it's probably not released, but I don't know how often releases are performed.

Yep. I tried spinning the release myself but hit problems with bloom. Hopefully a maintainer can make a release soon.