-
Notifications
You must be signed in to change notification settings - Fork 727
Description
With clang-tidy-fix enabled we now can't use const shared pointers to const in subscription callbacks anymore (see https://travis-ci.com/github/ros-planning/moveit2/jobs/347903960#L809). Unfortunately, const references are not supported (ros2/rclcpp#281) so for now we basically have to pick one of the following options.
- Disable linting for all callback functions and use
callback(const Message::ConstSharedPtr msg) errors because of constcallback(const Message::SharedPtr msg)errors because of constcallback(Message::ConstSharedPtr msg)
I would opt for 2 since it's a rule that fits for all (also service callbacks and is closest to ROS 1 codebase) even though it's not really nice to have a non-const message access everywhere.
Update
So, apparently we need to disable clang-tidy rules to make this work. Do we want to do this on a case-by-case basis with // NOLINTNEXTLINE(performance-unnecessary-value-param) or project-wide? I would prefer keeping the rule enabled and keep an issue open to remove the lint ignores once const-ref callbacks are available. The only alternative we still have is to use fully non-const shared pointers, but I don't think we want to go that route.