Repository navigation
THRIFT-6219: Check formatting of changed C++ lines only - #3976
slachiewicz wants to merge 1 commit into
Conversation
|
@Jens-G, is this the direction you want for THRIFT-6219? It takes the ticket's second option, adjusting |
Client: cpp The added .clang-format options describe lib/cpp as it is written, so formatting a change no longer rewrites lines it did not touch. Do not drop them without reformatting lib/cpp in the same change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6fc1ff1 to
5e08ce1
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The incremental C++ formatting enforcement changes have no active review issues.
No open issues 🎉
What changed in this PR
Adds incremental C++ formatting enforcement for lib/cpp, checking only changed lines to avoid reformatting legacy code. The check excludes compiler/cpp and test/cpp.
Changes:
- Adds a pull-request workflow using clang-format 18, including
.tccfiles. - Adjusts six formatting options to better match existing C++ style.
- Preserves the Base64 decode table’s layout with formatting-disable comments.
| File | Description |
|---|---|
lib/cpp/src/thrift/protocol/TBase64Utils.cpp |
Excludes the decode table from formatting without changing runtime behavior. |
.github/workflows/cpp-format.yml |
Checks changed lines in lib/cpp and reports formatting failures. |
.clang-format |
Aligns formatting settings with existing code conventions. |
Review effort: Balanced
Code reviewThis is a code-level review only. It does not answer the direction question above. No issues found. Checked for bugs and CLAUDE.md compliance. I ran the gate's exact command with clang-format 18.1.3 on merge commits built the way
The 149 → 104 file counts for Suggestion, not a blocker: the fix hint can reformat lines the PR never touched. CONTRIBUTING.md has contributors clone their fork, so thrift/.github/workflows/cpp-format.yml Lines 65 to 67 in 5e08ce1 |
|
@slachiewicz, thanks for the groundwork. I'd prefer the one-time reformat. With only changed lines checked, most of So, in this PR:
Once this is merged, its commit can go into a new Drafted with AI assistance (Claude Opus 5.5); reviewed and posted by Jens Geyer. |
Adds a CI job that runs clang-format 18 on the lines a pull request changes in
lib/cpp, so.clang-formatis enforced from now on without reformatting existing code.Six options are added to
.clang-formatso that it describeslib/cppas it is written:FixNamespaceComments,ReflowComments,SortIncludes,BinPackArguments,SortUsingDeclarationsandSpacesInLineCommentPrefix. The Base64 decode table is excluded with// clang-format off. With both, formatting all oflib/cpp/srcchanges 104 files and 1,583 lines, down from 149 files and 2,674. The remainder are files with a local style of their own (indented#if, nested namespaces on one line, aligned enum values) that no global option matches.The job does not cover
compiler/cpportest/cpp.Verified:
git-clang-format-18 --diff HEAD^ -- lib/cppexits 1 on a misformatted line in a.tccfile, and 0 on a correctly formatted change and on a change without C++ files.[skip ci]anywhere in the commit message to free up build resources.Generated-by: Claude Opus 5.5