-
Notifications
You must be signed in to change notification settings - Fork 946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply clang tidy fix to entire code base (Part 2) #1394
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I approve this PR. Changing case nicely exposed the wrong / unintended status for static / const of some variables. Could you, please, adapt these few variables?
To keep the current clean state also in future, I will enable the clang-tidy check for Travis.
@@ -208,12 +208,12 @@ void ChompTrajectory::fillInMinJerk() | |||
{ | |||
double start_index = start_index_ - 1; | |||
double end_index = end_index_ + 1; | |||
double T[6]; // powers of the time duration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to just rename T
to t
. Powers is a kind of misleading name here, but t[i] = t^i
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, I think t
or time
is a better name here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree powers
is not a good name. But t
is used in the following code block as //powers of the time index point
, so I think maybe it's better to name T
here as td
and the following t
as ti
to distinguish them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
@@ -201,14 +201,14 @@ QWidget* EndEffectorsWidget::createEditWidget() | |||
controls_layout->addWidget(spacer); | |||
|
|||
// Save | |||
QPushButton* btn_save_ = new QPushButton("&Save", this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup!
@@ -1398,16 +1398,16 @@ void PlanningSceneMonitor::configureDefaultPadding() | |||
} | |||
|
|||
// Ensure no leading slash creates a bad param server address | |||
static const std::string robot_description = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a reason for this variable to be static. This is local to this function, isn't it ?
Having it static introduces race conditions.
Other opinions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making it static saves the modified description so you don't have to substring it each call. But agreed; this function shouldn't be called that much, making it static is overkill.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a static variable here, also allows to use a single robot_description_ only, i.e. multiple instances of PSM cannot use different robot descriptions. I even consider this a bug, although it's very rare, that you have multiple robots in a single ROS environment..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a commit to fix this remaining issue.
@@ -59,29 +59,29 @@ class LinearPathSegment : public PathSegment | |||
{ | |||
} | |||
|
|||
Eigen::VectorXd getConfig(double s) const | |||
Eigen::VectorXd getConfig(double s) const override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious why these override
issues were not caught by Travis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure that clang-tidy related pkgs were cleaned up and reinstalled as it is in the Travis. But I'm not sure about the difference of the result, I will dig into that.
moveit_core/trajectory_processing/src/time_optimal_trajectory_generation.cpp
Show resolved
Hide resolved
moveit_core/trajectory_processing/test/test_time_optimal_trajectory_generation.cpp
Show resolved
Hide resolved
moveit_ros/planning/planning_request_adapter_plugins/src/add_time_optimal_parameterization.cpp
Show resolved
Hide resolved
@RoboticsYY, I just noticed that this PR comprises a merge commit from master to include latest changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also approve, with a few nits + @rhaschke's comments.
@@ -208,12 +208,12 @@ void ChompTrajectory::fillInMinJerk() | |||
{ | |||
double start_index = start_index_ - 1; | |||
double end_index = end_index_ + 1; | |||
double T[6]; // powers of the time duration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, I think t
or time
is a better name here.
@@ -1398,16 +1398,16 @@ void PlanningSceneMonitor::configureDefaultPadding() | |||
} | |||
|
|||
// Ensure no leading slash creates a bad param server address | |||
static const std::string robot_description = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making it static saves the modified description so you don't have to substring it each call. But agreed; this function shouldn't be called that much, making it static is overkill.
moveit_ros/planning_interface/move_group_interface/src/wrap_python_move_group.cpp
Show resolved
Hide resolved
@@ -373,33 +373,33 @@ static void wrap_robot_interface() | |||
{ | |||
using namespace moveit; | |||
|
|||
bp::class_<RobotInterfacePython> RobotClass("RobotInterface", bp::init<std::string, bp::optional<std::string>>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: it's defining a class, should probably stay stylized as a class name.
0775589
to
3851661
Compare
Sorry for the mistake. The commit history has been cleaned up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve this in the present form. @davetcoleman, could you provide another timely review?
This PR deals with variable renaming and you are the one who nitpicks on variable naming usually 😉
79d8fa4
to
6304f11
Compare
6304f11
to
bfe2a27
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No variable names got shorter, which is all i care about. The longer variable names are a great improvement thanks!
* Conform class name to `CamelCase` * Conform member method name to `camelBack` * Exceptions to method name * Conform local variable name to `lower_case` part 1 * Conform local variable name to `lower_case` part 2 * Conform local variable name to `lower_case` part 3 * Conform local variable name to `lower_case` part 4 * Local static variable to `lower_case` * Local variable manual fix * Exceptions to local variable name * Conform static const variable name to `UPPER_CASE` * Conform global variable name to `UPPER_CASE` * Conform static const member variable to `UPPER_CASE` * clang-format * Travis: mandatory clang-tidy-check * Catch up most recent changes * Update .clang-tidy * fixup! Conform static const variable name to `UPPER_CASE`
* Conform class name to `CamelCase` * Conform member method name to `camelBack` * Exceptions to method name * Conform local variable name to `lower_case` part 1 * Conform local variable name to `lower_case` part 2 * Conform local variable name to `lower_case` part 3 * Conform local variable name to `lower_case` part 4 * Local static variable to `lower_case` * Local variable manual fix * Exceptions to local variable name * Conform static const variable name to `UPPER_CASE` * Conform global variable name to `UPPER_CASE` * Conform static const member variable to `UPPER_CASE` * clang-format * Travis: mandatory clang-tidy-check * Catch up most recent changes * Update .clang-tidy * fixup! Conform static const variable name to `UPPER_CASE`
Description
Following up moveit#1366, this PR intends to enable the
readability-identifier-naming
clang-tidy fix to MoveIt code base. The commits are split for different variable cases and for easy web explorer loading. Please note:CartToJnt
is preferred byKDL
, which does not align withcamelBack
.UPPER_CASE
without a suffix_
. If a suffix_
is preferred,readability-identifier-naming.ClassConstantSuffix
is required in .clang-tidy.Checklist