Skip to content

clang-tidy: enable cppcoreguidelines-slicing and fix errors#3097

Open
ayushjariyal wants to merge 1 commit intopgRouting:developfrom
ayushjariyal:enable-slicing
Open

clang-tidy: enable cppcoreguidelines-slicing and fix errors#3097
ayushjariyal wants to merge 1 commit intopgRouting:developfrom
ayushjariyal:enable-slicing

Conversation

@ayushjariyal
Copy link

@ayushjariyal ayushjariyal commented Mar 20, 2026

Enable cppcoreguidelines-slicing and fix warnings.

Summary by CodeRabbit

  • Chores
    • Internal code quality improvements to optimize memory handling and type safety in core optimization and order processing modules.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 104c492e-0908-4a67-a277-c2319cafb06d

📥 Commits

Reviewing files that changed from the base of the PR and between e06c177 and 5c12e51.

📒 Files selected for processing (3)
  • .clang-tidy
  • src/pickDeliver/optimize.cpp
  • src/pickDeliver/order.cpp
💤 Files with no reviewable changes (1)
  • .clang-tidy

Walkthrough

Re-enabled the cppcoreguidelines-slicing clang-tidy diagnostic and applied fixes across three files: modified .clang-tidy configuration, updated Optimize::save_if_best() to use explicit const casting, and changed Order output operator to use const reference binding instead of value conversion.

Changes

Cohort / File(s) Summary
Configuration
.clang-tidy
Removed -cppcoreguidelines-slicing from disabled checks list to enable the diagnostic.
Slicing Fixes
src/pickDeliver/optimize.cpp, src/pickDeliver/order.cpp
Updated assignments and casts to use explicit const references (static_cast<const Solution&> and const Identifier&) instead of implicit conversions, eliminating reliance on implicit conversion operators.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

Enhancement, C/C++

Suggested reviewers

  • cvvergara

Poem

🐰 A rabbit hops through code so clean,
Where slicing rules are now foreseen,
Explicit casts in references bind,
No implicit conversions left behind,
Better diagnostics guide the way!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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 accurately summarizes the main changes: enabling a clang-tidy check and fixing the resulting errors in the codebase.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can customize the tone of the review comments and chat replies.

Configure the tone_instructions setting to customize the tone of the review comments and chat replies. For example, you can set the tone to Act like a strict teacher, Act like a pirate and more.

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