From ba8836adc411c15e04cea39f9c70808ae36f1118 Mon Sep 17 00:00:00 2001 From: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com> Date: Thu, 15 Oct 2026 20:54:42 +0000 Subject: [PATCH 1/6] ci: temporary workflow to test cpp-linter-action#501 --- .github/workflows/test-action-pr501.yml | 110 ++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 .github/workflows/test-action-pr501.yml diff --git a/.github/workflows/test-action-pr501.yml b/.github/workflows/test-action-pr501.yml new file mode 100644 index 0000000..0bc2a1a --- /dev/null +++ b/.github/workflows/test-action-pr501.yml @@ -0,0 +1,110 @@ +# Temporary: end-to-end check of cpp-linter/cpp-linter-action#501 +# (cpp-linter 1.14.1 -> 1.15.0). Remove after the test. +name: test action#501 + +on: + push: + branches: [claude/project-thread-c0ojvi] + pull_request: + branches: [master] + +permissions: + contents: write + pull-requests: write + +jobs: + candidate: + name: "#501 ${{ matrix.os }}" + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest, windows-11-arm] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Generate compilation database + run: cmake -Bbuild src + - name: Run cpp-linter-action at #501 head + uses: cpp-linter/cpp-linter-action@73198305cd5302ac662f2c2d8643fc1b1d7faa91 + id: linter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + style: file + version: '20' + ignore: build + database: build + verbosity: debug + extra-args: -std=c++14 -Wall + files-changed-only: ${{ github.event_name == 'pull_request' }} + step-summary: true + file-annotations: true + thread-comments: ${{ matrix.os == 'ubuntu-latest' && 'update' || 'false' }} + tidy-review: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' }} + format-review: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' }} + - name: Outputs + shell: bash + run: | + echo "total: ${{ steps.linter.outputs.checks-failed }}" + echo "clang-format: ${{ steps.linter.outputs.clang-format-checks-failed }}" + echo "clang-tidy: ${{ steps.linter.outputs.clang-tidy-checks-failed }}" + + baseline: + name: "main ${{ matrix.os }}" + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest, windows-11-arm] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Generate compilation database + run: cmake -Bbuild src + - name: Run cpp-linter-action at main (cpp-linter 1.14.1) + uses: cpp-linter/cpp-linter-action@67c436ebf4900ba3f8240bc69c7d7740d99d293e + id: linter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + style: file + version: '20' + ignore: build + database: build + verbosity: debug + extra-args: -std=c++14 -Wall + files-changed-only: ${{ github.event_name == 'pull_request' }} + step-summary: true + file-annotations: false + thread-comments: false + - name: Outputs + shell: bash + run: | + echo "total: ${{ steps.linter.outputs.checks-failed }}" + echo "clang-format: ${{ steps.linter.outputs.clang-format-checks-failed }}" + echo "clang-tidy: ${{ steps.linter.outputs.clang-tidy-checks-failed }}" + + auto-fix: + name: "#501 auto-fix" + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + with: + ref: ${{ github.head_ref }} + - name: Run cpp-linter-action at #501 head with auto-fix + uses: cpp-linter/cpp-linter-action@73198305cd5302ac662f2c2d8643fc1b1d7faa91 + id: linter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + style: file + version: '20' + tidy-checks: '-*' + files-changed-only: true + thread-comments: false + step-summary: true + auto-fix: true From f25c493442c76765eb21ae84587fee32eafda6c3 Mon Sep 17 00:00:00 2001 From: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com> Date: Thu, 15 Oct 2026 20:54:51 +0000 Subject: [PATCH 2/6] test: add badly formatted code for the PR review check --- src/demo.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/demo.cpp b/src/demo.cpp index 0c1db60..3fb4fe1 100644 --- a/src/demo.cpp +++ b/src/demo.cpp @@ -15,3 +15,10 @@ int main() return 0; } + +// added to test cpp-linter-action#501 (temporary) +int addNumbers( int a,int b ){ + int* unused = NULL; + if(a>b) return a+b; + return b+a ; +} From 1b8ba77cdffc790777ef6dcc993846d5d944ee60 Mon Sep 17 00:00:00 2001 From: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> Date: Thu, 15 Oct 2026 20:55:42 +0000 Subject: [PATCH 3/6] style: apply clang-format fixes --- src/demo.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/demo.cpp b/src/demo.cpp index 3fb4fe1..5b35f1e 100644 --- a/src/demo.cpp +++ b/src/demo.cpp @@ -1,7 +1,7 @@ /** This is a very ugly test code (doomed to fail linting) */ #include "demo.hpp" -#include #include +#include // using size_t from cstddef size_t dummyFunc(size_t i) { return i; } @@ -17,8 +17,10 @@ int main() } // added to test cpp-linter-action#501 (temporary) -int addNumbers( int a,int b ){ +int addNumbers(int a, int b) +{ int* unused = NULL; - if(a>b) return a+b; - return b+a ; + if (a > b) + return a + b; + return b + a; } From 9171b88fed39b2b6cf878414a78911e1cd28226a Mon Sep 17 00:00:00 2001 From: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com> Date: Thu, 15 Oct 2026 21:00:32 +0000 Subject: [PATCH 4/6] test: second round, run auto-fix after the review job --- .github/workflows/test-action-pr501.yml | 2 ++ src/demo.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/test-action-pr501.yml b/.github/workflows/test-action-pr501.yml index 0bc2a1a..dc41e29 100644 --- a/.github/workflows/test-action-pr501.yml +++ b/.github/workflows/test-action-pr501.yml @@ -90,6 +90,8 @@ jobs: auto-fix: name: "#501 auto-fix" if: github.event_name == 'pull_request' + # run after the review job so the pushed fix does not change the PR diff mid-review + needs: candidate runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 diff --git a/src/demo.cpp b/src/demo.cpp index 5b35f1e..ff7f875 100644 --- a/src/demo.cpp +++ b/src/demo.cpp @@ -24,3 +24,6 @@ int addNumbers(int a, int b) return a + b; return b + a; } + +// second round (temporary) +int subtract( int x,int y ){ return x-y ; } From 4ac7e8061bfd905fcfea994125d817f1d784d5e9 Mon Sep 17 00:00:00 2001 From: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com> Date: Thu, 15 Oct 2026 21:00:43 +0000 Subject: [PATCH 5/6] test: run auto-fix even if one platform fails --- .github/workflows/test-action-pr501.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-action-pr501.yml b/.github/workflows/test-action-pr501.yml index dc41e29..b266db3 100644 --- a/.github/workflows/test-action-pr501.yml +++ b/.github/workflows/test-action-pr501.yml @@ -89,7 +89,7 @@ jobs: auto-fix: name: "#501 auto-fix" - if: github.event_name == 'pull_request' + if: always() && github.event_name == 'pull_request' # run after the review job so the pushed fix does not change the PR diff mid-review needs: candidate runs-on: ubuntu-latest From 83a64e3281767e1bf0d420f9ae547f4c797936c3 Mon Sep 17 00:00:00 2001 From: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com> Date: Thu, 15 Oct 2026 21:05:41 +0000 Subject: [PATCH 6/6] style: apply clang-format fixes --- src/demo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/demo.cpp b/src/demo.cpp index ff7f875..d177457 100644 --- a/src/demo.cpp +++ b/src/demo.cpp @@ -26,4 +26,4 @@ int addNumbers(int a, int b) } // second round (temporary) -int subtract( int x,int y ){ return x-y ; } +int subtract(int x, int y) { return x - y; }