Skip to content

refactor: align identifier naming with house style + re-enable the gate#124

Open
facontidavide wants to merge 1 commit into
mainfrom
refactor/clang-tidy-naming
Open

refactor: align identifier naming with house style + re-enable the gate#124
facontidavide wants to merge 1 commit into
mainfrom
refactor/clang-tidy-naming

Conversation

@facontidavide

Copy link
Copy Markdown
Contributor

What

Corrects the readability-identifier-naming policy to match documented house style and re-enables the check as a WarningsAsErrors gate (it was "temporarily disabled during rename migration"). The SDK already follows the policy closely — this is a config alignment plus a small internal-only cleanup. No public API / ABI / wire-format change.

This is the SDK-side companion to the PJ4 app rename (PJ4#215); the two repos were intentionally split so the SDK's plugin contract is handled with ABI awareness here.

.clang-tidy amendments

Amendment Why
LocalConstant/LocalVariable = lower_case const/constexpr locals stay lower_case; the k-prefix Constant rule applies to file-scope/global constants only
NamespaceIgnoredRegexp '^(PJ|Ui)$' flat PJ namespace (house style) + uic-generated Ui
PJ_/pj_ exemptions (Struct/Enum/EnumConstant/Function/GlobalConstant) + fetchMessageData extern "C" C-ABI plugin contract — recasing breaks every compiled plugin
PublicMember [A-Z] ROS/OpenCV CameraInfo/DepthImage intrinsics D K R P — a wire-format field contract
Method has_value|value_or|error_or + load_config|save_config|ui_content|widget_data|trampoline_* std::expected drop-in interface + plugin-author / C-ABI-bridge methods linked by name
TypeAlias json, Struct overloaded, Parameter '.*_' nlohmann alias; std::visit idiom; trailing-_ param shadow-avoidance idiom

The grandfathered snake_case plugin virtuals (save_config, trampoline_*, …) are left as-is — renaming them is a coordinated 1.0.0 break (every plugin recompiles); flagged for a future major.

Internal-only renames (no API/ABI impact)

flatten_impl/count_leaf_fields_impl → camelBack · test helpers (ColorEq, schema_release, make_robot_pose, …) → camelBack · local vars → lower_case · named constants (ns_per_second, default_a_) → k-prefix.

Versioning

Config + invisible internal renames only — no installed public API, ABI struct, or wire-format change; abi/baseline.abi untouched. No version bump warranted.

Verification

  • ✅ Build green (100%)
  • ✅ 164/164 tests pass (incl. SDK pj_base/pj_plugins tests)
  • ✅ 0 remaining naming violations (gate re-enabled)

🤖 Generated with Claude Code

Correct the readability-identifier-naming policy to match the documented house
style and re-enable the check as a WarningsAsErrors gate (it was "temporarily
disabled during rename migration"). The SDK already follows the policy closely;
this is a config alignment plus a small internal-only cleanup.

.clang-tidy amendments:
- LocalConstant/LocalVariable = lower_case: const/constexpr *locals* stay
  lower_case; the k-prefix Constant policy applies to file-scope/global
  constants only (without this, const locals falsely flag en masse).
- NamespaceIgnoredRegexp '^(PJ|Ui)$': the flat `PJ` namespace (house style) and
  uic-generated `Ui`.
- C-ABI / canonical-schema / STL exemptions (the plugin binary + wire contract):
    * Struct/Enum/EnumConstant/Function/GlobalConstant `PJ_`/`pj_` extern "C"
      C-ABI identifiers, plus the camelBack vtable member `fetchMessageData`.
    * PublicMember single-capital `D K R P` (ROS/OpenCV CameraInfo/DepthImage
      intrinsics -- a wire-format field contract).
    * Method has_value/value_or/error_or (std::expected drop-in interface) and
      load_config/save_config/ui_content/widget_data/trampoline_* (plugin-author
      and C-ABI-bridge methods every compiled plugin links by name).
    * TypeAlias `json` (nlohmann alias).
  Recasing any of these breaks wire compat, STL-shaped generic code, or the
  plugin ABI -- they are grandfathered (revisit the snake_case plugin virtuals
  in a future coordinated 1.0.0).
- StructIgnoredRegexp `overloaded` (std::visit idiom).
- ParameterIgnoredRegexp '.*_': a trailing underscore on a parameter is the
  idiomatic shadow-avoidance form (`PayloadView(Span bytes_) : bytes(bytes_)`);
  stripping it reintroduces a -Wshadow error, so trailing-underscore params are
  exempt.

Internal-only renames (no public API/ABI change -- local variables, file-local
helpers, test/example code):
  flatten_impl/count_leaf_fields_impl -> camelBack; test helpers (ColorEq,
  ColorNear, schema_release, array_release, stream_release, make_robot_pose)
  -> camelBack; local vars (requiredString/withPath/writeField/...) -> lower_case;
  named constants (ns_per_second, default_a_/default_b_) -> k-prefix.

Versioning: config + invisible internal renames only; no installed public API,
ABI struct, or wire-format change, and abi/baseline.abi is untouched -> no
version bump warranted.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant