From 0322a184f1c5524bc3a77bd05f5bcdc1cc2e8b0b Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Fri, 28 Feb 2025 17:57:53 +0000 Subject: [PATCH 01/14] induce errors Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com> --- src/hello.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/hello.cpp b/src/hello.cpp index 0b4a159..d9d8572 100644 --- a/src/hello.cpp +++ b/src/hello.cpp @@ -1,10 +1,28 @@ #include #include -#include +class X +{ + std::string m_string; +public: + X(const std::string& str) : m_string(str) {} + + const std::string + get_string() + { + return m_string; + } +}; + +const std::string hello() +{ + std::string str = "hello"; + X x(str); + return x.get_string(); +} int main() { - std::cout << "hello" << std::endl; + std::cout << hello() << std::endl; return 0; } From 424326d9a3230064fb2faa888cbb34cd7ba9b45f Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Fri, 28 Feb 2025 10:01:23 -0800 Subject: [PATCH 02/14] Update clangtidy.yml --- .github/workflows/clangtidy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clangtidy.yml b/.github/workflows/clangtidy.yml index 1fed159..66fbc18 100644 --- a/.github/workflows/clangtidy.yml +++ b/.github/workflows/clangtidy.yml @@ -21,7 +21,7 @@ jobs: - name: Install clang-tidy run: | - sudo apt get install -y clang-tidy + sudo apt install -y clang-tidy - name: Build and generate compile_commands.json run: | From 322fb47c060d0663f95b36b65b2b2eec8614b04e Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Fri, 28 Feb 2025 10:05:15 -0800 Subject: [PATCH 03/14] Update CMakeLists.txt --- src/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 86b8ec5..36de04c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,9 +2,5 @@ if(POLICY CMP0167) cmake_policy(SET CMP0167 NEW) endif() -find_package(Boost REQUIRED) -message("-- Boost_INCLUDE_DIRS=${Boost_INCLUDE_DIRS}") - add_executable(main hello.cpp) -target_include_directories(main PRIVATE ${Boost_INCLUDE_DIRS}) install(TARGETS main) From fa31cd6da63e1aaff49e72475fbaaa5af57ad762 Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Fri, 28 Feb 2025 10:08:04 -0800 Subject: [PATCH 04/14] Update clangtidy.yml --- .github/workflows/clangtidy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clangtidy.yml b/.github/workflows/clangtidy.yml index 66fbc18..3074200 100644 --- a/.github/workflows/clangtidy.yml +++ b/.github/workflows/clangtidy.yml @@ -33,7 +33,7 @@ jobs: - name: Run clang-tidy run: | - git diff -U0 origin/${{ github.base_ref }}...HEAD \ + git diff -U0 origin/${{ github.base_ref }}...HEAD | \ clang-tidy-diff -p1 -path build -export-fixes build/Release/clang-tidy-fixes.yml - name: Post clang-tidy comments From ef0131c347a61ae9a5c3a0293b295f4e91ce30dd Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Fri, 28 Feb 2025 10:10:43 -0800 Subject: [PATCH 05/14] Update src/hello.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/hello.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hello.cpp b/src/hello.cpp index d9d8572..123d042 100644 --- a/src/hello.cpp +++ b/src/hello.cpp @@ -7,7 +7,7 @@ class X public: X(const std::string& str) : m_string(str) {} - const std::string + std::string get_string() { return m_string; From 16ce9734298275f33df062f3e0f72d32402ca967 Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Fri, 28 Feb 2025 10:10:51 -0800 Subject: [PATCH 06/14] Update src/hello.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/hello.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hello.cpp b/src/hello.cpp index 123d042..4d535b6 100644 --- a/src/hello.cpp +++ b/src/hello.cpp @@ -14,7 +14,7 @@ class X } }; -const std::string hello() +std::string hello() { std::string str = "hello"; X x(str); From 637f7aa435fc116c7e57598f8287d8d548d723ec Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Fri, 28 Feb 2025 10:10:59 -0800 Subject: [PATCH 07/14] Update src/hello.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/hello.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hello.cpp b/src/hello.cpp index 4d535b6..e4b5375 100644 --- a/src/hello.cpp +++ b/src/hello.cpp @@ -16,7 +16,7 @@ class X std::string hello() { - std::string str = "hello"; + std::string const str = "hello"; X x(str); return x.get_string(); } From 66b8d786f5391c4f7050d9cc395d82747f91eaf4 Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Fri, 28 Feb 2025 10:12:07 -0800 Subject: [PATCH 08/14] Update src/hello.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/hello.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hello.cpp b/src/hello.cpp index e4b5375..1953908 100644 --- a/src/hello.cpp +++ b/src/hello.cpp @@ -23,6 +23,6 @@ std::string hello() int main() { - std::cout << hello() << std::endl; + std::cout << hello() << '\n'; return 0; } From 4cb05d133f5811cd12c1112b282f719488a48848 Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Fri, 28 Feb 2025 10:25:44 -0800 Subject: [PATCH 09/14] Update clangtidy.yml --- .github/workflows/clangtidy.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/clangtidy.yml b/.github/workflows/clangtidy.yml index 3074200..1c71926 100644 --- a/.github/workflows/clangtidy.yml +++ b/.github/workflows/clangtidy.yml @@ -41,3 +41,7 @@ jobs: with: clang_tidy_fixes: build/Release/clang-tidy-fixes.yml github_token: ${{ secrets.GITHUB_TOKEN }} + + # If there are any comments, fail the check + - if: steps.review.outputs.total_comments > 0 + run: exit 1 From d26378d611e0c6d9534ba160de4b9bab779219e4 Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Fri, 28 Feb 2025 11:11:27 -0800 Subject: [PATCH 10/14] Update clangtidy.yml --- .github/workflows/clangtidy.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/clangtidy.yml b/.github/workflows/clangtidy.yml index 1c71926..2d18ecd 100644 --- a/.github/workflows/clangtidy.yml +++ b/.github/workflows/clangtidy.yml @@ -39,8 +39,7 @@ jobs: - name: Post clang-tidy comments uses: ZedThree/clang-tidy-review@v0.20.1 with: - clang_tidy_fixes: build/Release/clang-tidy-fixes.yml - github_token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} # If there are any comments, fail the check - if: steps.review.outputs.total_comments > 0 From 43ce5615079c80c569a2d0c02b9039446ec8b1fd Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Fri, 28 Feb 2025 11:17:52 -0800 Subject: [PATCH 11/14] Update clangtidy.yml --- .github/workflows/clangtidy.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/clangtidy.yml b/.github/workflows/clangtidy.yml index 2d18ecd..e67aa55 100644 --- a/.github/workflows/clangtidy.yml +++ b/.github/workflows/clangtidy.yml @@ -37,9 +37,10 @@ jobs: clang-tidy-diff -p1 -path build -export-fixes build/Release/clang-tidy-fixes.yml - name: Post clang-tidy comments - uses: ZedThree/clang-tidy-review@v0.20.1 + uses: ZedThree/clang-tidy-review@v0.14.0 with: - token: ${{ secrets.GITHUB_TOKEN }} + clang_tidy_fixes: build/Release/clang-tidy-fixes.yml + github_token: ${{ secrets.GITHUB_TOKEN }} # If there are any comments, fail the check - if: steps.review.outputs.total_comments > 0 From 8cd7a27ae3d38ad86f3e903d8e613505fc4769b6 Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Fri, 28 Feb 2025 11:51:05 -0800 Subject: [PATCH 12/14] Update clangtidy.yml --- .github/workflows/clangtidy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/clangtidy.yml b/.github/workflows/clangtidy.yml index e67aa55..f9305cb 100644 --- a/.github/workflows/clangtidy.yml +++ b/.github/workflows/clangtidy.yml @@ -37,10 +37,10 @@ jobs: clang-tidy-diff -p1 -path build -export-fixes build/Release/clang-tidy-fixes.yml - name: Post clang-tidy comments - uses: ZedThree/clang-tidy-review@v0.14.0 + uses: ZedThree/clang-tidy-review@v0.20.1 with: - clang_tidy_fixes: build/Release/clang-tidy-fixes.yml - github_token: ${{ secrets.GITHUB_TOKEN }} + build_dir: build/Release + token: ${{ secrets.GITHUB_TOKEN }} # If there are any comments, fail the check - if: steps.review.outputs.total_comments > 0 From c99cb8cd0936f158fc17c337097f8afb58113823 Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Fri, 28 Feb 2025 12:58:08 -0800 Subject: [PATCH 13/14] Update clangtidy.yml --- .github/workflows/clangtidy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/clangtidy.yml b/.github/workflows/clangtidy.yml index f9305cb..9949c38 100644 --- a/.github/workflows/clangtidy.yml +++ b/.github/workflows/clangtidy.yml @@ -37,7 +37,8 @@ jobs: clang-tidy-diff -p1 -path build -export-fixes build/Release/clang-tidy-fixes.yml - name: Post clang-tidy comments - uses: ZedThree/clang-tidy-review@v0.20.1 + #uses: ZedThree/clang-tidy-review@v0.20.1 + uses: stsoe/clang-tidy-review@6d2aee59f56cf41f32baa4123cc636fff8ef4eb7 with: build_dir: build/Release token: ${{ secrets.GITHUB_TOKEN }} From 532dff471d1d8739fcd3deae2441a66733ff7282 Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Fri, 28 Feb 2025 13:07:47 -0800 Subject: [PATCH 14/14] Update clangtidy.yml --- .github/workflows/clangtidy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/clangtidy.yml b/.github/workflows/clangtidy.yml index 9949c38..91b249c 100644 --- a/.github/workflows/clangtidy.yml +++ b/.github/workflows/clangtidy.yml @@ -41,6 +41,8 @@ jobs: uses: stsoe/clang-tidy-review@6d2aee59f56cf41f32baa4123cc636fff8ef4eb7 with: build_dir: build/Release + # disable default checks and rely on closest .clangtidy + clang_tidy_checks: '' token: ${{ secrets.GITHUB_TOKEN }} # If there are any comments, fail the check