Skip to content

clang-tidy : added cppcoreguidelines-avoid-do-while and fix interruption.hpp#3016

Closed
Eternity0207 wants to merge 6 commits intopgRouting:developfrom
Eternity0207:mani-clean-clang-tidy
Closed

clang-tidy : added cppcoreguidelines-avoid-do-while and fix interruption.hpp#3016
Eternity0207 wants to merge 6 commits intopgRouting:developfrom
Eternity0207:mani-clean-clang-tidy

Conversation

@Eternity0207
Copy link

@Eternity0207 Eternity0207 commented Dec 27, 2025

Summary by CodeRabbit

  • Chores

    • Updated static analysis configuration (no change to behavior).
  • Refactor

    • Internal refactor of interrupt-handling implementation for maintainability; no behavioral or public API changes.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 27, 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

Replaced the CHECK_FOR_INTERRUPTS() macro with a static inline function in include/cpp_common/interruption.hpp. .clang-tidy showed only an InheritParentConfig no-op change; no other behavioral changes detected.

Changes

Cohort / File(s) Summary
Clang-tidy config (no-op)
​.clang-tidy
Diff shows InheritParentConfig: true present on both sides; no effective change to checks or behavior.
Interrupt handling header
include/cpp_common/interruption.hpp
Removed macro CHECK_FOR_INTERRUPTS() and added static inline void CHECK_FOR_INTERRUPTS() with the same conditional call to ProcessInterrupts() (macro → function conversion, internal linkage).

Sequence Diagram(s)

(omitted — changes do not introduce a new multi-component control flow that requires a sequence diagram)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • cvvergara
  • robe2

Poem

🐇 I hopped through headers, soft and quick,

Swapped a macro for a function trick.
A tiny change, tidy and neat,
My whiskers twitch — the code’s complete.

🚥 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 describes the two main changes: adding a clang-tidy check and fixing interruption.hpp to comply with it.

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

✨ 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
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 5d76cc6 and f759746.

📒 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
🔇 Additional comments (1)
.clang-tidy (1)

9-9: Good formatting practice!

Adding the trailing comma makes future additions to the checks list cleaner by avoiding unnecessary line changes.

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 only fix the file
include/cpp_common/interruption.hpp
By ignoring any clang-tidy check on the problematic do while.

@Eternity0207 Eternity0207 changed the title clang-tidy : added cppcoreguidelines-avoid-do-while clang-tidy : added cppcoreguidelines-avoid-do-while and fix interruption.hpp Dec 31, 2025
@Eternity0207
Copy link
Author

I've fixed the reuqested file and now there is no warning due to the cppcoreguideline-avoid-do-while.

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 879d524 and 432a623.

📒 Files selected for processing (1)
  • include/cpp_common/interruption.hpp
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: cvvergara
Repo: pgRouting/pgrouting PR: 3004
File: .clang-tidy:9-11
Timestamp: 2025-12-30T19:45:24.426Z
Learning: In pgRouting's .clang-tidy file (and similar list configurations), the last line of lists should not have a trailing comma, per project convention.
⏰ 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
🔇 Additional comments (1)
include/cpp_common/interruption.hpp (1)

87-91: No issues found. The .clang-tidy file is present and includes the cppcoreguidelines-avoid-do-while check as expected. All 15+ call sites of CHECK_FOR_INTERRUPTS() throughout the codebase follow a consistent standalone statement pattern (directly followed by try-catch blocks), making them fully compatible with the static inline function form.

@cvvergara cvvergara marked this pull request as draft January 3, 2026 16:32
@Eternity0207 Eternity0207 force-pushed the mani-clean-clang-tidy branch from e619b94 to dc2ba4a Compare January 3, 2026 18:32
@Eternity0207 Eternity0207 marked this pull request as ready for review January 7, 2026 17:23
@Eternity0207 Eternity0207 requested a review from cvvergara January 8, 2026 17:32
@Eternity0207 Eternity0207 force-pushed the mani-clean-clang-tidy branch from 8b5c5c6 to 788451d Compare January 12, 2026 14:03
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

