Repository navigation
Apply clang tidy fix to entire code base (Part 2) - #1394
Conversation
rhaschke
left a comment
There was a problem hiding this comment.
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.
| { | ||
| 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.
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.
Agree, I think t or time is a better name here.
There was a problem hiding this comment.
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.
| controls_layout->addWidget(spacer); | ||
|
|
||
| // Save | ||
| QPushButton* btn_save_ = new QPushButton("&Save", this); |
| } | ||
|
|
||
| // Ensure no leading slash creates a bad param server address | ||
| static const std::string robot_description = |
There was a problem hiding this comment.
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.
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.
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.
I pushed a commit to fix this remaining issue.
There was a problem hiding this comment.
I'm curious why these override issues were not caught by Travis.
There was a problem hiding this comment.
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.
|
@RoboticsYY, I just noticed that this PR comprises a merge commit from master to include latest changes. |
BryceStevenWilley
left a comment
There was a problem hiding this comment.
I also approve, with a few nits + @rhaschke's comments.
| { | ||
| 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.
Agree, I think t or time is a better name here.
| } | ||
|
|
||
| // Ensure no leading slash creates a bad param server address | ||
| static const std::string robot_description = |
There was a problem hiding this comment.
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.
| { | ||
| using namespace moveit; | ||
|
|
||
| bp::class_<RobotInterfacePython> RobotClass("RobotInterface", bp::init<std::string, bp::optional<std::string>>()); |
There was a problem hiding this comment.
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. |
rhaschke
left a comment
There was a problem hiding this comment.
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
davetcoleman
left a comment
There was a problem hiding this comment.
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-namingclang-tidy fix to MoveIt code base. The commits are split for different variable cases and for easy web explorer loading. Please note:CartToJntis preferred byKDL, which does not align withcamelBack.UPPER_CASEwithout a suffix_. If a suffix_is preferred,readability-identifier-naming.ClassConstantSuffixis required in .clang-tidy.Checklist