Repository navigation
Adopt a C++ style so the lint check can pass - #28
Conversation
The Lint Code Base workflow runs clang-format and cpplint, but the
repository had no configuration for either, so both compared the code
with defaults it never followed and failed on any touched C++ file.
- .clang-format: Google style with this code base's four-space
indentation and a 120-column limit.
- CPPLINT.cfg: the same line length, header guards named from the path
under include/, and three checks left out with the reason for each:
build/c++11 (it rejects <mutex>, <thread> and <chrono>, which this
C++17 code uses), legal/copyright (the licence is in LICENSE) and
runtime/references (dropped from the style guide in 2020).
- test/CPPLINT.cfg: test sources may use namespace using-directives.
The 21 C++ files changed by the previous merge are formatted with
clang-format. To satisfy cpplint they also get: includes in standard
order, header guards renamed to the derived names, an explicit
single-argument constructor, <utility> where std::move is used, empty
loop bodies written as {}, static_cast instead of function-style casts,
snprintf instead of strcpy, and a few lines split to fit the limit.
No behaviour changes.
The rest of the code base is not reformatted yet; a file will need
formatting when it is next changed.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011vmiZ7F3rQu7dith9sQw71
The linter's clang-format build measures emoji a column or two wider than other builds, so two lines that just fitted in 120 columns were reported as needing a different wrap. Build those messages from shorter pieces so every build formats them the same way. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011vmiZ7F3rQu7dith9sQw71
| # Four-space indentation; access specifiers sit one space in, as cpplint expects. | ||
| IndentWidth: 4 | ||
| AccessModifierOffset: -3 |
There was a problem hiding this comment.
🟡 Formatter enforces the wrong indentation
IndentWidth enforces four-space indentation instead of the two spaces required by the Code Style Guidelines. Contributors cannot follow both the formatter and the documented rule.
Learn more
The repository's Code Style Guidelines require two-space indentation. The new formatter instead establishes four spaces as the repository-wide formatting policy, so running it preserves or creates violations of that requirement.
Example: Formatting a function body indents its statements by four spaces, while the contributor guideline requires two.
Recommended fix: Set IndentWidth to 2, adjust AccessModifierOffset to preserve the intended access-specifier placement, and reformat the affected files. If changing the repository policy is intended, explicitly reconcile the contributor guideline with that policy.
Was this helpful? React with 👍 or 👎 to provide feedback.
Description
Follow-up to #27. The
Lint Code Baseworkflow runs clang-format and cpplint, but the repository had no configuration for either, so both compared the code with defaults it never followed and failed on any pull request that touched a C++ file. This PR adds a style configuration and reformats the 21 C++ files changed by that merge. No linter is switched off.Type of Change
Related Issues
Related to #27
Changes Made
Style configuration
.clang-format: Google style (what cpplint verifies) with this code base's four-space indentation and a 120-column limit.CPPLINT.cfg: the same line length; header guards named from the path underinclude/; three checks left out, each with its reason in the file:build/c++11rejects<mutex>,<thread>,<chrono>and<system_error>outright. The code is C++17 and uses them, so this check cannot be satisfied.legal/copyright: there are no per-file copyright lines; the licence is inLICENSE.runtime/references: non-const reference parameters. The Google style guide dropped this rule in 2020 and current cpplint no longer checks it.test/CPPLINT.cfg: test sources may useusing namespace.The 21 files
test_comprehensive_e2e.cppnow includes project headers with quotes like the other tests;bolt.hpp,bracket_matcher.hppandnetwork_metrics.hpprenamed to the derived names;BandwidthTracker's single-argument constructor markedexplicit;<utility>included wherestd::moveis used;{};static_castinstead of function-style casts;snprintfinstead ofstrcpyin the GUI;using namespacelines in demo programs markedNOLINT.Testing
On commit
8044facf:Lint Code Basepasses, including clang-format, cpplint, the copy/paste detector and secret scanning.scripts/smoke_test.shpasses, including the GUI programs and model inference.Reviewer Notes
clang-format -i(and possibly cpplint fixes) the first time a later PR changes it. Reformatting everything at once is possible but is a much larger diff; say if you want it.macos-15runner labels. That does not affect this PR, which changes no workflow files, but it will fail the lint check on the next PR that touchese2e-ci.ymlorrelease.yml.🤖 Generated with Claude Code
https://claude.ai/code/session_011vmiZ7F3rQu7dith9sQw71