🤖 Fix all issues with AI agents
In @include/cpp_common/interruption.hpp:
- Around line 87-91: Rename the ALL_CAPS function to follow normal function
naming (e.g., change CHECK_FOR_INTERRUPTS to checkForInterrupts) and update its
definition to call INTERRUPTS_PENDING_CONDITION() and ProcessInterrupts() as
before; to preserve backward compatibility, add a thin deprecated wrapper named
CHECK_FOR_INTERRUPTS that simply calls checkForInterrupts(). Ensure you update
or leave call sites accordingly and keep INTERRUPTS_PENDING_CONDITION and
ProcessInterrupts references unchanged.
📜 Review details

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8b5c5c6 and 788451d.

📒 Files selected for processing (2)
  • .clang-tidy
  • include/cpp_common/interruption.hpp
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: cvvergara
Repo: pgRouting/pgrouting PR: 3004
File: .clang-tidy:9-11
Timestamp: 2025-12-30T19:45:32.986Z
Learning: In pgRouting's .clang-tidy file (and similar list configurations), the last line of lists should not have a trailing comma, per project convention.
📚 Learning: 2025-12-30T19:45:24.426Z
Learnt from: cvvergara
Repo: pgRouting/pgrouting PR: 3004
File: .clang-tidy:9-11
Timestamp: 2025-12-30T19:45:24.426Z
Learning: In .clang-tidy files (and similar list-based configuration files), the last entry in a list should not have a trailing comma, following project convention. Enforce that lists do not end with a comma to improve diffs and consistency across configuration files.

Applied to files:

  • .clang-tidy
📚 Learning: 2025-12-31T06:01:45.144Z
Learnt from: Mohit242-bit
Repo: pgRouting/pgrouting PR: 3018
File: locale/en/LC_MESSAGES/pgrouting_doc_strings.po:11-11
Timestamp: 2025-12-31T06:01:45.144Z
Learning: In pgRouting/pgrouting, CI/Weblate may update locale/pot/pgrouting_doc_strings.pot and locale/en/LC_MESSAGES/pgrouting_doc_strings.po in PRs after .rst changes. These auto-generated updates are acceptable and should not be flagged; only manual edits to .po files should be discouraged.

Applied to files:

  • .clang-tidy
📚 Learning: 2025-12-30T19:45:40.183Z
Learnt from: cvvergara
Repo: pgRouting/pgrouting PR: 3004
File: .clang-tidy:11-11
Timestamp: 2025-12-30T19:45:40.183Z
Learning: In any .clang-tidy configuration files, ensure that the last element of a list does not have a trailing comma, to follow the repository's coding convention. This applies to all pgRouting/.clang-tidy files across the codebase.

Applied to files:

  • .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
🔇 Additional comments (2)
.clang-tidy (2)

12-12: Verify the intent: the check is currently disabled.

The - prefix on cppcoreguidelines-avoid-do-while means this check is disabled, not enabled. The PR title says "added cppcoreguidelines-avoid-do-while" which typically implies enabling the check.

If the intent is to enable this check (to enforce avoiding do-while loops), the line should be removed entirely, as cppcoreguidelines-* on line 9 already enables all cppcoreguidelines checks by default.

Current behavior: the check is explicitly disabled, so do-while loops will not trigger warnings.


45-45: No observable change detected.

The AI summary indicates this line (InheritParentConfig: true) is unchanged from the previous version. If this is an unintentional diff artifact, consider reverting to keep the commit clean.

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.

@cvvergara cvvergara marked this pull request as draft January 13, 2026 01:42
@Eternity0207 Eternity0207 marked this pull request as ready for review January 13, 2026 06:44
@cvvergara
Copy link
Member

Hi @Eternity0207

On this comment it was asked to ignore the do-while, but you gave a different solution.

Unfortunately this particular file has code that is deeply interlocked with PostgreSQL and even thou the tests pass for macos, and ubuntu, there are other OS like windows, fedora, etc. Specially windows, I am terrified of.
I remember a time when I made a change and on widows compiler it stopped working. Took me a month to figure out a way around.
The solution with the do-while works, that is the reason about ignoring that do-while.

I am not going to merge this solution.
I think you have done enough for task 4.
Please put a link to this comment on your issue so that when we review the tasks this comment is easy for us to find.

Remember: merging is not a requirement for task4

@cvvergara cvvergara closed this Jan 16, 2026
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.

2 participants