format: indent continuations by 4, and two style conventions - #125
Merged
Merged
Conversation
`.clang-format` said `AlignAfterOpenBracket: AlwaysBreak`, a misnomer: it keeps
a continuation aligned under the open paren, and clang-format 22 maps it to
`true`, which is alignment. The house style is an indent of 4 everywhere, so
this is `false` plus the four `BreakAfterOpenBracket*` options that keep an
`if`/`while`/`switch` condition off the paren column, and the braced-list pair
that restores the break after `{` that `AlwaysBreak` used to provide.
`Macros:` teaches clang-format to expand the method macros to `ID PARAMETERS`.
Without it a parameter list is parsed as an expression, where `&` is a binary
operator, and the first parameter comes out as `Cat & a1` - 49 sites. The
expansion omits the return type on purpose: with one in it, clang-format breaks
after the return type and indents the method name by 8.
`BOOST_OPENMETHOD_OVERRIDER` is left out because it appears in expression
position, where the expansion never applies and only wrecks the wrapping.
`dev/reformat` is pinned to `clang-format-22` - 18 and 19 reject
`BreakAfterOpenBracketFunction` as an unknown key and refuse to run at all -
and takes its file list from `git ls-files`, having globbed a stale `examples/`
directory that has not existed for some time, which left `ce/` unformatted.
The rest is the output of `dev/reformat`, no hand edits.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Both were indented off the 4-column grid, because clang-format measures a continuation from the column of the enclosing bracket's content: the `((` of the `classes_agree_with` fold put its operands at 13, 14 and 17, and the `(` in `same_reference_category` put its second operand at 38. No clang-format option moves any of them; removing a level of nesting does. `class_agrees_with` now carries the diagnostic, one class at a time, so the compiler names the class and the two registries in conflict instead of reporting that a requirement failed for the pack as a whole. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A function body that names `detail::` more than once now opens with `using namespace detail;` and drops the qualification, with a blank line after the run of `using` declarations. The directive covers the body only, so signatures keep their qualification. 35 bodies across 11 files. A single use does not earn a directive: the `using` line costs a line, so it only pays where it unwraps two. Every single-use body was tried and reformatted to check; none came out shorter. `using detail::generic_compiler;` in test_slot_allocator.cpp is dropped rather than requalified - the qualification there *is* the declaration, and the directive already brings the name in. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Except where the return opens its block - the whole body of a function or
lambda, the body of an `if`, a `case` - which would put the blank line
immediately after the `{`. Where a comment is attached to the return, the blank
line goes above the comment rather than between them.
clang-format has no option for this, so `dev/reformat` neither adds nor removes
these lines; it is maintained by hand.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The Formatting section still advertised `AlignAfterOpenBracket: AlwaysBreak`. It now covers the clang-format 22 pin, the `Macros:` entries and why `BOOST_OPENMETHOD_OVERRIDER` is excluded, the multiple-of-4 rule with the reason continuations go off the grid, the blank line before a return, and the three shapes clang-format cannot be configured into - so the ternary, the `::fn` argument spacing and the `clang-format off` files do not get re-litigated. The new section records the `using namespace detail` rule and the two traps a mechanical strip falls into: a using-declaration, where the qualification is the declaration, and `BOOST_OPENMETHOD_UNLESS_MRDOCS(detail::)`, which is not a qualification at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
An automated preview of the documentation is available at https://125.openmethod.prtest3.cppalliance.org/libs/openmethod/doc/html/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-09-22 21:28:37 UTC |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #125 +/- ##
===========================================
+ Coverage 92.30% 92.34% +0.04%
===========================================
Files 27 27
Lines 2222 2234 +12
Branches 679 679
===========================================
+ Hits 2051 2063 +12
Misses 112 112
Partials 59 59
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(Written by Claude Code, on behalf of @jll63.)
The repo-wide reformat that was deferred until the open PRs cleared, plus the
hand changes it turned up. Five commits, the mechanical one first so the rest
read clean on top of it.
format:the config, and the churn.clang-formatsaidAlignAfterOpenBracket: AlwaysBreak, which is a misnomer:it keeps a continuation aligned under the open paren, and clang-format 22
maps it to
true, which is alignment. The house style is an indent of 4everywhere, so this is
falseplus the fourBreakAfterOpenBracket*optionsthat keep an
if/while/switchcondition off the paren column, and thebraced-list pair that restores the break after
{thatAlwaysBreakused toprovide. No
PenaltyBreak*value and noBlockIndentgets there; both wereprobed.
Macros:teaches clang-format to expand the method macros toID PARAMETERS.Without it the parameter list is parsed as an expression, where
&is abinary operator, and the first parameter comes out as
Cat & a1— 49 sitesfixed:
The expansion omits the return type deliberately: with one in it, clang-format
breaks after the return type and indents the method name by 8.
BOOST_OPENMETHOD_OVERRIDERis left out because it appears in expressionposition (
...)::fn(args)), where the expansion never applies and only wrecksthe wrapping of the sites that do match.
dev/reformatis pinned toclang-format-22— 18 and 19 rejectBreakAfterOpenBracketFunctionas an unknown key and refuse to run at all —and now takes its file list from
git ls-files, having globbed a staleexamples/directory that has not existed for some time, which leftce/unformatted.
core:two predicates hoistedBoth were indented off the 4-column grid. clang-format measures a continuation
from the column of the enclosing bracket's content, so the
((of theclasses_agree_withfold put its operands at 13, 14 and 17, and the(insame_reference_categoryput its second operand at 38. No option moves any ofthem —
AlignAfterOpenBracketandAlignOperandswere probed in everycombination — but removing a level of nesting does. After this, every line in
the branch sits on a multiple of 4.
class_agrees_withcarries the diagnostic one class at a time, which is a realimprovement: the compiler now names the offending class and the two registries
in conflict, where the folded form could only report that a requirement failed
for the pack as a whole.
style:two conventionsdetail::more than once opens withusing namespace detail;and drops the qualification — 35 bodies. A singleuse does not earn one: every single-use body was tried and reformatted to
check, and none came out shorter.
return, except where thereturnopens its block.doc:CLAUDE.mdRecords both conventions, corrects the Formatting section (which still
advertised
AlwaysBreak), and writes down the three shapes clang-format cannotbe configured into, so they do not get re-litigated: the ternary break, the
::fnargument spacing, and theclang-format offfiles underdoc/modules/ROOT/examples/.Checks
/W4 /WX. Runlocally, not left to CI, since the 24 compile-fail tests and the export
spellings are the platform-divergent part. The 197 vs 202 is the
dynamic_loadinggroup, which the Windows configure does not register.Reviewing with
git show -wmakes the first commit nearly empty, which is thepoint: everything of substance is in the four that follow.
🤖 Generated with Claude Code