From ff4ce5b63ee7a223746ddda459668b73a9faf958 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Mon, 12 Feb 2024 13:39:17 -0800 Subject: [PATCH 1/4] prepare to test branch test action CI --- .github/workflows/cpp-lint-action.yml | 15 +++++++++------ src/demo.cpp | 21 +++++++++++---------- src/demo.hpp | 11 +++-------- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/.github/workflows/cpp-lint-action.yml b/.github/workflows/cpp-lint-action.yml index 227e43a..0b58da6 100644 --- a/.github/workflows/cpp-lint-action.yml +++ b/.github/workflows/cpp-lint-action.yml @@ -3,6 +3,7 @@ name: cpp-linter as action on: workflow_dispatch: workflow_call: + pull_request: jobs: @@ -32,27 +33,29 @@ jobs: run: mkdir build && cmake -Bbuild src - name: Run linter as action - uses: cpp-linter/cpp-linter-action@latest + uses: cpp-linter/cpp-linter-action@dependabot/pip/cpp-linter-1.7.0 id: linter env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: style: file - files-changed-only: false + files-changed-only: true + lines-changed-only: true # to ignore all build folder contents ignore: build database: build - verbosity: 9 + verbosity: debug version: ${{ matrix.clang-version }} - thread-comments: ${{ matrix.clang-version == '12' }} - file-annotations: ${{ matrix.clang-version == '12' }} + thread-comments: ${{ matrix.clang-version == '16' }} + file-annotations: ${{ matrix.clang-version == '16' }} extra-args: -std=c++14 -Wall + tidy-review: ${{ matrix.clang-version == '16' }} + format-review: ${{ matrix.clang-version == '16' }} - name: Fail fast?! # if: steps.linter.outputs.checks-failed > 0 run: | echo "some linter checks failed" echo "${{ steps.linter.outputs.checks-failed }}" - echo "${{ env.checks-failed }}" # for actual deployment # run: exit 1 diff --git a/src/demo.cpp b/src/demo.cpp index 0c1db60..1bf553e 100644 --- a/src/demo.cpp +++ b/src/demo.cpp @@ -1,17 +1,18 @@ /** 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; } -int main() -{ - for (;;) - break; + + +int main(){ + + for (;;) break; + printf("Hello world!\n"); - return 0; -} + + + + return 0;} diff --git a/src/demo.hpp b/src/demo.hpp index 2695731..f93d012 100644 --- a/src/demo.hpp +++ b/src/demo.hpp @@ -5,12 +5,10 @@ class Dummy { char* useless; int numb; + Dummy() :numb(0), useless("\0"){} public: - void *not_usefull(char *str){ - useless = str; - return 0; - } + void *not_useful(char *str){useless = str;} }; @@ -28,14 +26,11 @@ class Dummy { - - - - struct LongDiff { + long diff; }; From ccbc293a9a5a155a4f8ed708b2b9b8e2fa0a399a Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Tue, 13 Feb 2024 10:22:41 -0800 Subject: [PATCH 2/4] test pkg again --- .github/workflows/cpp-lint-action.yml | 6 +++--- .github/workflows/cpp-lint-package.yml | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cpp-lint-action.yml b/.github/workflows/cpp-lint-action.yml index 0b58da6..062c805 100644 --- a/.github/workflows/cpp-lint-action.yml +++ b/.github/workflows/cpp-lint-action.yml @@ -3,7 +3,7 @@ name: cpp-linter as action on: workflow_dispatch: workflow_call: - pull_request: + # pull_request: jobs: @@ -44,13 +44,13 @@ jobs: # to ignore all build folder contents ignore: build database: build - verbosity: debug + # verbosity: debug version: ${{ matrix.clang-version }} thread-comments: ${{ matrix.clang-version == '16' }} file-annotations: ${{ matrix.clang-version == '16' }} extra-args: -std=c++14 -Wall tidy-review: ${{ matrix.clang-version == '16' }} - format-review: ${{ matrix.clang-version == '16' }} + # format-review: ${{ matrix.clang-version == '16' }} - name: Fail fast?! # if: steps.linter.outputs.checks-failed > 0 diff --git a/.github/workflows/cpp-lint-package.yml b/.github/workflows/cpp-lint-package.yml index 0418957..4b1f925 100644 --- a/.github/workflows/cpp-lint-package.yml +++ b/.github/workflows/cpp-lint-package.yml @@ -7,6 +7,7 @@ on: description: 'which branch to test' default: 'main' required: true + pull_request: jobs: cpp-linter: @@ -14,9 +15,9 @@ jobs: strategy: matrix: - clang-version: ['7', '8', '9','10', '11', '12', '13', '14', '15', '16', '17'] + clang-version: ['10', '11', '12', '13', '14', '15', '16', '17'] repo: ['cpp-linter/cpp-linter'] - branch: ['${{ inputs.branch }}'] + branch: ['address-75'] # ['${{ inputs.branch }}'] fail-fast: false steps: @@ -42,7 +43,7 @@ jobs: - name: Cache the build artifacts id: cache-build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: build key: ${{ hashFiles('src/CMakeLists.txt', 'src/demo.cpp', 'src/demo.hpp') }} @@ -62,10 +63,11 @@ jobs: -i=build -p=build -V=${{ runner.temp }}/llvm - -f=false + --files-changed-only=true + --lines-changed-only=true --extra-arg="-std=c++14 -Wall" - --thread-comments=${{ matrix.clang-version == '12' }} - -a=${{ matrix.clang-version == '12' }} + --thread-comments=${{ matrix.clang-version == '16' }} + -a=${{ matrix.clang-version == '16' }} - name: Fail fast?! if: steps.linter.outputs.checks-failed > 0 From 50ec57bf0225b3ccb767344f5ace855aeb6853b7 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Tue, 13 Feb 2024 10:27:11 -0800 Subject: [PATCH 3/4] enable tidy-review --- .github/workflows/cpp-lint-package.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cpp-lint-package.yml b/.github/workflows/cpp-lint-package.yml index 4b1f925..d7d5681 100644 --- a/.github/workflows/cpp-lint-package.yml +++ b/.github/workflows/cpp-lint-package.yml @@ -57,17 +57,18 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: > - cpp-linter - -s=file - -v=9 - -i=build - -p=build - -V=${{ runner.temp }}/llvm + cpp-linter + -s=file + -v=9 + -i=build + -p=build + -V=${{ runner.temp }}/llvm --files-changed-only=true --lines-changed-only=true - --extra-arg="-std=c++14 -Wall" - --thread-comments=${{ matrix.clang-version == '16' }} - -a=${{ matrix.clang-version == '16' }} + --extra-arg="-std=c++14 -Wall" + --thread-comments=${{ matrix.clang-version == '16' }} + --file-annotations=${{ matrix.clang-version == '16' }} + --tidy-review=${{ matrix.clang-version == '16' }} - name: Fail fast?! if: steps.linter.outputs.checks-failed > 0 From c380b291643721050c278c2206754822caa234be Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Tue, 13 Feb 2024 10:52:19 -0800 Subject: [PATCH 4/4] disable lines-changed-only --- .github/workflows/cpp-lint-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cpp-lint-package.yml b/.github/workflows/cpp-lint-package.yml index d7d5681..bca1c2e 100644 --- a/.github/workflows/cpp-lint-package.yml +++ b/.github/workflows/cpp-lint-package.yml @@ -64,7 +64,7 @@ jobs: -p=build -V=${{ runner.temp }}/llvm --files-changed-only=true - --lines-changed-only=true + --lines-changed-only=false --extra-arg="-std=c++14 -Wall" --thread-comments=${{ matrix.clang-version == '16' }} --file-annotations=${{ matrix.clang-version == '16' }}