Skip to content

botsandus/ament_lint_pre_commit

Repository files navigation

ament_link pre-commit hooks

How to use the github action in a workflow

jobs:
  style:
    runs-on: ubuntu-latest
    container:
      image: ros:iron-ros-base
      options: --user 1001:127 # TODO: Fix this crap
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with: { python-version: "3.10" }
      - uses: nachovizzo/[email protected]

Supported hooks

For the time being, all the hooks, with the exception of ament-black must be system-wide available. This means that pre-commit will not attempt to install it, but rather use a binary that is visible in the $PATH. I tried an alternative solution, like publishing the python packages to the pypi.org registry, but this comes with the additional burden of having to manually release new packages every time there is an update on the ROS mainstream repositories. For now, we keep it simple by just using the available ament linters. In the future, it would be ideal to just rely on pure python packages so the pre-commit hook can be run on any non-ros environment.

  • ament_black
  • ament_cpplint
  • ament_flake8
  • ament_lint_cmake
  • ament_pep257
  • ament_uncrustify
  • ament_xmllint

Unsupported hooks

The fact that are unspotted does not mean that they don't work, it only means I haven't tested it so far and therefore are not part of the .pre-commit-hooks.yaml config.

  • ament_mypy
  • ament_pclint
  • ament_pycodestyle
  • ament_pyflakes
  • ament_clang_format
  • ament_clang_tidy
  • ament_copyright
  • ament_cppcheck
  • ament_lint