Skip to content

Conversation

@akronim26
Copy link

@akronim26 akronim26 commented Dec 18, 2025

Summary by CodeRabbit

  • Chores

    • Added additional C++ core-guideline checks to the static-analysis configuration to strengthen linting.
  • Bug Fixes

    • Ensured numeric locals and class fields are deterministically initialized to prevent uninitialized values and improve stability of cost and flow calculations.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 18, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Updated .clang-tidy to add two cppcoreguidelines checks; value-initialized a local Flow_t in src/max_flow/minCostMaxFlow.cpp; added an in-class default initializer m_tot_cost{0} in include/cpp_common/path.hpp and removed explicit constructor initializations.

Changes

Cohort / File(s) Summary
Configuration
.clang-tidy
Added cppcoreguidelines-interfaces-global-init and cppcoreguidelines-rvalue-reference-param-not-moved to the clang-tidy checks list.
Flow implementation
src/max_flow/minCostMaxFlow.cpp
In PgrCostFlowGraph::GetFlowEdges, changed local Flow_t from default initialization (Flow_t edge;) to value-initialization (Flow_t edge{}) before assigning its fields.
Path header
include/cpp_common/path.hpp
Added in-class default double m_tot_cost{0}; and removed explicit m_tot_cost(0) from constructors' initializer lists; one constructor now relies on recalculate_agg_cost() to set m_tot_cost.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • cvvergara

Poem

🐇 I hopped through code with nimble feet,
A zero placed where values meet,
Two tidy rules tucked in a row,
Small fixes make the branches grow,
I twitch my nose and softly beat.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions only one of three checks being added, and other significant code changes are present but not mentioned in the title. Update the title to reflect all changes, such as 'Add cppcoreguidelines checks and fix member initialization' to accurately represent the broader changeset.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
Member

@cvvergara cvvergara left a comment

Choose a reason for hiding this comment

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

I compiled locally using on my local run.sh:

CXX=clang++ CC=clang cmake  -DUSE_CLANG_TIDY=ON  -DBUILD_HTML=OFF -DPOSTGRESQL_BIN=${PGBIN} ..

and these are some of the many warnings I get that are not fixed


/home/vicky/pgrouting/pgrouting/cvvergara/include/trsp/edgeInfo.hpp:39:7: warning: constructor does not initialize these fields: m_edge, m_edgeIndex [cppcoreguidelines-pro-type-member-init]
   39 | class EdgeInfo {
      |       ^
[ 16%] Building CXX object src/max_flow/CMakeFiles/max_flow.dir/max_flow_driver.cpp.o
[ 16%] Building CXX object src/trsp/CMakeFiles/trsp.dir/trspHandler.cpp.o
[ 16%] Building CXX object src/allpairs/CMakeFiles/allpairs.dir/allpairs_driver.cpp.o
[ 17%] Building CXX object src/withPoints/CMakeFiles/withPoints.dir/withPoints.cpp.o
[ 17%] Building C object src/trsp/CMakeFiles/trsp.dir/trsp.c.o
[ 17%] Building C object src/withPoints/CMakeFiles/withPoints.dir/withPointsVia.c.o
[ 18%] Building CXX object src/max_flow/CMakeFiles/max_flow.dir/maximum_cardinality_matching_driver.cpp.o
[ 18%] Building CXX object src/pickDeliver/CMakeFiles/pickDeliver.dir/pickDeliver.cpp.o
[ 18%] Building C object src/ksp/CMakeFiles/ksp.dir/withPoints_ksp.c.o
[ 18%] Building CXX object src/driving_distance/CMakeFiles/driving_distance.dir/driving_distance_withPoints_driver.cpp.o
/home/vicky/pgrouting/pgrouting/cvvergara/include/cpp_common/ch_edge.hpp:42:7: warning: constructor does not initialize these fields: id, source, target, cost [cppcoreguidelines-pro-type-member-init]
   42 | class CH_edge {
      |       ^
/home/vicky/pgrouting/pgrouting/cvvergara/include/cpp_common/ch_edge.hpp:44:6: warning: constructor does not initialize these fields: id, source, target, cost [cppcoreguidelines-pro-type-member-init]
   44 |      CH_edge() = default;
      |      ^
/home/vicky/pgrouting/pgrouting/cvvergara/include/cpp_common/path.hpp:166:40: warning: constructor does not initialize these fields: m_tot_cost [cppcoreguidelines-pro-type-member-init]
   62 |     template <typename G , typename V> Path(
      |                                        ^
/home/vicky/pgrouting/pgrouting/cvvergara/include/cpp_common/path.hpp:231:40: warning: constructor does not initialize these fields: m_tot_cost [cppcoreguidelines-pro-type-member-init]
  231 |     template <typename G , typename V> Path(

The warnings come from cppcoreguidelines-pro-type-member-init

From my calculations:

grep cppcore out.txt | wc -l
    162

There are 162 warnings.

Copy link
Member

@cvvergara cvvergara left a comment

Choose a reason for hiding this comment

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

Please fix the warnings only in file include/cpp_common/path.hpp
and then click on Ready for Review button so that I can review again for that file.

@cvvergara cvvergara marked this pull request as draft December 26, 2025 15:52
@akronim26 akronim26 marked this pull request as ready for review December 26, 2025 18:04
Copy link
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: 1

📜 Review details

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1ab8e26 and bf2cca1.

📒 Files selected for processing (1)
  • include/cpp_common/path.hpp
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis

@akronim26 akronim26 requested a review from cvvergara December 26, 2025 18:38
Copy link
Member

@cvvergara cvvergara left a comment

Choose a reason for hiding this comment

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

Hi, thanks,
The modifications on the requested file look good
I am waiting for tests to finish running, but looks fine
Now please remove the requested line because leaving it will create cppcoreguidelines-pro-type-member-init warnings when compiling the code and we know there are more to fix

@cvvergara cvvergara marked this pull request as draft December 27, 2025 17:14
@akronim26 akronim26 marked this pull request as ready for review December 27, 2025 18:21
Copy link
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: 2

📜 Review details

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 632973f and 648184d.

📒 Files selected for processing (1)
  • .clang-tidy
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis

cppcoreguidelines-avoid-goto,
cppcoreguidelines-avoid-non-const-global-variables,
cppcoreguidelines-avoid-reference-coroutine-parameters,
cppcoreguidelines-interfaces-global-init,
Copy link
Member

Choose a reason for hiding this comment

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

Remove the trailing comma

Copy link
Member

@cvvergara cvvergara left a comment

Choose a reason for hiding this comment

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

Please when you do modifications look at the sorrounding code to see if something else needs to be modified

@cvvergara cvvergara added this to the Release 4.1.0 milestone Dec 30, 2025
@cvvergara cvvergara marked this pull request as draft December 30, 2025 20:32
@akronim26 akronim26 marked this pull request as ready for review January 5, 2026 16:34
@cvvergara cvvergara marked this pull request as draft January 5, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants