Fix #690: Apply clang-format consistently with CI#691
Conversation
Applied clang-format-19 to all source files to enforce consistent formatting according to the existing .clang-format configuration. Added auto-clang-format GitHub Actions workflow (from cpp-best-practices/cmake_template) that runs on pull requests to automatically format and commit any style violations going forward. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
@leftibot investigate error in auto-clang-format action on the PR |
actions/checkout@v6 defaults to checking out the PR merge ref in detached HEAD state, causing EndBug/add-and-commit to fail with "fatal: You are not currently on a branch." Fix by explicitly checking out the PR's head branch via github.head_ref. Requested by @lefticus in PR ChaiScript#691 review. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Addressed review feedback from @lefticus. New commits: |
…-format The previous commit (5fc11e6) incorrectly removed the ref option from the checkout step. actions/checkout@v6 on pull_request events defaults to the merge ref (detached HEAD), so ref: github.head_ref is required for EndBug/add-and-commit to push back to the PR branch. Requested by @lefticus in PR ChaiScript#691 review. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Addressed review feedback from @lefticus. New commits: |
Updated the checkout action to support fallback for branch reference.
Use github.event.pull_request.head.repo.full_name and github.event.pull_request.head.ref to correctly check out the PR branch when the PR originates from a fork repository. Requested by @lefticus in PR ChaiScript#691 review. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Addressed review feedback from @lefticus. New commits: |
|
@leftibot here's the problem: we've overcomplicated the checkout command - that's not what's causing the failure. The real failure is that this tries to push to the fork's branch the corrected changes, and we cannot push to the fork's branch. So... I guess we just need to apply this to |
…ad of PRs The workflow cannot push back to fork branches, so running on pull_request was fundamentally broken for fork PRs. Changed trigger to push on develop and master branches, and simplified checkout (no fork-specific options needed). Requested by @lefticus in PR ChaiScript#691 review. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Addressed review feedback from @lefticus. New commits: |
|
@leftibot update the clang-format file so that short expressions / statements will stay on one line, to minimize diffs with |
Updated .clang-format to minimize diffs with develop by enabling AllowShort* options (blocks, case labels, enums, if statements, loops) and adding IfMacros/SpaceBeforeParens settings so SECTION() blocks stay on one line. Added PackConstructorInitializers: CurrentLine. Re-ran clang-format-19 on all source files with the new config. Note: AllowShortEnumsOnASingleLine and PackConstructorInitializers do not take effect with ColumnLimit: 0 (a known clang-format limitation), so a few short enums and constructor initializers in tests are still expanded. Requested by @lefticus in PR ChaiScript#691 review. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Addressed review feedback from @lefticus. New commits: |
|
@leftibot make sure unittests/catch.hpp is excluded, and revert the changes to that file |
…ert changes Reverted all formatting changes to unittests/catch.hpp (third-party vendored header) and added it to the exclude list in auto-clang-format.yml so it won't be reformatted in future runs. Requested by @lefticus in PR ChaiScript#691 review. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Addressed review feedback from @lefticus. New commits: |
Automated fix by @leftibot.
What changed
Files
Closes #690
Triggered by @lefticus.