Skip to content

Clang Tidy naming - #917

Closed
BryceStevenWilley wants to merge 7 commits into
moveit:kinetic-develfrom
BryceStevenWilley:clang-naming
Closed

BryceStevenWilley wants to merge 7 commits into
moveit:kinetic-develfrom
BryceStevenWilley:clang-naming

Conversation

@BryceStevenWilley

Copy link
Copy Markdown
Contributor

Description

Gave clang-tidy some teeth when it comes to identifier naming. Conventions are based on what was proposed in #814 with a few additions and exceptions:

  • Class Methods (static methods) are CamelCase
  • Lots of specific rules for constants (local and parameter constants are treated like normal variables, but static constants are UPPER_CASE)
  • Manually had to fix some variable collisions that would have happened (local variables R and r, both become r). Gave better names as best as I could.

Something to consider is that changing the class methods possibly breaks API. All of those changes are contained in the 2nd-to-last commit and can be easily reverted though.

Also, I'm not sure if kinetic-devel or melodic-devel is the main development branch at the moment, so I left this on kinetic-devel. Feel free to change.

Feel free to suggest additional identifiers to standardize. The code is the only good documentation for this clang-tidy feature right now, so see here for the list of supported identifier types and here for the case types. We can also add arbitrary prefixes and suffixes to any identifier.

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)

@BryceStevenWilley

Copy link
Copy Markdown
Contributor Author

Not sure if WMD is the best time to merge this, but I've updated in case it should be.

@davetcoleman

Copy link
Copy Markdown
Member

this should target melodic, but note that the two branches have diverged at this point due to things like TF2 so you probably want to re-run these scripts from scratch on melodic

@rhaschke

Copy link
Copy Markdown
Contributor

Before redoing this now the 3rd? time, I suggest to wait until WMD commits have been settled.

@@ -374,36 +374,36 @@ void AllowedCollisionMatrix::print(std::ostream& out) const
getAllEntryNames(names);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i love these changes!

*ConstraintSamplerPtr
*/
static ConstraintSamplerPtr selectDefaultSampler(const planning_scene::PlanningSceneConstPtr& scene,
static ConstraintSamplerPtr SelectDefaultSampler(const planning_scene::PlanningSceneConstPtr& scene,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API change like this must target melodic

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a function this should be lower case anyway, shouldn't it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment, static class methods are CamelCase, to distinguish them from normal class methods, which are camelBack.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there agreement on this?? Wasn't CamelCase reserved for types / class names?

@BryceStevenWilley BryceStevenWilley Oct 25, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there agreement on this?

No one else has said much, I'm happy to revert this commit. I believe my original reasoning was to distinguish static methods from normal methods somehow.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually yea, a function should be camelBack in ros format

@BryceStevenWilley BryceStevenWilley mentioned this pull request Nov 3, 2018
1 of 2 tasks
@BryceStevenWilley

Copy link
Copy Markdown
Contributor Author

Looks like the merges from WMD are slowing down, so closing this in favor of #1185.

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.

3 participants