fix: resolve all remaining clang-tidy violations — threshold to 0#236
fix: resolve all remaining clang-tidy violations — threshold to 0#236
Conversation
Rule of Five (special-member-functions): - Delete copy/move on 20+ non-copyable classes (Pimpl impls, interfaces, RAII wrappers, registries) - Default move on Deserializer (used by tests via move assignment) Code fixes: - Convert SOMEIP_INVALID_SOCKET macro to constexpr - Rename namespace E2ECRC -> e2ecrc (lower_case convention) - Rename static constant table -> CRC32_TABLE (UPPER_CASE convention) Targeted NOLINT suppressions for unavoidable violations: - fcntl() vararg calls (POSIX API) - Reference data member in RAII helper (design choice) - CRC table lookups with non-constant indices - Platform memory pool globals (FreeRTOS/ThreadX runtime state) - Platform macros for pool size configuration - SD option/entry static_cast downcasts (type-safe by protocol) - ThreadX TX_DISABLE macro (SDK API) - Placement new for platform memory (owning-memory) Lowers baseline threshold from 170 to 0.
📝 WalkthroughWalkthroughThis pull request enforces stricter object ownership semantics across the codebase by explicitly deleting copy and move constructors/assignment operators in numerous classes, reduces clang-tidy baseline warnings from 170 to 0, renames the E2ECRC namespace to e2ecrc, and adds NOLINT annotations to suppress specific linter warnings throughout the implementation. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 924b1e4728
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| * - CRC32: Standard 32-bit CRC | ||
| */ | ||
| namespace someip::e2e::E2ECRC { | ||
| namespace someip::e2e::e2ecrc { |
There was a problem hiding this comment.
Preserve old E2ECRC namespace alias
Renaming the public namespace from someip::e2e::E2ECRC to someip::e2e::e2ecrc is a source-breaking API change for downstream users: any existing code that calls E2ECRC::calculate_crc* will stop compiling immediately after upgrading, even though this commit is framed as a clang-tidy cleanup. Please keep backward compatibility by adding an alias (for example, keeping E2ECRC as a compatibility namespace) instead of removing the old symbol path outright.
Useful? React with 👍 / 👎.
NOLINTNEXTLINE doesn't cover the variable name on the continuation line; switch to inline NOLINT on the line with the diagnostic.
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
include/e2e/e2e_crc.h (1)
30-75:⚠️ Potential issue | 🟠 MajorDocument or mitigate the public namespace breaking change.
All in-repo call sites have been updated to use the new lowercase namespace
e2ecrc::, but external consumers of this public header will fail to compile. No changelog entry, deprecation warning, or compatibility alias exists to support migration. Either add a temporary compatibility namespace alias with appropriate documentation, or add a migration notice to CHANGELOG.md if this is an intentional breaking release.Compatibility option
} // namespace someip::e2e::e2ecrc + +namespace someip::e2e { +// NOLINTNEXTLINE(readability-identifier-naming) - Compatibility alias for the pre-rename public namespace. +namespace E2ECRC = e2ecrc; +} // namespace someip::e2e `#endif` // E2E_CRC_H🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@include/e2e/e2e_crc.h` around lines 30 - 75, The public header moved the namespace to someip::e2e::e2ecrc which breaks external consumers; add a temporary compatibility alias (and brief deprecation comment) that re-exports the new namespace under the old name so external code still compiles, and add a short migration note in CHANGELOG.md; specifically, in the header where namespace someip::e2e::e2ecrc is declared, add a backward-compatible alias/using for the previous namespace name (and a comment marking it deprecated) so symbols like calculate_crc8_sae_j1850, calculate_crc16_itu_x25, calculate_crc32, and calculate_crc remain available under the old namespace while you document the removal timeline in CHANGELOG.md.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@include/serialization/serializer.h`:
- Around line 120-123: The Serializer class currently deletes the move
constructor and move assignment even though it only owns a std::vector<uint8_t>
and exposes move_buffer(), which prevents idiomatic moves and is asymmetric with
Deserializer; change the move operations (Serializer(Serializer&&) and
Serializer& operator=(Serializer&&)) from deleted to defaulted so the class
remains movable (i.e., use = default for the move ctor/assignment) while keeping
copy ops deleted and retaining move_buffer() behavior.
In `@src/sd/sd_client.cpp`:
- Around line 215-218: The code is performing an unnecessary downcast to
EventGroupEntry to call set_index1/set_num_opts1 (these are members of SdEntry);
remove the static_cast and NOLINT and instead set those fields on the derived
unique_ptr before it is moved into sd_message. Locate where the EventGroupEntry
unique_ptr is created (the variable passed into sd_message.get_entries() or the
point where you construct the entry prior to insertion) and call
entry->set_index1(0) and entry->set_num_opts1(1) on that unique_ptr (type
EventGroupEntry or std::unique_ptr<SdEntry>), then move it into sd_message so no
cast or lint suppression is needed.
In `@src/sd/sd_server.cpp`:
- Around line 396-399: In send_service_offer (and similarly in
send_service_offer_to_client) remove the unnecessary static_cast and NOLINT by
setting the SdEntry fields directly on the local offer_entry object (call
offer_entry->set_index1(0) and offer_entry->set_num_opts1(1)) before calling
sd_message.add_entry(std::move(offer_entry)); this eliminates the downcast to
ServiceEntry* and the need for NOLINT while preserving the same behavior.
- Around line 236-239: The code is performing an unnecessary downcast to
EventGroupEntry to call set_index1/set_num_opts1 which are defined on the
SdEntry base class; remove the static_cast<EventGroupEntry*> and the NOLINT, and
instead set_index1(...) and set_num_opts1(...) directly on the response_entry
object before it is moved into response_message (mirror the fix done in
sd_client.cpp's subscribe_eventgroup). Ensure you update the code to call
response_entry->set_index1(0) and response_entry->set_num_opts1(1) (or the
equivalent variable) prior to adding it to response_message.get_entries().
---
Outside diff comments:
In `@include/e2e/e2e_crc.h`:
- Around line 30-75: The public header moved the namespace to
someip::e2e::e2ecrc which breaks external consumers; add a temporary
compatibility alias (and brief deprecation comment) that re-exports the new
namespace under the old name so external code still compiles, and add a short
migration note in CHANGELOG.md; specifically, in the header where namespace
someip::e2e::e2ecrc is declared, add a backward-compatible alias/using for the
previous namespace name (and a comment marking it deprecated) so symbols like
calculate_crc8_sae_j1850, calculate_crc16_itu_x25, calculate_crc32, and
calculate_crc remain available under the old namespace while you document the
removal timeline in CHANGELOG.md.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 64764b37-449b-4c18-8481-74448aff3f0b
📒 Files selected for processing (26)
clang-tidy-baseline.txtinclude/core/session_manager.hinclude/e2e/e2e_crc.hinclude/e2e/e2e_profile.hinclude/e2e/e2e_profile_registry.hinclude/e2e/e2e_protection.hinclude/platform/host/host_condition_variable.hinclude/platform/posix/net_impl.hinclude/platform/thread.hinclude/platform/threadx/memory_internal.hinclude/sd/sd_message.hinclude/serialization/serializer.hinclude/transport/transport.hinclude/transport/udp_transport.hsrc/e2e/e2e_crc.cppsrc/e2e/e2e_profiles/standard_profile.cppsrc/events/event_publisher.cppsrc/events/event_subscriber.cppsrc/platform/freertos/memory.cppsrc/platform/threadx/memory.cppsrc/rpc/rpc_client.cppsrc/rpc/rpc_server.cppsrc/sd/sd_client.cppsrc/sd/sd_server.cpptests/shared/test_e2e_common.inctests/test_e2e.cpp
- Add backward-compatible E2ECRC namespace alias for API stability - Default Serializer move operations instead of deleting - Eliminate 4 unnecessary static_cast downcasts in SD client/server by setting index/opts before moving entry into message - Fix NOLINT placement for multi-line pool_buffer declarations
Platform files (FreeRTOS, ThreadX) produce compilation errors in the CI clang-tidy environment because SDK headers are unavailable. These are not clang-tidy check violations and should not count against the quality gate threshold.
Summary
Eliminates all 168 remaining clang-tidy violations, bringing the quality gate threshold from 170 → 0.
Rule of Five (88 violations → 0)
Deserializer(used by tests via move assignment)Code fixes (8 violations → 0)
SOMEIP_INVALID_SOCKETmacro toconstexpr(macro-to-enum)E2ECRC→e2ecrc(lower_case convention,readability-identifier-naming)table→CRC32_TABLE(UPPER_CASE convention)Targeted NOLINT suppressions (72 violations → 0)
fcntl()vararg calls — POSIX API, unavoidablelk_in RAII helper — design choicestatic_castdowncasts — type-safe by protocol fieldTX_DISABLEmacro — SDK APInewfor platform memory —owning-memoryTest plan
Made with Cursor
Summary by CodeRabbit
Refactor
E2ECRCtoe2ecrcChores
constexprfor improved type safety