How to run clang-tidy sensibly
I'm trying to get clang-tidy running for my ROS2 project, and running into header issues depending on how I run it.
First, attempting to use ament_clang_tidy build/foo_module
exits with an unhelpful "error code 1"
Running the command that ament_clang_tidy builds results in error: too many errors emitted, stopping now [clang-diagnostic-error]
with a long list of errors in the /opt/ros/humble/include/rclcpp/rclcpp/
header files.
Next, running clang-tidy in the basic way clang-tidy -p build/foo_module src/foo_module/src/foo_module.cpp
results in the same errors as ament_clang_tidy.
Finally, running clang-tidy from this script seems to be unable to find my headers and the geometry_msgs header.
How do I run clang-tidy in a sensible way that doesn't give me all of the rclcpp (and any other ROS headers) errors.