Skip to content

Fix #690: Apply clang-format consistently with CI#691

Merged
lefticus merged 9 commits intoChaiScript:developfrom
leftibot:fix/issue-690-apply-clang-format-consistently-with-ci
Apr 18, 2026
Merged

Fix #690: Apply clang-format consistently with CI#691
lefticus merged 9 commits intoChaiScript:developfrom
leftibot:fix/issue-690-apply-clang-format-consistently-with-ci

Conversation

@leftibot
Copy link
Copy Markdown
Contributor

Automated fix by @leftibot.

What changed

Fix #690: Apply clang-format consistently with CI
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]

Files

 .github/workflows/auto-clang-format.yml            |    23 +
 emscripten/chaiscript_eval.hpp                     |    10 +-
 include/chaiscript/chaiscript_stdlib.hpp           |     4 +-
 include/chaiscript/dispatchkit/dynamic_object.hpp  |     1 -
 .../dispatchkit/dynamic_object_detail.hpp          |    10 +-
 .../chaiscript/dispatchkit/function_signature.hpp  |    16 +-
 include/chaiscript/dispatchkit/handle_return.hpp   |     8 +-
 include/chaiscript/dispatchkit/proxy_functions.hpp |    14 +-
 .../dispatchkit/proxy_functions_detail.hpp         |    20 +-
 .../chaiscript/dispatchkit/type_conversions.hpp    |     5 +-
 include/chaiscript/language/chaiscript_common.hpp  |    12 +-
 include/chaiscript/language/chaiscript_engine.hpp  |     8 +-
 include/chaiscript/language/chaiscript_eval.hpp    |    15 +-
 include/chaiscript/utility/json_wrap.hpp           |     2 +-
 unittests/catch.hpp                                | 25242 ++++++++++---------
 unittests/compiled_tests.cpp                       |   120 +-
 unittests/emscripten_eval_test.cpp                 |     2 +-
 unittests/emscripten_exception_test.cpp            |     2 +-
 unittests/multifile_test_chai.cpp                  |     4 +-
 unittests/type_info_test.cpp                       |    32 +-
 20 files changed, 12863 insertions(+), 12687 deletions(-)

Closes #690

Triggered by @lefticus.

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]>
@lefticus
Copy link
Copy Markdown
Member

@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]>
@leftibot
Copy link
Copy Markdown
Contributor Author

Addressed review feedback from @lefticus. New commits:

d2f1b61d Address review: fix auto-clang-format detached HEAD error

lefticus and others added 2 commits April 15, 2026 16:32
…-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]>
@leftibot
Copy link
Copy Markdown
Contributor Author

Addressed review feedback from @lefticus. New commits:

83873a33 Address review: restore ref option to fix detached HEAD in auto-clang-format

lefticus and others added 2 commits April 15, 2026 16:39
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]>
@leftibot
Copy link
Copy Markdown
Contributor Author

Addressed review feedback from @lefticus. New commits:

04159106 Address review: fix auto-clang-format checkout for fork PRs

@lefticus
Copy link
Copy Markdown
Member

@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 develop and master on each push maybe

…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]>
@leftibot
Copy link
Copy Markdown
Contributor Author

Addressed review feedback from @lefticus. New commits:

4ce95776 Address review: run auto-clang-format on push to develop/master instead of PRs

@lefticus
Copy link
Copy Markdown
Member

@leftibot update the clang-format file so that short expressions / statements will stay on one line, to minimize diffs with develop (see PR for what diffs occurred) then re-run the clang-format process locally before pushing

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]>
@leftibot
Copy link
Copy Markdown
Contributor Author

Addressed review feedback from @lefticus. New commits:

7c5e4b26 Address review: update .clang-format for short expressions on one line

@lefticus
Copy link
Copy Markdown
Member

@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]>
@leftibot
Copy link
Copy Markdown
Contributor Author

Addressed review feedback from @lefticus. New commits:

8b9cd411 Address review: exclude unittests/catch.hpp from clang-format and revert changes

@lefticus lefticus merged commit 9680c93 into ChaiScript:develop Apr 18, 2026
21 of 22 checks passed
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.

Apply clang-format consistently with CI

2 participants