Skip to content

Enforce clang-format 20 and commentflow in CI - #102

Merged
jserv merged 2 commits into
masterfrom
format
Nov 4, 2026
Merged

jserv merged 2 commits into
masterfrom
format

Conversation

@jserv

@jserv jserv commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

CI accepted any clang-format version and had no check on comment width, so formatting depended on who ran it. This pins clang-format to major version 20 and adds a commentflow gate (modeled on elfuse) that reflows comments to the column limit read from .clang-format. The existing comments were reflowed once; where the tool merged adjacent comments that were separate on purpose, I rewrote them as one comment with a blank line between paragraphs. The workflow also moves to actions/checkout@v7 on ubuntu-24.04, drops token permissions to read, cancels superseded PR runs, and adds a Dependabot config for the actions.

Left as is: commentflow is installed from its rolling latest release with the sha256 GitHub records for the asset, because upstream publishes no other tag. A new commentflow release can therefore change the reflow rules under an unchanged commit.


Summary by cubic

Pins CI to clang-format 20 and adds a commentflow gate so formatting and comment width no longer depend on which machine ran the checks.

  • The format gate now requires clang-format major version 20, with the workflow installing the pinned 20.1.8 so the formatter cannot drift under an unchanged commit; git or diff failures are errors, not passes.
  • Adds a commentflow check that reflows comments to the 80-column limit read from .clang-format, and reflows the existing comments once; comments the tool would merge are written as one comment with a blank line between paragraphs.
  • File lists in both check scripts are gathered NUL-delimited, so a failing git is an error and odd filenames stay one path; tracked files deleted from the worktree are skipped.
  • Moves the workflow to actions/checkout@v7 on ubuntu-24.04, limits token permissions to read, cancels superseded pull request runs, and adds Dependabot for the actions.
  • commentflow is installed from its rolling latest release with the sha256 taken from the GitHub API, so a new release could change the reflow rules without a commit change.

Written for commit c0f5f66. Summary will update on new commits.

View guided diff Turn on auto-fix

The format gate accepted whatever clang-format was installed, so the
tree could pass on one machine and fail on another. Pin it to major
version 20, enforced on any binary named through CLANG_FORMAT, and
fail with exit 2 when git or diff errors instead of passing.

Add a commentflow gate, modeled on the one in elfuse. clang-format
never refills a short-wrapped comment, so comment width was the one
part of the style no check settled. Reflow the existing comments to
the 80-column limit once; adjacent comments the tool would have merged
are written as one comment with a blank line between paragraphs.

The workflow now installs both tools, bumps actions/checkout to v7,
runs on ubuntu-24.04, drops default token permissions to read, and
cancels superseded pull request runs. Dependabot watches the actions.
cubic-dev-ai[bot]

This comment was marked as resolved.

Iterate the git file list NUL-delimited through a temporary file so a
failing git is still an error and odd filenames stay one path, skip
tracked files deleted from the worktree, and pin clang-format to
20.1.8 so the formatter cannot move under an unchanged commit.
@jserv
jserv merged commit 41f0624 into master Nov 4, 2026
7 checks passed
@jserv
jserv deleted the format branch November 4, 2026 03:52
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