You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OMPL has been upgrading its code to be faster, follow best practices, and use C++11 by using the automated tool clang-tidy. Would be great to use this linter tool here too.
It consists of lots of individual checks that will propose or even alter the code. I think each check should be run separate with individual pull requests to the codebase.
clang-tidy uses auto in loop, we have to hand change those to be the full types (PR ready, I plan on opening it after Clang Tidy naming #917 is merged)
I have no idea how to to the final task of putting this in travis, and I think that would be the best aspect for additional work. Applying to all of MoveIt will be a little cumbersome and will take a while.
Some more elaboration on these next steps. Personally can't spare any cycles for this soon, so anyone can feel free to work on this!
Apply clang-tidy to the entire codebase. Mostly, that would be going through all of the MoveIt! package's CMakeLists.txt files and adding set(CMAKE_EXPORT_COMPILE_COMMANDS ON) (as seen here). I'm honestly not sure about the performance effects of setting this project wide, most likely it should become a flag/setting used when first setting up MoveIt! (see the docs). Once that's figured out, simply build all of MoveIt! and run run-clang-tidy-3.9.py -fix -p=$HOME/moveit_ws/build/moveit_core/ <package_path> for each package (as specified in the docs). Then try to merge the very-large PR.
Put clang-tidy in the travis checks. It should look similar to the check clang format script. However, it should mostly likely run after catkin build is run in travis, probably at the end of the file. clang-tidy should run without the -fix flag, just like we do with clang-format. Should be aware of how long it takes to run: I know the travis time budget is already restrictive for us, I'm not sure if it will finish the checks in time.
Add the last two requested checks: readability-inconsistent-declaration-parameter-name and modernize-loop-convert. Most of the discussion is in this PR, but in short, we like converting loops, but don't like auto (not as readable), and if we're changing parameter names, we might as well make them more readable. These changes will have to be manual: we can turn them on, run clang-tidy, and then go through the codebase and change back all of the autos that it adds to the actual types, etc. The good news is that once everything is changed, clang-tidy won't complain (i.e. it doesn't replace the actual typenames with auto again). I think it's more important to get clang-tidy running in the build before all these manual changes occur though.
Activity
davetcoleman commentedon Oct 17, 2017
I think this would be a great moveit day project to start. Just found an example config from a similar project
v4hn commentedon Oct 17, 2017
👍 We could definitely use such a cleanup and these patches are very much welcome.
Merge pull request #731 from ros-planning/pr-clang-tidy-collision
jconley88 commentedon Oct 25, 2018
Is there additional work to be done for this?
It looks like a clang PR was already merged in.
BryceStevenWilley commentedon Oct 25, 2018
I've been working on applying clang-tidy to the code base. A current roadmap is something like this:
clang-tidyto the entirety of MoveIt (it's been restricted tomoveit_corewhile we iron out the exact style guidelines).clang-tidycheck in the travis checks somehow. Edit: wip https://github.com/ros-planning/moveit_ci/pull/45clang-tidyuses auto in loop, we have to hand change those to be the full types (PR ready, I plan on opening it after Clang Tidy naming #917 is merged)I have no idea how to to the final task of putting this in travis, and I think that would be the best aspect for additional work. Applying to all of MoveIt will be a little cumbersome and will take a while.davetcoleman commentedon Oct 26, 2018
@BryceStevenWilley awesome. Note that all these kinds of changes should now target Melodic, of course
BryceStevenWilley commentedon Jan 5, 2019
Some more elaboration on these next steps. Personally can't spare any cycles for this soon, so anyone can feel free to work on this!
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)(as seen here). I'm honestly not sure about the performance effects of setting this project wide, most likely it should become a flag/setting used when first setting up MoveIt! (see the docs). Once that's figured out, simply build all of MoveIt! and runrun-clang-tidy-3.9.py -fix -p=$HOME/moveit_ws/build/moveit_core/ <package_path>for each package (as specified in the docs). Then try to merge the very-large PR.catkin buildis run in travis, probably at the end of the file.clang-tidyshould run without the-fixflag, just like we do withclang-format. Should be aware of how long it takes to run: I know the travis time budget is already restrictive for us, I'm not sure if it will finish the checks in time.readability-inconsistent-declaration-parameter-nameandmodernize-loop-convert. Most of the discussion is in this PR, but in short, we like converting loops, but don't likeauto(not as readable), and if we're changing parameter names, we might as well make them more readable. These changes will have to be manual: we can turn them on, run clang-tidy, and then go through the codebase and change back all of theautos that it adds to the actual types, etc. The good news is that once everything is changed, clang-tidy won't complain (i.e. it doesn't replace the actual typenames withautoagain). I think it's more important to get clang-tidy running in the build before all these manual changes occur though.BryceStevenWilley commentedon Apr 24, 2019
With #1394 merged, I think this issue can be closed. @davetcoleman?
We could also do clang-tidy on the other upstream ros-planning repos. If we want to, I can make issues in those repos.
davetcoleman commentedon Apr 30, 2019
Yes I think you and everyone else has done a great job with this!
Port moveit_msgs actions (moveit#28)
fix broken maintainer tags (moveit#28)