Skip to content

chore: Exclude vendored and generated code from clang-format - #630

Merged
krlmlr merged 1 commit into
mainfrom
claude/clang-format
Nov 29, 2026
Merged

krlmlr merged 1 commit into
mainfrom
claude/clang-format

Conversation

@krlmlr

@krlmlr krlmlr commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

.clang-format already exists and every top-level src/ C/C++ file already conforms to it, so this PR is configuration only: it adds a root .clang-format-ignore and lists it in .Rbuildignore (which already lists .clang-format). The CI style action runs clang-format over src/*.{c,cc,cpp,h,hpp} whenever .clang-format exists, so generated code has to be excluded explicitly. The planned formatting commit is empty and therefore skipped: there is nothing to format.

Excluded patterns, in .clang-format-ignore:

  • src/vendor/**: vendored Boost headers (1406 files), replaced wholesale on upgrade. They do not conform (verified: without the ignore file src/vendor/boost/limits.hpp is reported), so keeping them out matters if the CI glob ever widens.
  • src/cpp11.cpp: generated by cpp11::cpp_register(). It carries // clang-format off, which already keeps clang-format away today; the ignore file makes the exclusion independent of that marker, which a future cpp11::cpp_register() might not emit.

Repo docs consulted: .github/CONTRIBUTING.md and .github/copilot-instructions.md (nothing on formatting or vendoring); no AGENTS.md, CLAUDE.md or handbook/. There is no PR template.

How byte-identity was checked: no compiled input changed. git diff --stat origin/main..HEAD touches only .Rbuildignore (+1 line) and .clang-format-ignore (new, 4 lines), so a build comparison is unnecessary and was not done. With clang-format 21.1.8: clang-format --dry-run -Werror over src/*.c src/*.cpp src/*.h (the CI file set) exits 0; the same command on src/vendor/boost/limits.hpp and src/cpp11.cpp exits 0 with no output (ignored). R CMD build --no-build-vignettes produces a tarball containing no .clang-format* file (the only clang matches are Boost's own clang.hpp and clang_version.hpp).

https://claude.ai/code/session_01Hr1rd3zHUSUZLRSv2YuHbe


Generated by Claude Code

Add a root .clang-format-ignore for src/vendor/** and the cpp11-generated
src/cpp11.cpp, and keep it out of the built package.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd3zHUSUZLRSv2YuHbe

krlmlr commented Nov 29, 2026

Copy link
Copy Markdown
Member Author

Accepted limitations

None. The clean review found nothing above Low; its Low notes (repository-root-relative patterns, and that CI's top-level glob never reaches src/vendor/ anyway, so the exclusion guards manual and editor runs) need no change.


Generated by Claude Code

@krlmlr
krlmlr marked this pull request as ready for review November 29, 2026 11:21
@krlmlr
krlmlr merged commit f7e7f10 into main Nov 29, 2026
9 checks passed
@krlmlr
krlmlr deleted the claude/clang-format branch November 29, 2026 16:03
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.

2 participants