Adopt the STYLE_CPP.md additions from xff - #277
Merged
Merged
Conversation
xff's copy had grown several clarifications worth having here, adapted to mbo's names and to what mbo actually has. Notably one is a REVERSAL of the existing rule. The doc said "a by-value std::string_view is never const"; it now follows ordinary const-correctness - const when the view is never mutated, non-const exactly when it is resliced or reassigned - because misc-const-correctness (enabled) flags a never-mutated view that is not const. The corollary and a worked example are included, plus the companion rule that a read-only string parameter is std::string_view by value rather than const std::string&. Also adopted: trailing commas on every element of a registry-style table; "a value or error type IS absl::StatusOr<T>"; matchers named unqualified via `using`; mbo::testing::EqualsText with a DropIndent raw-string golden for multi-line text; ElementsAreArray with a trailing comma for long matcher lists; SizeIs/IsEmpty on the container instead of matching an extracted .size()/.empty(); and bashtest's content matchers with the whole-text anchoring caveat. The clang-tidy paragraph was also stale - it still claimed CI does not run clang-tidy, which #270 changed. It now describes the dedicated CI job, the changed-files-on-a-branch vs whole-tree-on-main scoping, and that it is report-only until the sweep lands. Deliberately not copied: xff's XFF_ macro prefix, xff/ paths and flags, its C++23 baseline, its com_helly25_bashtest repo name (mbo uses the default), its no-shell-grep-in-bashtests hook (mbo has none), and its diff_golden.bzl - the golden-file guidance instead points at mbo's own //mbo/diff:diff.bzl. Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
helly25
enabled auto-merge (squash)
August 8, 2026 23:37
Fab-Cat
approved these changes
Aug 9, 2026
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.
Docs only. Ports the clarifications that had accumulated in xff's
STYLE_CPP.md, adapted to mbo's names and to what mbo actually has.One is a reversal, and it matters
The doc said "a by-value
std::string_viewis neverconst". It now says the opposite: a by-value view follows ordinary const-correctness —constwhen never mutated, non-constexactly when resliced or reassigned. The reason is concrete:misc-const-correctnessis enabled and flags a never-mutated view that is notconst, so the old rule fought the linter. The corollary (iterate a mutable view and trim in place, rather thanconst+ copy-to-mutate) and a worked example are included, along with the companion rule that a read-only string parameter isstd::string_viewby value, notconst std::string&.Also adopted
absl::StatusOr<T>— do not hand-roll value + status + ok-flag.using ::testing::Foo;, never::testing::Foo(...)inline.mbo::testing::EqualsTextfor multi-line text, with aDropIndentraw-string golden (and the trailing-whitespace caveat, since thetrim trailing whitespacehook would silently edit a golden).ElementsAreArray({...,})with a trailing comma for long matcher lists.SizeIs/IsEmptyon the container, never a matched.size()/.empty().expect_output_contains,expect_matches) with the whole-text anchoring caveat.Fixed while here
The clang-tidy paragraph was stale: it still claimed "CI does not run it", which #270 changed. It now describes the dedicated
clang-tidyCI job, the changed-files-on-a-branch vs whole-tree-on-mainscoping, and that it is report-only until the sweep lands.Deliberately not copied
xff's
XFF_macro prefix,xff/paths and flag names, its C++23 baseline, itscom_helly25_bashtestrepo name (mbo uses the defaulthelly25_bashtest), itsno-shell-grep-in-bashtestspre-commit hook (mbo has no such hook, so claiming enforcement would be false), and itsdiff_golden.bzl— the golden-file guidance instead points at mbo's own//mbo/diff:diff.bzl.