Skip to content

Configure clang-format include ordering with IncludeCategories#820

Merged
laurynas-biveinis merged 1 commit into
masterfrom
includecategories
Dec 4, 2025
Merged

Configure clang-format include ordering with IncludeCategories#820
laurynas-biveinis merged 1 commit into
masterfrom
includecategories

Conversation

@laurynas-biveinis
Copy link
Copy Markdown
Collaborator

@laurynas-biveinis laurynas-biveinis commented Nov 27, 2025

Change IncludeBlocks from Preserve to Regroup and define priority
categories to enforce consistent include ordering: global.hpp first,
then standard library headers, then third-party headers, then project
headers.

🤖 Commit message by Claude Code

Summary by CodeRabbit

  • Chores
    • Updated formatting configuration to standardize include grouping and ordering.
    • Added prioritized include-category rules to better classify headers (system, lowercase, angle, quoted).
    • Introduced additional attribute-like macros for inlining, lifetime bounds, C-string handling, and release-time constness.
    • Harmonized include ordering across sources and tests for more consistent compilation and maintenance.

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

@laurynas-biveinis laurynas-biveinis self-assigned this Nov 27, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 27, 2025

Walkthrough

Updated .clang-format to regroup and prioritize include categories and to add several attribute/statement-macro names; applied mechanical include-order changes and minor whitespace tweaks across a few source and test files. No API or functional changes.

Changes

Cohort / File(s) Summary
Clang-format config
/.clang-format
Changed IncludeBlocks from Preserve to Regroup; added four IncludeCategories with priorities (-1,2,3,4) for global.hpp, lowercase headers, <...> headers, and quoted headers; expanded AttributeMacros (UNODB_DETAIL_LIFETIMEBOUND, UNODB_DETAIL_NOINLINE, UNODB_DETAIL_C_STRING_ARG, UNODB_DETAIL_HEADER_NOINLINE); added StatementAttributeLikeMacros (UNODB_DETAIL_RELEASE_CONST).
Source include reorders
src/art_internal.cpp, src/qsbr.cpp, benchmark/micro_benchmark.cpp
Adjusted ordering of #include directives (swapped or moved project headers relative to standard headers). No code, behavior, or API changes.
Test include tweaks
test/db_test_utils.hpp, test/qsbr_gtest_utils.cpp
Reordered include lines and removed an empty line between includes in test files. No behavioral changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Check .clang-format regexes for unintended matches or priority conflicts.
  • Build a few translation units (e.g., art_internal.cpp, qsbr.cpp, benchmark/micro_benchmark.cpp) to confirm no header-order issues.
  • Verify the new macro names match project definitions/usages and are not misspelled.

Possibly related PRs

Poem

Headers shuffled, rules refined,
Regex mapped and macros signed.
Lines tightened, order made clear,
No logic changed — just tidier gear. ✨

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ 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: configuring clang-format include ordering with IncludeCategories, which is reflected in .clang-format modifications and subsequent include reordering across multiple files.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch includecategories

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 38d7e6c and 13db9dd.

📒 Files selected for processing (6)
  • .clang-format (1 hunks)
  • art_internal.cpp (1 hunks)
  • benchmark/micro_benchmark.cpp (1 hunks)
  • qsbr.cpp (1 hunks)
  • test/db_test_utils.hpp (1 hunks)
  • test/qsbr_gtest_utils.cpp (0 hunks)
💤 Files with no reviewable changes (1)
  • test/qsbr_gtest_utils.cpp
⏰ 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). (10)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (4)
test/db_test_utils.hpp (1)

31-37: Include order now matches configured categories

gtest_utils.hpp sitting after assert.hpp in the project-header block is consistent with the new global → std → third‑party → project ordering and does not affect behavior.

qsbr.cpp (1)

11-26: qsbr.hpp include placement is consistent with the new style

Moving #include "qsbr.hpp" below the standard-library block matches the configured include categories; no semantic impact.

art_internal.cpp (1)

12-14: Project header order aligned with alphabetical grouping

Including art_common.hpp before art_internal.hpp matches the quoted-header sorting rules; change is purely stylistic.

benchmark/micro_benchmark.cpp (1)

16-21: Quoted includes reordered per .clang-format grouping

Placing node_type.hpp after the micro_benchmark headers is just an include-order cleanup to satisfy the new grouping; behavior is unchanged.


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: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd24ccc and 191227e.

📒 Files selected for processing (6)
  • .clang-format (1 hunks)
  • art_internal.cpp (1 hunks)
  • benchmark/micro_benchmark.cpp (1 hunks)
  • qsbr.cpp (1 hunks)
  • test/db_test_utils.hpp (1 hunks)
  • test/qsbr_gtest_utils.cpp (0 hunks)
💤 Files with no reviewable changes (1)
  • test/qsbr_gtest_utils.cpp
⏰ 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). (10)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (4)
test/db_test_utils.hpp (1)

31-37: Include reordering is fine

Moving "gtest_utils.hpp" after "assert.hpp" keeps project headers consistently grouped and should not affect semantics.

qsbr.cpp (1)

17-26: qsbr.hpp include move is benign

Including "qsbr.hpp" after the standard headers but before other project headers is consistent with the new style and should not change behavior as long as qsbr.hpp is self-contained.

benchmark/micro_benchmark.cpp (1)

16-21: node_type.hpp include reorder only

Placing "node_type.hpp" after the micro_benchmark headers keeps local includes sorted and doesn’t alter dependencies in this TU.

art_internal.cpp (1)

8-14: Project headers correctly grouped after std headers

Adding "art_common.hpp" and "art_internal.hpp" after the std headers matches the new include policy and still provides the needed declarations (e.g. unodb::value_view) for this implementation.

Comment thread .clang-format
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.34%. Comparing base (668f21c) to head (13db9dd).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #820   +/-   ##
=======================================
  Coverage   98.34%   98.34%           
=======================================
  Files          35       35           
  Lines        6480     6480           
=======================================
  Hits         6373     6373           
  Misses        107      107           
Flag Coverage Δ
Debug 98.30% <ø> (+0.12%) ⬆️
Release 97.73% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@laurynas-biveinis laurynas-biveinis force-pushed the includecategories branch 4 times, most recently from 38d7e6c to 62afd2f Compare December 2, 2025 15:56
Change IncludeBlocks from Preserve to Regroup and define priority
categories to enforce consistent include ordering: global.hpp first,
then standard library headers, then third-party headers, then project
headers.

🤖 Commit message by [Claude Code](https://claude.com/claude-code)
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Dec 4, 2025

@laurynas-biveinis laurynas-biveinis merged commit 8c89ee2 into master Dec 4, 2025
238 of 239 checks passed
@laurynas-biveinis laurynas-biveinis deleted the includecategories branch December 4, 2025 19:02
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