Skip to content

tier4/pre-commit-hooks-ros

Repository files navigation

pre-commit-hooks-ros

ROS-related hooks for pre-commit

Usage

Write your .pre-commit-config.yaml as below.

repos:
  - repo: https://github.com/tier4/pre-commit-hooks-ros
    rev: v0.7.0
    hooks:
      - id: flake8-ros
      - id: prettier-xacro
      - id: prettier-launch-xml
      - id: prettier-package-xml
      - id: ros-include-guard
      - id: sort-package-xml

Hooks available

flake8-ros

Apply flake8 with the ROS 2 settings.

prettier-xacro

Apply Prettier with plugin-xml to xacro.

prettier-launch-xml

Apply Prettier with plugin-xml to launch.xml.

prettier-package-xml

Apply Prettier with plugin-xml to package.xml.

ros-include-guard

Fix the macro name of include guards.

sort-package-xml

Sort the dependent packages in package.xml. If you want to exclude a tag from sorting, add <! -- no format --> at the beginning of the line.

<!-- no format --> <depend>rclcpp</depend>