Repository navigation
Clang Tidy to collision_detection and collision_detection_fcl - #693
BryceStevenWilley wants to merge 16 commits into
Conversation
davetcoleman
left a comment
There was a problem hiding this comment.
I'm exited about this upgrade!
| res.collision = false; | ||
| if (req.verbose) | ||
| logInform("Using AllValid collision detection. No collision checking is performed."); | ||
| CONSOLE_BRIDGE_logInform("Using AllValid collision detection. No collision checking is performed."); |
There was a problem hiding this comment.
why is this change necessary? we weren't getting deprecated / compatibility warnings were we? I see this file but would like to understand the backstory. This change reduces code readability.
There was a problem hiding this comment.
We were getting deprecated warnings, actually. The exact warning that clang gives is this:
/home/brycew/Desktop/moveit_ws/src/moveit/moveit_core/collision_detection/src/allvalid/collision_robot_allvalid.cpp:54:5: warning: 'log_deprecated' is deprecated [clang-diagnostic-deprecated-declarations]
logInform("Using AllValid collision detection. No collision checking is performed.");
^
/usr/include/console_bridge/console.h:96:19: note: expanded from macro 'logInform'
console_bridge::log_deprecated(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_INFO, fmt, ##__VA_ARGS__)
^
/usr/include/console_bridge/console.h:202:54: note: 'log_deprecated' has been explicitly marked deprecated here
CONSOLE_BRIDGE_DEPRECATED CONSOLE_BRIDGE_DLLAPI void log_deprecated(const char *file, int line, LogLevel level, const char* m, ...);
And looks like this file does deprecate the current version we're using unfortunately.
And from this pull request, it looks like logInform et al. are about to be removed soon.
| ``` | ||
| run-clang-tidy-3.8.py -fix -p=/home/brycew/Desktop/moveit_ws/build/moveit_core/ collision_detection | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Thanks for writing this up! I believe this documentation belongs on this page instead
There was a problem hiding this comment.
Thanks! I had a feeling there was a better place, but couldn't find where.
This has been moved to https://github.com/ros-planning/moveit.ros.org/pull/146
|
Just need one more reviewer |
|
Actually we should probably merge #662 otherwise there will undoubtably be major conflicts. |
|
Merged! Was surprisingly easy, only 3 or 4 clear-cut conflicts. |
This reverts commit b5d0e32.
|
That sounds good @rhaschke, went ahead and reverted that merge. |
rhaschke
left a comment
There was a problem hiding this comment.
It's much better to have this huge PR separated from another. Some variable choices of clang tidy are suboptimal and I ask you, to please check them an replace by more appropriate variables where suitable.
I marked some of those locations, but there are more probably.
| * @scale scale A common scaling to use for all objects/links on the robot | ||
| */ | ||
| CollisionRobot(const robot_model::RobotModelConstPtr& model, double padding = 0.0, double scale = 1.0); | ||
| CollisionRobot(robot_model::RobotModelConstPtr model, double padding = 0.0, double scale = 1.0); |
There was a problem hiding this comment.
Replacing const-ref by value argument is a suggestion of clang tidy??
This shouldn't be replaced.
There was a problem hiding this comment.
The reasons for the replacement are on this page: https://clang.llvm.org/extra/clang-tidy/checks/modernize-pass-by-value.html. Looks like it only does so for constructors at the moment.
Easy enough to turn off though, I will do so.
There was a problem hiding this comment.
Explanation makes sense in general. However, for shared ptrs, move-construction doesn't make sense. Usually you want to keep the pointer afterwards. So, no need to turn this feature off, but asking for manual validation of all changes (and reverting unnecessary ones).
| { | ||
| std::vector<std::string> u; | ||
| for (std::map<std::string, double>::const_iterator it = padding.begin(); it != padding.end(); ++it) | ||
| for (const auto& it : padding) |
There was a problem hiding this comment.
here the loop variable should be renamed to e.g. pair (it is misleading).
| { | ||
| std::vector<std::string> u; | ||
| for (std::map<std::string, double>::const_iterator it = scale.begin(); it != scale.end(); ++it) | ||
| for (const auto& it : scale) |
| { | ||
| std::vector<std::string> u; | ||
| for (std::size_t i = 0; i < padding.size(); ++i) | ||
| for (const auto& i : padding) |
|
Closing in favor of #731, which is a rebase of this PR completely removing the reverted merge. |
Description
As per #28, I setup and documented how to run clang-tidy on the codebase, and tested it on the collision_detection and collision_detection_fcl folders. I chose these two because they were small, so I could get feedback on what to change before applying to the entire repo.
The clang-tidy config file is based on https://github.com/davetcoleman/rviz_visual_tools/blob/kinetic-devel/.clang-tidy and adds some more checks to the code.
Checklist