-
Notifications
You must be signed in to change notification settings - Fork 569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subscription callbacks (clang-tidy vs. const-ref) #214
Comments
Why do you not consider
If you throw away I feel I'm repeating myself a lot: From my perspective porting MoveIt should show and address possible shortcomings in the lower layers of ROS2 as well. I'm not sure whether your grant disagrees, but I'm convinced @gavanderhoorn agrees with my point of view. |
That's considered, but not an option that solves the issue now.
Sure, if we know we can get that patch upstream soon. Otherwise, I would prefer just ignoring the check per case as in 1.
That's right, but as it turns out 2 and 3 are not valid options anyway as it also errors for the same reason. "Disabling the rule" is the winner.
Sure, I do as well |
It does, even if you need an ugly NOLINT hack or a forked version of an upstream dependency to bridge a transition period. If you consider upstream contributions not to solve problems (the "but we need it NOW" is true for all problems), there would not be any sense to contribute at all.
Well the reason it's not upstream yet (though reported years ago) is mostly because nobody wrote the patch... |
ros2/rclcpp#281 has been closed. Can we revisit this now that the problem has seemingly been fixed in rclcpp? |
... after moveit#214 was fixed in rclcpp.
I think we should. PRs are always welcome ;) |
I think this has been fixed with #1706 |
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.
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.The text was updated successfully, but these errors were encountered: