8000 Document clang-format usage in CONTRIBUTING.md by MaxonT · Pull Request #5560 · google/xls · GitHub
[go: up one dir, main page]

Skip to content

Document clang-format usage in CONTRIBUTING.md - #5560

Open
MaxonT wants to merge 1 commit into
google:mainfrom
MaxonT:contrib/125-auto
Open

MaxonT wants to merge 1 commit into
google:mainfrom
MaxonT:contrib/125-auto

Conversation

@MaxonT
@MaxonT MaxonT commented Nov 25, 2026
Copy link
Copy Markdown

Having the formatting rules in one place is a good idea for XLS, since CONTRIBUTING.md has nothing on clang-format right now, so I wrote up the steps there.

Add a "Formatting C++ code" section to CONTRIBUTING.md (and its docs_src copy, which is the source of truth) describing how to format C++ changes with clang-format using the existing .clang-format file, and how to check files without modifying them.

The commands documented were run locally with clang-format 23.1.1:

  • clang-format --dry-run --Werror <file> exits 0 on an already formatted file (xls/dslx/frontend/scanner.cc) and exits 1 on a misformatted file.
  • With a deliberately misformatted line staged in a tracked file, git clang-format --diff reports a diff; with the same edit unstaged, plain git clang-format refuses to run (exit 2), which the text now says.

This does not add a CI check; the issue also mentions continuous integration, which is left for a separate change.

Refs #125

Not verified: behavior with other clang-format versions, and whether the clang-format version used by Google's internal tooling matches.

Signed-off-by: Ym <173550318+MaxonT@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

1 participant

0