Skip to content

Clang tidy core - #746

Closed
BryceStevenWilley wants to merge 37 commits into
moveit:kinetic-develfrom
BryceStevenWilley:clang-tidy-core
Closed

BryceStevenWilley wants to merge 37 commits into
moveit:kinetic-develfrom
BryceStevenWilley:clang-tidy-core

Conversation

@BryceStevenWilley

Copy link
Copy Markdown
Contributor

Description

Extended clang-tidy from collision_detection (#693) to the rest of moveit_core. Each commit is a specific clang-tidy check, it's probably easier to browse through each commit individually.

To keep this commit manageable, I only did clang-tidy checks that included automatic/simple fixes. In the future, we should look into enabling and fixing checks like cppcoreguidelines-* (http://releases.llvm.org/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/list.html), as those are the most likely to result in fewer segfaults and silent bugs.

Checklist

  • Required: Code is auto formatted using clang-format
  • Extended the tutorials / documentation, if necessary reference
  • Include a screenshot if changing a GUI
  • Optional: Created tests, which fail without this PR reference
  • Optional: Decide if this should be cherry-picked to other current ROS branches (Indigo, Jade, Kinetic)

@v4hn

v4hn commented Jan 26, 2018

Copy link
Copy Markdown
Contributor

Hey there,

most changes look alright.

On dca3919 and 4a082b3 :
I'm not a fan of auto at all. It's fine for prototyping, but it makes big code bases like MoveIt harder to understand.
@davetcoleman @bmagyar @rhaschke I believe we should discuss this in the next meeting.

What is 050f998 about? Most of the changes there are uncalled for or make no sense semantically.

@BryceStevenWilley

Copy link
Copy Markdown
Contributor Author

Understandable, auto does obscure a bit. However, clang-tidy only replaces explicit types with auto for iterators and for new statements, where the type is explicitly written out twice. That seemed like a reasonable compromise IMO.

050f998 was checking to see if the parameter names in the function declaration matched the same name in the function definition, and it copied the name over from the definition if they didn't match. Looking at the specific changes though, I agree that the new names aren't as good. I'll take a look at this soon and try to choose the better of the two names.

@rhaschke

Copy link
Copy Markdown
Contributor

I agree with @BryceStevenWilley regarding use of auto in for loops and the like. Usually it increases readability if code becomes less cluttered. However, as soon as IDEs can't resolve the type anymore, auto turns into a hurdle.

Used original name from *.h if it had more information than the name
from the *.cpp file, changed method comments to reflect name changes,
fixed comment spacing if needed.
 Used original name from *.h if it had more information than the name
 from the *.cpp file, changed method comments to reflect name changes,
 fixed comment spacing if needed.
@davetcoleman

Copy link
Copy Markdown
Member

I'm a fan of this, including auto changes described here. Sorry we have been slow in merging this, as there are now a lot of merge conflicts. I think the biggest conflict is going to be #662

@BryceStevenWilley

Copy link
Copy Markdown
Contributor Author

Possible merge ping. Merge conflicts gather up pretty quickly.

@rhaschke

rhaschke commented May 2, 2018

Copy link
Copy Markdown
Contributor

@BryceStevenWilley I'm sorry that we were so slow on merging this. However, I think instead of merging your branch into the current HEAD you should have rebased onto the current HEAD. Now the commit history as well as githhub's diff are messed up. Please can you fix this by rebasing your PR branch onto HEAD?

@v4hn @davetcoleman Did we agree on the set of tidy changes to apply? Should we discuss that on the next maintainer meeting and then tackle this PR from scratch?

@davetcoleman

Copy link
Copy Markdown
Member

I feel ok with the sparing use of auto in this PR, but since it is a bit controversial I think the best approach would be to remove that commit (4a082b3) and the corresponding rule in the .clang-tidy file then quickly merge this.

The other two commits that @v4hn brought up seem fine to me after @BryceStevenWilley's explanation

We can discuss auto further at the next meeting

@BryceStevenWilley BryceStevenWilley mentioned this pull request May 2, 2018
5 tasks done
@BryceStevenWilley

Copy link
Copy Markdown
Contributor Author

@rhaschke I couldn't clean the commit history on this particular branch, but I've made a duplicate PR (#880) to address the history issue. This isn't the first time you've pointed out my messy merge history, I'll try to rebase more in the future. 😅.

@davetcoleman The auto changes have been removed in #880, I'll close this PR. Sorry for the noise.

@BryceStevenWilley
BryceStevenWilley deleted the clang-tidy-core branch May 24, 2018 04:03
@BryceStevenWilley
BryceStevenWilley restored the clang-tidy-core branch May 24, 2018 04:03
@BryceStevenWilley
BryceStevenWilley deleted the clang-tidy-core branch March 2, 2019 13:51
JafarAbdi pushed a commit to JafarAbdi/moveit that referenced this pull request Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants