ROS-related hooks for pre-commit
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
Apply flake8 with the ROS 2 settings.
Apply Prettier with plugin-xml to xacro.
Apply Prettier with plugin-xml to launch.xml.
Apply Prettier with plugin-xml to package.xml.
Fix the macro name of include guards.
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>