Skip to content

fix: remediate misc-include-cleaner violations (batch 6)#231

Merged
vtz merged 2 commits intomainfrom
feat/clang-tidy-batch6
Apr 15, 2026
Merged

fix: remediate misc-include-cleaner violations (batch 6)#231
vtz merged 2 commits intomainfrom
feat/clang-tidy-batch6

Conversation

@vtz
Copy link
Copy Markdown
Owner

@vtz vtz commented Apr 15, 2026

Summary

  • Add missing direct #include directives for standard library headers (<cstdint>, <vector>, <string>, <memory>, <optional>, <chrono>, <utility>, etc.) and project headers (someip/types.h, common/result.h, platform/thread.h, sd/sd_types.h, tp/tp_types.h, etc.) across 23 source files.
  • Remove genuinely unused includes: <algorithm> (e2e_crc, e2e_profile_registry, event_subscriber), <unordered_set> (event_publisher), <iostream> (tp_segmenter), serialization/serializer.h (sd_message).
  • Suppress false positives from the platform abstraction layer (platform/byteorder.hbyteorder_impl.h, platform/net.hnet_impl.h, platform/memory.hmemory_impl.h) where misc-include-cleaner cannot trace macro/type definitions through the indirection. Uses NOLINTNEXTLINE for include-level suppressions and NOLINTBEGIN/NOLINTEND blocks for files with many platform macro usages (transport, serialization, SD message, E2E).

Test plan

  • Full local build passes (posix, all targets)
  • All 403 unit tests pass across 15 test binaries
  • CI builds pass (posix, FreeRTOS, ThreadX, Zephyr)
  • Quality gate passes (clang-tidy baseline)

Made with Cursor

Summary by CodeRabbit

  • Refactor
    • Enhanced internal type safety and consistency across bitwise operations and integer conversions throughout the codebase.
    • Optimized constructor declarations for improved API correctness.
    • Updated parameter types in internal serialization routines to support wider value ranges.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 15, 2026

Warning

Rate limit exceeded

@vtz has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 30 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 0 minutes and 30 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ea8c19e8-7043-47e7-97a5-85d1ebe2225b

📥 Commits

Reviewing files that changed from the base of the PR and between 7983492 and d0cb58b.

📒 Files selected for processing (23)
  • src/common/result.cpp
  • src/core/session_manager.cpp
  • src/e2e/e2e_crc.cpp
  • src/e2e/e2e_header.cpp
  • src/e2e/e2e_profile_registry.cpp
  • src/e2e/e2e_profiles/standard_profile.cpp
  • src/e2e/e2e_protection.cpp
  • src/events/event_publisher.cpp
  • src/events/event_subscriber.cpp
  • src/rpc/rpc_client.cpp
  • src/rpc/rpc_server.cpp
  • src/sd/sd_client.cpp
  • src/sd/sd_message.cpp
  • src/sd/sd_server.cpp
  • src/serialization/serializer.cpp
  • src/someip/message.cpp
  • src/someip/types.cpp
  • src/tp/tp_manager.cpp
  • src/tp/tp_reassembler.cpp
  • src/tp/tp_segmenter.cpp
  • src/transport/endpoint.cpp
  • src/transport/tcp_transport.cpp
  • src/transport/udp_transport.cpp
📝 Walkthrough

Walkthrough

This PR systematically updates bitwise operations across multiple files to use explicit unsigned casting and masking, reorganizes includes for better clarity, makes several constructors explicitly non-convertible, and adjusts the TP segmenter to handle wider offset values (uint32_t instead of uint16_t).

Changes

Cohort / File(s) Summary
Platform Socket Blocking Helpers
include/platform/lwip/net_impl.h, include/platform/posix/net_impl.h, include/platform/zephyr/net_impl.h
Updated someip_set_nonblocking() and someip_set_blocking() to cast bitwise flag operations through unsigned types with explicit masks and static_cast before passing to fcntl/zsock_fcntl.
Type System Updates
include/sd/sd_message.h, include/someip/types.h
Added explicit unsigned casting to flag comparisons and bitwise updates in message flag helpers; updated MessageId and RequestId conversion methods with explicit unsigned literal suffixes.
TP Segmenter Header
include/tp/tp_segmenter.h
Changed serialize_tp_header() offset parameter type from uint16_t to uint32_t.
Result & Session Management
src/common/result.cpp, src/core/session_manager.cpp
Added missing standard library includes (<string>, threading, chrono, memory types) to support type declarations.
E2E/CRC Implementation
src/e2e/e2e_crc.cpp, src/e2e/e2e_header.cpp, src/e2e/e2e_profile_registry.cpp, src/e2e/e2e_profiles/standard_profile.cpp, src/e2e/e2e_protection.cpp
Updated CRC algorithms to use explicit unsigned intermediate values (uint32_t) before masking; added unsigned literal suffixes to bit shifts and masks; reorganized includes and added lint suppressions.
Serialization & Message Handling
src/serialization/serializer.cpp, src/someip/message.cpp, src/someip/types.cpp
Adjusted big-endian conversions to use explicit unsigned casting and U-suffixed constants; reorganized includes and added NOLINT directives for include-cleaner warnings.
Service Discovery Implementation
src/sd/sd_message.cpp
Updated bit-manipulation expressions (options nibble packing, TTL/field packing, length/reserved reconstruction) to use explicit unsigned casts and U-suffixed constants; expanded include guards with NOLINT directives.
Service Discovery Client/Server
src/sd/sd_client.cpp, src/sd/sd_server.cpp
Made internal SdClientImpl and SdServerImpl constructors explicit; reorganized includes and added lint suppression blocks; expanded standard library dependencies.
Transport Layer
src/transport/endpoint.cpp, src/transport/tcp_transport.cpp, src/transport/udp_transport.cpp
Updated IPv4 parsing to use std::strtol with explicit base; changed header parsing to cast bytes explicitly to uint32_t with unsigned literals; expanded includes and added NOLINT directives.
RPC Layer
src/rpc/rpc_client.cpp, src/rpc/rpc_server.cpp
Made internal RpcClientImpl and RpcServerImpl constructors explicit; reorganized includes and expanded standard library dependencies.
Event Handling & TP Management
src/events/event_publisher.cpp, src/events/event_subscriber.cpp, src/tp/tp_manager.cpp, src/tp/tp_reassembler.cpp, src/tp/tp_segmenter.cpp
Made EventSubscriberImpl constructor explicit; updated TP header serialization to use uint32_t offsets and explicit unsigned casts for byte encoding; adjusted bit-shift/mask operations with U-suffixed constants and explicit uint8_t casts throughout TP segmentation and reassembly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 With whiskers twitching and paws so keen,
I cast these bits to shades unseen,
Where U-suffixed constants align with care,
Unsigned masks dance through the air,
No sign-flip shadows, just clean, type-safe flair!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: remediating misc-include-cleaner violations in batch 6, which aligns with the changeset's primary purpose of adding missing headers and suppressing false positives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/clang-tidy-batch6

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/sd/sd_message.cpp`:
- Around line 398-399: ConfigurationOption::serialize() writes the option length
into data[2]/data[3], but SdOption::deserialize() currently reads length from
data[0]/data[1] and type from data[2], causing mis-parsing; update
SdOption::deserialize to parse the header the same way as
ConfigurationOption::serialize (read the option type from data[0] and read the
16-bit length from data[2] and data[3] using the same endian handling), and
adjust any bounds checks/total-length calculations in SdOption::deserialize to
use those offsets so deserialization matches serialization.

In `@src/someip/message.cpp`:
- Line 34: The NOLINTBEGIN(misc-include-cleaner) suppression started near the
top (the comment with "someip_hton*/someip_ntoh* macros") is never closed; add a
matching "// NOLINTEND(misc-include-cleaner)" annotation immediately before the
closing brace of the namespace someip (the line containing "} // namespace
someip") so the suppression scope is correctly terminated and linting is not
over-suppressed.

In `@src/transport/tcp_transport.cpp`:
- Around line 597-600: Remove the unmatched duplicate
NOLINTEND(misc-include-cleaner) directive near the end of the file so the single
NOLINTBEGIN(misc-include-cleaner) at the top pairs correctly; specifically
delete the second occurrence of "NOLINTEND(misc-include-cleaner)" (the duplicate
that follows the first NOLINTEND) to avoid clang-tidy suppression parsing
failures.
🪄 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: df82af09-e58c-4a9b-9890-755b6142644c

📥 Commits

Reviewing files that changed from the base of the PR and between a8879fe and 7983492.

📒 Files selected for processing (29)
  • include/platform/lwip/net_impl.h
  • include/platform/posix/net_impl.h
  • include/platform/zephyr/net_impl.h
  • include/sd/sd_message.h
  • include/someip/types.h
  • include/tp/tp_segmenter.h
  • src/common/result.cpp
  • src/core/session_manager.cpp
  • src/e2e/e2e_crc.cpp
  • src/e2e/e2e_header.cpp
  • src/e2e/e2e_profile_registry.cpp
  • src/e2e/e2e_profiles/standard_profile.cpp
  • src/e2e/e2e_protection.cpp
  • src/events/event_publisher.cpp
  • src/events/event_subscriber.cpp
  • src/rpc/rpc_client.cpp
  • src/rpc/rpc_server.cpp
  • src/sd/sd_client.cpp
  • src/sd/sd_message.cpp
  • src/sd/sd_server.cpp
  • src/serialization/serializer.cpp
  • src/someip/message.cpp
  • src/someip/types.cpp
  • src/tp/tp_manager.cpp
  • src/tp/tp_reassembler.cpp
  • src/tp/tp_segmenter.cpp
  • src/transport/endpoint.cpp
  • src/transport/tcp_transport.cpp
  • src/transport/udp_transport.cpp

Comment thread src/sd/sd_message.cpp Outdated
Comment thread src/someip/message.cpp
Comment thread src/transport/tcp_transport.cpp Outdated
@vtz vtz force-pushed the feat/clang-tidy-batch6 branch from 41f582d to d0cb58b Compare April 15, 2026 04:34
@vtz vtz merged commit 6e71a26 into main Apr 15, 2026
43 checks passed
@vtz vtz deleted the feat/clang-tidy-batch6 branch April 15, 2026 12:40
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