stt: adjust naming to Google-style (excluding method names)#10194
Conversation
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
|
clang-tidy review says "All clean, LGTM! 👍" |
There was a problem hiding this comment.
Code Review
This pull request updates variable and constant naming across the stt module to improve consistency and better align with standard C++ naming conventions, such as using kPascalCase for constants and trailing underscores for member variables. The review feedback suggests further refining the names in src/stt/src/flt/flute.cpp by removing redundant wl suffixes from several constants and variables to ensure uniform naming throughout the file.
| constexpr double kAawl = 0.6; | ||
| constexpr double kBbwl = 0.3; | ||
| const float ccwl = 7.4 / ((d + 10.) * (d - 3.)); | ||
| const float ddwl = 4.8 / (d - 1); |
There was a problem hiding this comment.
To improve consistency with flutes_medium_degree and better adhere to the Google C++ Style Guide, consider using kAa, kBb, cc, and dd instead of the wl-suffixed names. This also avoids the lack of underscores in ccwl and ddwl (which should be cc_wl and dd_wl if the suffix is kept) and ensures tunable parameters are defined as named constants.
| constexpr double kAawl = 0.6; | |
| constexpr double kBbwl = 0.3; | |
| const float ccwl = 7.4 / ((d + 10.) * (d - 3.)); | |
| const float ddwl = 4.8 / (d - 1); | |
| constexpr double kAa = 0.6; | |
| constexpr double kBb = 0.3; | |
| const float cc = 7.4 / ((d + 10.) * (d - 3.)); | |
| const float dd = 4.8 / (d - 1); |
References
- Variables should use snake_case and constants should use kPascalCase. Consistency across similar functions is also a key maintainability principle. (link)
- Define tunable parameters as named constants instead of using hardcoded magic numbers.
| const float dx = ccwl * (xs[d - 2] - xs[1]); | ||
| const float dy = ccwl * (ys[d - 2] - ys[1]); |
| if (si[r] == 0 || si[r] == d - 1) { | ||
| score[nbp] = (xs[r + 1] - xs[r - 1]) - penalty[r] | ||
| - AAWL * (ys[d - 2] - ys[1]) - DDWL * disty[r]; | ||
| - kAawl * (ys[d - 2] - ys[1]) - ddwl * disty[r]; |
| } else { | ||
| score[nbp] = (xs[r + 1] - xs[r - 1]) - penalty[r] | ||
| - BBWL * (ys[si[r] + 1] - ys[si[r] - 1]) - DDWL * disty[r]; | ||
| - kBbwl * (ys[si[r] + 1] - ys[si[r] - 1]) - ddwl * disty[r]; |
| if (s[r] == 0 || s[r] == d - 1) { | ||
| score[nbp] = (ys[r + 1] - ys[r - 1]) - penalty[s[r]] | ||
| - AAWL * (xs[d - 2] - xs[1]) - DDWL * distx[r]; | ||
| - kAawl * (xs[d - 2] - xs[1]) - ddwl * distx[r]; |
| } else { | ||
| score[nbp] = (ys[r + 1] - ys[r - 1]) - penalty[s[r]] | ||
| - BBWL * (xs[s[r] + 1] - xs[s[r] - 1]) - DDWL * distx[r]; | ||
| - kBbwl * (xs[s[r] + 1] - xs[s[r] - 1]) - ddwl * distx[r]; |
Summary
adjust naming to Google-style (excluding method names)
Type of Change
Impact
None
Verification
./etc/Build.sh).