Skip to content

Conversation

@Nils-ChristianIseke
Copy link
Contributor

@Nils-ChristianIseke Nils-ChristianIseke commented Mar 20, 2025

Note:
The code changes are currently preliminary and not yet finalized. I’m not seeking feedback on the implementation at this stage.

ament_ruff
I’m new to ament_lint, so I’m not fully aware of all the implications of adding a new tool. I wanted to use this as a starting point to settle the discussion on whether we should support Ruff. Feel free to get the discussion rolling before I invest much effort into it! :)

There has already been a discussion on this topic on ROS Discourse:
Recommended Way to Format Python Code

This PR aims to adds ament_ruff, a fast and modern Python linting and formatting tool, to ament_lint. Ruff combines the functionality of ament_flake8, ament-pydocstyle, ament_pyflakes, ament_pep257 into a single, high-performance tool, simplifying the toolchain and improving developer productivity.

Key Benefits:

  • Speed: Ruff is significantly faster than Flake8 and Black.
  • All-in-One: Combines linting and formatting in one tool.

Signed-off-by: Nils-Christian Iseke <[email protected]>
@christophebedard
Copy link
Member

See this relevant issue: #497

@DangitBen
Copy link

Not trying to advertise, but there is now an ament_ruff package and accompanying cmake hook package (discourse post here). It could be used as a starting point for this PR, or as-is by users via source or pip (cli tool only).

The repo I linked could still use:

  • Some better error reporting to pytest
  • More testing and feedback from users with large python ros packages
    • Especially to see how it works as a drop-in for ament_flake8
  • A better/more confidence inspiring pypi page
  • A way to install the ament_cmake_ruff portion of the tool

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