From 703596ea8d422dec64c61f2c11aa5c4ee2a919ab Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 1 Jul 2025 20:44:28 +0300 Subject: [PATCH 01/11] feat: add more clang versions for testing --- testing/pre-commit-config-version.yaml | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/testing/pre-commit-config-version.yaml b/testing/pre-commit-config-version.yaml index 5b7b9b9..dbb8f55 100644 --- a/testing/pre-commit-config-version.yaml +++ b/testing/pre-commit-config-version.yaml @@ -6,3 +6,31 @@ repos: args: [--style=file, --version=16] # to load .clang-format - id: clang-tidy args: [--checks=.clang-tidy, --version=16] # path/to/.clang-tidy + - repo: . + rev: HEAD + hooks: + - id: clang-format + args: [--style=file, --version=17] + - id: clang-tidy + args: [--checks=.clang-tidy, --version=17] + - repo: . + rev: HEAD + hooks: + - id: clang-format + args: [--style=file, --version=18] + - id: clang-tidy + args: [--checks=.clang-tidy, --version=18] + - repo: . + rev: HEAD + hooks: + - id: clang-format + args: [--style=file, --version=19] + - id: clang-tidy + args: [--checks=.clang-tidy, --version=19] + - repo: . + rev: HEAD + hooks: + - id: clang-format + args: [--style=file, --version=20] + - id: clang-tidy + args: [--checks=.clang-tidy, --version=20] From 145fdda5006a28352cea7a8d9c9549e0489cebf3 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 1 Jul 2025 20:47:10 +0300 Subject: [PATCH 02/11] chore: update .clang-tidy --- testing/.clang-tidy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/.clang-tidy b/testing/.clang-tidy index 36fb3ab..de19304 100644 --- a/testing/.clang-tidy +++ b/testing/.clang-tidy @@ -2,7 +2,7 @@ Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,performance-*,bugprone-*,clang-analyzer-*,mpi-*,misc-*,readability-*' WarningsAsErrors: '' HeaderFilterRegex: '' -AnalyzeTemporaryDtors: false +# AnalyzeTemporaryDtors: false # Remove or comment this line FormatStyle: 'file' CheckOptions: - key: bugprone-argument-comment.CommentBoolLiterals From 8ae461dd46481bb6a4c5c60ebd54f2f92b23dc81 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 1 Jul 2025 20:52:33 +0300 Subject: [PATCH 03/11] chore: update .clang-format and install headers --- .github/workflows/test.yml | 3 +++ testing/.clang-format | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index abb783d..e024dc1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,5 +40,8 @@ jobs: files: ./coverage.xml fail_ci_if_error: true # optional (default = false) verbose: true # optional (default = false) + + - name: Install C devlopment headers + run: sudo apt-get update && sudo apt-get install -y build-essential - name: Test cpp-linter-hooks run: sh testing/run.sh diff --git a/testing/.clang-format b/testing/.clang-format index 1dd236c..0ce9f95 100644 --- a/testing/.clang-format +++ b/testing/.clang-format @@ -1,3 +1,3 @@ --- -Language: Cpp +Language: C BasedOnStyle: WebKit From 1d2181d3595f8ef285f219c5df421076e70e90c5 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 1 Jul 2025 20:54:49 +0300 Subject: [PATCH 04/11] chore: update .clang-format --- testing/.clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/.clang-format b/testing/.clang-format index 0ce9f95..1dd236c 100644 --- a/testing/.clang-format +++ b/testing/.clang-format @@ -1,3 +1,3 @@ --- -Language: C +Language: Cpp BasedOnStyle: WebKit From e9d7cc0b6f63a6258b1ceb41f8474d94922803b1 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 1 Jul 2025 20:57:11 +0300 Subject: [PATCH 05/11] chore: install libc6-dev for testing --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e024dc1..d9872f3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,6 +42,6 @@ jobs: verbose: true # optional (default = false) - name: Install C devlopment headers - run: sudo apt-get update && sudo apt-get install -y build-essential + run: sudo apt-get update && sudo apt-get install -y build-essential libc6-dev - name: Test cpp-linter-hooks run: sh testing/run.sh From 77bfac4bf1284d60c8118f3bde284bec92f129b9 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 1 Jul 2025 21:00:07 +0300 Subject: [PATCH 06/11] chore: continue-on-error: true --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d9872f3..572ed42 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,3 +45,4 @@ jobs: run: sudo apt-get update && sudo apt-get install -y build-essential libc6-dev - name: Test cpp-linter-hooks run: sh testing/run.sh + continue-on-error: true From 87273ac048463a95e9b56e4b9f5daa68aaf90f63 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 1 Jul 2025 21:05:25 +0300 Subject: [PATCH 07/11] chore: update failed test results --- .github/workflows/test.yml | 1 - testing/run.sh | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 572ed42..d9872f3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,4 +45,3 @@ jobs: run: sudo apt-get update && sudo apt-get install -y build-essential libc6-dev - name: Test cpp-linter-hooks run: sh testing/run.sh - continue-on-error: true diff --git a/testing/run.sh b/testing/run.sh index 7a88fcc..d126575 100644 --- a/testing/run.sh +++ b/testing/run.sh @@ -9,7 +9,9 @@ done failed_cases=`grep -c "Failed" result.txt` -if [ $failed_cases -eq 4 ]; then +echo $failed_cases " cases failed." + +if [ $failed_cases -eq 12 ]; then echo "==============================" echo "Test cpp-linter-hooks success." echo "==============================" From c4497095c655e40a0d12eb8cf9f9e7e4eb2840a6 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 1 Jul 2025 21:10:50 +0300 Subject: [PATCH 08/11] chore: test more clang versiion --- testing/run.sh | 2 +- tests/test_clang_format.py | 8 ++++++++ tests/test_clang_tidy.py | 8 ++++++++ tests/test_util.py | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/testing/run.sh b/testing/run.sh index d126575..34725f1 100644 --- a/testing/run.sh +++ b/testing/run.sh @@ -11,7 +11,7 @@ failed_cases=`grep -c "Failed" result.txt` echo $failed_cases " cases failed." -if [ $failed_cases -eq 12 ]; then +if [ $failed_cases -eq 9 ]; then echo "==============================" echo "Test cpp-linter-hooks success." echo "==============================" diff --git a/tests/test_clang_format.py b/tests/test_clang_format.py index 7a1b7b7..ac26881 100644 --- a/tests/test_clang_format.py +++ b/tests/test_clang_format.py @@ -8,6 +8,10 @@ ('args', 'expected_retval'), ( (['--style=Google'], (0, "")), (['--style=Google', '--version=16'], (0, "")), + (['--style=Google', '--version=17'], (0, "")), + (['--style=Google', '--version=18'], (0, "")), + (['--style=Google', '--version=19'], (0, "")), + (['--style=Google', '--version=20'], (0, "")), ), ) def test_run_clang_format_valid(args, expected_retval, tmp_path): @@ -23,6 +27,10 @@ def test_run_clang_format_valid(args, expected_retval, tmp_path): ('args', 'expected_retval'), ( (['--style=Google',], 1), (['--style=Google', '--version=16'], 1), + (['--style=Google', '--version=17'], 1), + (['--style=Google', '--version=18'], 1), + (['--style=Google', '--version=19'], 1), + (['--style=Google', '--version=20'], 1), ), ) def test_run_clang_format_invalid(args, expected_retval, tmp_path): diff --git a/tests/test_clang_tidy.py b/tests/test_clang_tidy.py index a62203b..cb6fbaf 100644 --- a/tests/test_clang_tidy.py +++ b/tests/test_clang_tidy.py @@ -16,6 +16,10 @@ def generate_compilation_database(): ('args', 'expected_retval'), ( (['--checks="boost-*"'], 1), (['--checks="boost-*"', '--version=16'], 1), + (['--checks="boost-*"', '--version=17'], 1), + (['--checks="boost-*"', '--version=18'], 1), + (['--checks="boost-*"', '--version=19'], 1), + (['--checks="boost-*"', '--version=20'], 1), ), ) def test_run_clang_tidy_valid(args, expected_retval): @@ -31,6 +35,10 @@ def test_run_clang_tidy_valid(args, expected_retval): ('args', 'expected_retval'), ( (['--checks="boost-*"'], 1), (['--checks="boost-*"', '--version=16'], 1), + (['--checks="boost-*"', '--version=17'], 1), + (['--checks="boost-*"', '--version=18'], 1), + (['--checks="boost-*"', '--version=19'], 1), + (['--checks="boost-*"', '--version=20'], 1), ), ) def test_run_clang_tidy_invalid(args, expected_retval, tmp_path): diff --git a/tests/test_util.py b/tests/test_util.py index 2901083..3d9e903 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -6,7 +6,7 @@ from cpp_linter_hooks.util import ensure_installed, DEFAULT_CLANG_VERSION -VERSIONS = [None, "16"] +VERSIONS = [None, "18"] TOOLS = ["clang-format", "clang-tidy"] From c6907475d3fa27bb94f62885eafad665f725f3ca Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 1 Jul 2025 21:14:08 +0300 Subject: [PATCH 09/11] revert changes --- testing/.clang-tidy | 2 +- tests/test_util.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/.clang-tidy b/testing/.clang-tidy index de19304..36fb3ab 100644 --- a/testing/.clang-tidy +++ b/testing/.clang-tidy @@ -2,7 +2,7 @@ Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,performance-*,bugprone-*,clang-analyzer-*,mpi-*,misc-*,readability-*' WarningsAsErrors: '' HeaderFilterRegex: '' -# AnalyzeTemporaryDtors: false # Remove or comment this line +AnalyzeTemporaryDtors: false FormatStyle: 'file' CheckOptions: - key: bugprone-argument-comment.CommentBoolLiterals diff --git a/tests/test_util.py b/tests/test_util.py index 3d9e903..2901083 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -6,7 +6,7 @@ from cpp_linter_hooks.util import ensure_installed, DEFAULT_CLANG_VERSION -VERSIONS = [None, "18"] +VERSIONS = [None, "16"] TOOLS = ["clang-format", "clang-tidy"] From cadb325fe15e2f87af48e91b14dc41d4d303fea0 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 1 Jul 2025 21:16:31 +0300 Subject: [PATCH 10/11] remove unknown key AnalyzeTemporaryDtors --- testing/.clang-tidy | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/.clang-tidy b/testing/.clang-tidy index 36fb3ab..77d52bd 100644 --- a/testing/.clang-tidy +++ b/testing/.clang-tidy @@ -2,7 +2,6 @@ Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,performance-*,bugprone-*,clang-analyzer-*,mpi-*,misc-*,readability-*' WarningsAsErrors: '' HeaderFilterRegex: '' -AnalyzeTemporaryDtors: false FormatStyle: 'file' CheckOptions: - key: bugprone-argument-comment.CommentBoolLiterals From 421cffc2cee5f287235d3a641a9155fa41c8613b Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 1 Jul 2025 21:19:01 +0300 Subject: [PATCH 11/11] revert changes of test.yml --- .github/workflows/test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d9872f3..abb783d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,8 +40,5 @@ jobs: files: ./coverage.xml fail_ci_if_error: true # optional (default = false) verbose: true # optional (default = false) - - - name: Install C devlopment headers - run: sudo apt-get update && sudo apt-get install -y build-essential libc6-dev - name: Test cpp-linter-hooks run: sh testing/run.sh