Skip to content

Apply clang-tidy code linter #28

Closed

Description

@davetcoleman

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.

Activity

  1. added
    simple improvements
    on Aug 8, 2016
  2. added
    moveit day candidate
    on Oct 17, 2017
  3. davetcoleman commented on Oct 17, 2017

    @davetcoleman
    MemberAuthor

    I think this would be a great moveit day project to start. Just found an example config from a similar project

  4. v4hn commented on Oct 17, 2017

    @v4hn
    Contributor

    👍 We could definitely use such a cleanup and these patches are very much welcome.

  5. added a commit that references this issue on Dec 29, 2017
  6. jconley88 commented on Oct 25, 2018

    @jconley88

    Is there additional work to be done for this?

    It looks like a clang PR was already merged in.

  7. BryceStevenWilley commented on Oct 25, 2018

    @BryceStevenWilley
    Contributor

    I've been working on applying clang-tidy to the code base. A current roadmap is something like this:

    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.

  8. davetcoleman commented on Oct 26, 2018

    @davetcoleman
    MemberAuthor

    @BryceStevenWilley awesome. Note that all these kinds of changes should now target Melodic, of course

  9. BryceStevenWilley commented on Jan 5, 2019

    @BryceStevenWilley
    Contributor

    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!

    1. 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.
    2. 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.
    3. 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.
  10. BryceStevenWilley commented on Apr 24, 2019

    @BryceStevenWilley
    Contributor

    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.

  11. davetcoleman commented on Apr 30, 2019

    @davetcoleman
    MemberAuthor

    Yes I think you and everyone else has done a great job with this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementmoveit day candidatesimple improvements

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions