From 95600879ca342bcb262f1f77f6903dc0ce450c30 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Wed, 11 Dec 2024 22:00:01 +0300 Subject: [PATCH 01/32] add GitHub Actions for check sources by clang-format --- .github/workflows/SAST.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/SAST.yml diff --git a/.github/workflows/SAST.yml b/.github/workflows/SAST.yml new file mode 100644 index 000000000..6a8a81cb8 --- /dev/null +++ b/.github/workflows/SAST.yml @@ -0,0 +1,20 @@ +name: Static Application Security Testing + +on: [push, pull_request] + +jobs: + clang-format: + name: Check sources by clang-format + runs-on: ubuntu-latest + steps: + - name: Checkout repository code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Run clang-format style check for C/C++/Protobuf programs + uses: jidicula/clang-format-action@v4.14.0 + with: + clang-format-version: '19' + check-path: 'src' + fallback-style: 'llvm' From 1913ef357f36786a39f85a62e5f3afe7e5790359 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Wed, 11 Dec 2024 22:19:52 +0300 Subject: [PATCH 02/32] add get list changed files --- .github/workflows/SAST.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/SAST.yml b/.github/workflows/SAST.yml index 6a8a81cb8..a3c034519 100644 --- a/.github/workflows/SAST.yml +++ b/.github/workflows/SAST.yml @@ -10,11 +10,25 @@ jobs: - name: Checkout repository code uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 0 # for work tj-actions/changed-files + persist-credentials: false # for work tj-actions/changed-files + + - name: Get all source files that have changed + id: changed-files + uses: tj-actions/changed-files@v45 + with: + files: '**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' + + - name: List changed source file(s) for check + if: steps.changed-files.outputs.any_changed == 'true' + run: | + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + echo "$file was changed" + done - name: Run clang-format style check for C/C++/Protobuf programs uses: jidicula/clang-format-action@v4.14.0 with: clang-format-version: '19' - check-path: 'src' + check-path: '.' fallback-style: 'llvm' From a08351e0b69332af1ec9cd1c92b12c08ab363b9c Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Tue, 17 Dec 2024 23:07:52 +0300 Subject: [PATCH 03/32] test install llvm and clang --- .../workflows/{SAST.yml => SAST_clang_format_on_pr.yml} | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) rename .github/workflows/{SAST.yml => SAST_clang_format_on_pr.yml} (84%) diff --git a/.github/workflows/SAST.yml b/.github/workflows/SAST_clang_format_on_pr.yml similarity index 84% rename from .github/workflows/SAST.yml rename to .github/workflows/SAST_clang_format_on_pr.yml index a3c034519..2e3617e36 100644 --- a/.github/workflows/SAST.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -4,15 +4,20 @@ on: [push, pull_request] jobs: clang-format: - name: Check sources by clang-format + name: Check sources by clang-format for added/changed files in PR runs-on: ubuntu-latest steps: + - name: Install LLVM and Clang + uses: KyleMayes/install-llvm-action@v2 + with: + version: "19.0" + - name: Checkout repository code uses: actions/checkout@v4 with: fetch-depth: 0 # for work tj-actions/changed-files persist-credentials: false # for work tj-actions/changed-files - + - name: Get all source files that have changed id: changed-files uses: tj-actions/changed-files@v45 From c6fd90533ae7f836c1fd143ab9d28c76e0d6be44 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Tue, 17 Dec 2024 23:09:26 +0300 Subject: [PATCH 04/32] fix version llvm --- .github/workflows/SAST_clang_format_on_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index 2e3617e36..9516d8e2c 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -10,7 +10,7 @@ jobs: - name: Install LLVM and Clang uses: KyleMayes/install-llvm-action@v2 with: - version: "19.0" + version: "19.1.6" - name: Checkout repository code uses: actions/checkout@v4 From d7ae77e6f72c4193d8880b68911d487e670c0f0a Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Tue, 17 Dec 2024 23:10:55 +0300 Subject: [PATCH 05/32] fix version llvm from asset action --- .github/workflows/SAST_clang_format_on_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index 9516d8e2c..dfb7badcb 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -10,7 +10,7 @@ jobs: - name: Install LLVM and Clang uses: KyleMayes/install-llvm-action@v2 with: - version: "19.1.6" + version: "18.1.8" - name: Checkout repository code uses: actions/checkout@v4 From 8514d6ca8a7783a862fd098441e35d05d76f7fe9 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Tue, 17 Dec 2024 23:16:08 +0300 Subject: [PATCH 06/32] test new logic with parallel --- .github/workflows/SAST_clang_format_on_pr.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index dfb7badcb..086569746 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -12,6 +12,9 @@ jobs: with: version: "18.1.8" + - name: Install parallel for work with check many files + run: apt-get update && apt-get install parallel -y + - name: Checkout repository code uses: actions/checkout@v4 with: @@ -31,6 +34,12 @@ jobs: echo "$file was changed" done + - name: Check changed source file(s) by clang-format + if: steps.changed-files.outputs.any_changed == 'true' + run: | + parallel clang-format --style='file' --Werror --dry-run --verbose ::: \ + ${{ steps.changed-files.outputs.all_changed_files }} + - name: Run clang-format style check for C/C++/Protobuf programs uses: jidicula/clang-format-action@v4.14.0 with: From 9aacc78bab5116600c2fdf91ae21e7d0e76448b1 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Tue, 17 Dec 2024 23:18:30 +0300 Subject: [PATCH 07/32] test sudo --- .github/workflows/SAST_clang_format_on_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index 086569746..ec562a736 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -13,7 +13,7 @@ jobs: version: "18.1.8" - name: Install parallel for work with check many files - run: apt-get update && apt-get install parallel -y + run: sudo apt-get update && sudo apt-get install parallel -y - name: Checkout repository code uses: actions/checkout@v4 From 20ef70457854fc4d1c90676838770657aa25c92c Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Tue, 17 Dec 2024 23:25:20 +0300 Subject: [PATCH 08/32] final view --- .github/workflows/SAST_clang_format_on_pr.yml | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index ec562a736..ba7582ad8 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -1,6 +1,6 @@ name: Static Application Security Testing -on: [push, pull_request] +on: [pull_request] jobs: clang-format: @@ -13,7 +13,9 @@ jobs: version: "18.1.8" - name: Install parallel for work with check many files - run: sudo apt-get update && sudo apt-get install parallel -y + run: | + sudo apt-get update + sudo apt-get install parallel -y - name: Checkout repository code uses: actions/checkout@v4 @@ -21,28 +23,21 @@ jobs: fetch-depth: 0 # for work tj-actions/changed-files persist-credentials: false # for work tj-actions/changed-files - - name: Get all source files that have changed + - name: Get C/C++/Protobuf source files that have added/changed id: changed-files uses: tj-actions/changed-files@v45 with: files: '**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' - - name: List changed source file(s) for check + - name: List added/changed C/C++/Protobuf source file(s) for check if: steps.changed-files.outputs.any_changed == 'true' run: | for file in ${{ steps.changed-files.outputs.all_changed_files }}; do echo "$file was changed" done - - name: Check changed source file(s) by clang-format + - name: Check added/changed C/C++/Protobuf source file(s) by clang-format if: steps.changed-files.outputs.any_changed == 'true' run: | - parallel clang-format --style='file' --Werror --dry-run --verbose ::: \ + parallel clang-format --style='llvm' --Werror --dry-run --verbose ::: \ ${{ steps.changed-files.outputs.all_changed_files }} - - - name: Run clang-format style check for C/C++/Protobuf programs - uses: jidicula/clang-format-action@v4.14.0 - with: - clang-format-version: '19' - check-path: '.' - fallback-style: 'llvm' From 832804bd1c3489509d2794d728948cab8e4f3d9a Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Tue, 17 Dec 2024 23:27:27 +0300 Subject: [PATCH 09/32] test on source file --- cr3gui/src/bgfit.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cr3gui/src/bgfit.cpp b/cr3gui/src/bgfit.cpp index 7963b3714..4f1cfab7a 100644 --- a/cr3gui/src/bgfit.cpp +++ b/cr3gui/src/bgfit.cpp @@ -105,3 +105,4 @@ BackgroundFitWindow::draw() } _wm->getScreen()->invalidateRect( fullRect ); } + From aaa073159a24310bcf5392e094dff639aab34aeb Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Tue, 17 Dec 2024 23:51:23 +0300 Subject: [PATCH 10/32] test change style --- .github/workflows/SAST_clang_format_on_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index ba7582ad8..909fa73ea 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -39,5 +39,5 @@ jobs: - name: Check added/changed C/C++/Protobuf source file(s) by clang-format if: steps.changed-files.outputs.any_changed == 'true' run: | - parallel clang-format --style='llvm' --Werror --dry-run --verbose ::: \ + parallel clang-format --style='Google' --Werror --dry-run --verbose ::: \ ${{ steps.changed-files.outputs.all_changed_files }} From f395651c6505bb059bf3d59a9cbca292355b8068 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 10:01:40 +0300 Subject: [PATCH 11/32] test Chromium styles --- .github/workflows/SAST_clang_format_on_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index 909fa73ea..8a24d40e4 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -39,5 +39,5 @@ jobs: - name: Check added/changed C/C++/Protobuf source file(s) by clang-format if: steps.changed-files.outputs.any_changed == 'true' run: | - parallel clang-format --style='Google' --Werror --dry-run --verbose ::: \ + parallel clang-format --style='Chromium' --Werror --dry-run --verbose ::: \ ${{ steps.changed-files.outputs.all_changed_files }} From d308b1845fcd110cc76c45e19abb0070926a53ce Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 10:11:31 +0300 Subject: [PATCH 12/32] add ignore thirdparty src and test it --- .github/workflows/SAST_clang_format_on_pr.yml | 1 + thirdparty_unman/antiword/antiword.h | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index 8a24d40e4..c1b7971e1 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -28,6 +28,7 @@ jobs: uses: tj-actions/changed-files@v45 with: files: '**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' + files_ignore: thirdparty_unman/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' - name: List added/changed C/C++/Protobuf source file(s) for check if: steps.changed-files.outputs.any_changed == 'true' diff --git a/thirdparty_unman/antiword/antiword.h b/thirdparty_unman/antiword/antiword.h index e6f4d68f2..99f7c45cc 100644 --- a/thirdparty_unman/antiword/antiword.h +++ b/thirdparty_unman/antiword/antiword.h @@ -749,3 +749,4 @@ extern void vAddTableRowXML(diagram_type *, char **, int, const short *, UCHAR); #endif /* __antiword_h */ + From b3e3a004a0cbdb63995a95b91347915ca51a2309 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 10:17:02 +0300 Subject: [PATCH 13/32] add ignore thirdparty src and test it 2 --- .github/workflows/SAST_clang_format_on_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index c1b7971e1..d1004967e 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -28,7 +28,7 @@ jobs: uses: tj-actions/changed-files@v45 with: files: '**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' - files_ignore: thirdparty_unman/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' + files_ignore: thirdparty_unman/**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' - name: List added/changed C/C++/Protobuf source file(s) for check if: steps.changed-files.outputs.any_changed == 'true' From 0d478518213573153bcf020aea9ec97df06c3821 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 10:21:02 +0300 Subject: [PATCH 14/32] add ignore thirdparty src and test it 3 --- .github/workflows/SAST_clang_format_on_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index d1004967e..96cbf0f4a 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -28,7 +28,7 @@ jobs: uses: tj-actions/changed-files@v45 with: files: '**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' - files_ignore: thirdparty_unman/**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' + files_ignore: 'thirdparty_unman/**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' - name: List added/changed C/C++/Protobuf source file(s) for check if: steps.changed-files.outputs.any_changed == 'true' From 2f760e0126a779ef6d705193c49e9e1b7af043c0 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 10:23:40 +0300 Subject: [PATCH 15/32] test Mozilla codestyle --- .github/workflows/SAST_clang_format_on_pr.yml | 2 +- thirdparty_unman/antiword/antiword.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index 96cbf0f4a..7e103a619 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -40,5 +40,5 @@ jobs: - name: Check added/changed C/C++/Protobuf source file(s) by clang-format if: steps.changed-files.outputs.any_changed == 'true' run: | - parallel clang-format --style='Chromium' --Werror --dry-run --verbose ::: \ + parallel clang-format --style='Mozilla' --Werror --dry-run --verbose ::: \ ${{ steps.changed-files.outputs.all_changed_files }} diff --git a/thirdparty_unman/antiword/antiword.h b/thirdparty_unman/antiword/antiword.h index 99f7c45cc..e6f4d68f2 100644 --- a/thirdparty_unman/antiword/antiword.h +++ b/thirdparty_unman/antiword/antiword.h @@ -749,4 +749,3 @@ extern void vAddTableRowXML(diagram_type *, char **, int, const short *, UCHAR); #endif /* __antiword_h */ - From 67fb601835e693ac0d34263f0a3c315d2812f09e Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 10:26:01 +0300 Subject: [PATCH 16/32] test WebKit codestyle --- .github/workflows/SAST_clang_format_on_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index 7e103a619..df13effe8 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -40,5 +40,5 @@ jobs: - name: Check added/changed C/C++/Protobuf source file(s) by clang-format if: steps.changed-files.outputs.any_changed == 'true' run: | - parallel clang-format --style='Mozilla' --Werror --dry-run --verbose ::: \ + parallel clang-format --style='WebKit' --Werror --dry-run --verbose ::: \ ${{ steps.changed-files.outputs.all_changed_files }} From 8c535756a186d7e5a3faf1776a6082198857c77c Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 10:29:56 +0300 Subject: [PATCH 17/32] test Microsoft codestyle --- .github/workflows/SAST_clang_format_on_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index df13effe8..5ef5318fd 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -40,5 +40,5 @@ jobs: - name: Check added/changed C/C++/Protobuf source file(s) by clang-format if: steps.changed-files.outputs.any_changed == 'true' run: | - parallel clang-format --style='WebKit' --Werror --dry-run --verbose ::: \ + parallel clang-format --style='Microsoft' --Werror --dry-run --verbose ::: \ ${{ steps.changed-files.outputs.all_changed_files }} From c7f7109c86516ac2de04818edad43473c03382d3 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 10:32:09 +0300 Subject: [PATCH 18/32] test GNU codestyle --- .github/workflows/SAST_clang_format_on_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index 5ef5318fd..0b854e769 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -40,5 +40,5 @@ jobs: - name: Check added/changed C/C++/Protobuf source file(s) by clang-format if: steps.changed-files.outputs.any_changed == 'true' run: | - parallel clang-format --style='Microsoft' --Werror --dry-run --verbose ::: \ + parallel clang-format --style='GNU' --Werror --dry-run --verbose ::: \ ${{ steps.changed-files.outputs.all_changed_files }} From 46ded401df112e4545a8893062009a5f0f19bffe Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 10:34:23 +0300 Subject: [PATCH 19/32] test LLVM codestyle --- .github/workflows/SAST_clang_format_on_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index 0b854e769..5c8475fa9 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -40,5 +40,5 @@ jobs: - name: Check added/changed C/C++/Protobuf source file(s) by clang-format if: steps.changed-files.outputs.any_changed == 'true' run: | - parallel clang-format --style='GNU' --Werror --dry-run --verbose ::: \ + parallel clang-format --style='LLVM' --Werror --dry-run --verbose ::: \ ${{ steps.changed-files.outputs.all_changed_files }} From 7f513d75f8839df211f266cdd837e7d3146d78cd Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 10:37:34 +0300 Subject: [PATCH 20/32] test Google codestyle --- .github/workflows/SAST_clang_format_on_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index 5c8475fa9..b03675c7c 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -40,5 +40,5 @@ jobs: - name: Check added/changed C/C++/Protobuf source file(s) by clang-format if: steps.changed-files.outputs.any_changed == 'true' run: | - parallel clang-format --style='LLVM' --Werror --dry-run --verbose ::: \ + parallel clang-format --style='Google' --Werror --dry-run --verbose ::: \ ${{ steps.changed-files.outputs.all_changed_files }} From cde3187523993b9026bdc6eafa301b2bf5ce73d8 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 10:42:16 +0300 Subject: [PATCH 21/32] test Mozilla codestyle --- .github/workflows/SAST_clang_format_on_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index b03675c7c..7e103a619 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -40,5 +40,5 @@ jobs: - name: Check added/changed C/C++/Protobuf source file(s) by clang-format if: steps.changed-files.outputs.any_changed == 'true' run: | - parallel clang-format --style='Google' --Werror --dry-run --verbose ::: \ + parallel clang-format --style='Mozilla' --Werror --dry-run --verbose ::: \ ${{ steps.changed-files.outputs.all_changed_files }} From bb8ae6f25789d7a0475fa94dc0cf64abf2876d19 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 11:32:39 +0300 Subject: [PATCH 22/32] set C++11 standart --- .github/workflows/SAST_clang_format_on_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index 7e103a619..aa5c7553f 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -40,5 +40,5 @@ jobs: - name: Check added/changed C/C++/Protobuf source file(s) by clang-format if: steps.changed-files.outputs.any_changed == 'true' run: | - parallel clang-format --style='Mozilla' --Werror --dry-run --verbose ::: \ + parallel clang-format --style={BasedOnStyle: Mozilla, Standard: LS_Cpp11} --Werror --dry-run --verbose ::: \ ${{ steps.changed-files.outputs.all_changed_files }} From e6ff72b17b3702a55ee8bb815137c87d41ca2ec4 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 11:43:55 +0300 Subject: [PATCH 23/32] test use default official default example --- .clang-format | 23 +++++++++++++++++++ .github/workflows/SAST_clang_format_on_pr.yml | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..bb6243128 --- /dev/null +++ b/.clang-format @@ -0,0 +1,23 @@ +--- +# We'll use defaults from the LLVM style, but with 4 columns indentation. +BasedOnStyle: LLVM +IndentWidth: 4 +--- +Language: Cpp +Standard: c++11 +# Force pointers to the type for C++. +DerivePointerAlignment: false +PointerAlignment: Left +--- +Language: JavaScript +# Use 100 columns for JS. +ColumnLimit: 100 +--- +Language: Proto +# Don't format .proto files. +DisableFormat: true +--- +Language: CSharp +# Use 100 columns for C#. +ColumnLimit: 100 +... \ No newline at end of file diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index aa5c7553f..16d078ca9 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -40,5 +40,5 @@ jobs: - name: Check added/changed C/C++/Protobuf source file(s) by clang-format if: steps.changed-files.outputs.any_changed == 'true' run: | - parallel clang-format --style={BasedOnStyle: Mozilla, Standard: LS_Cpp11} --Werror --dry-run --verbose ::: \ + parallel clang-format --style=file --Werror --dry-run --verbose ::: \ ${{ steps.changed-files.outputs.all_changed_files }} From 313b50c0f7e786a30224fa3022167dc59a2b4d7f Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 11:48:16 +0300 Subject: [PATCH 24/32] test use default official default example 2 --- .clang-format | 1 - 1 file changed, 1 deletion(-) diff --git a/.clang-format b/.clang-format index bb6243128..cf3312f4b 100644 --- a/.clang-format +++ b/.clang-format @@ -20,4 +20,3 @@ DisableFormat: true Language: CSharp # Use 100 columns for C#. ColumnLimit: 100 -... \ No newline at end of file From 52163bdda78c146f36484884bba7d0eabf977ffb Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 11:53:47 +0300 Subject: [PATCH 25/32] test use default official default example 3 --- .clang-format | 1 + 1 file changed, 1 insertion(+) diff --git a/.clang-format b/.clang-format index cf3312f4b..e12a4dd79 100644 --- a/.clang-format +++ b/.clang-format @@ -5,6 +5,7 @@ IndentWidth: 4 --- Language: Cpp Standard: c++11 +Cpp11BracedListStyle: true # Force pointers to the type for C++. DerivePointerAlignment: false PointerAlignment: Left From 054ee8b1d5f42fda10b6bc2e37a017e43c8f7f06 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 12:04:18 +0300 Subject: [PATCH 26/32] test use default official default example 4 --- .clang-format | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.clang-format b/.clang-format index e12a4dd79..c7d8c9955 100644 --- a/.clang-format +++ b/.clang-format @@ -9,6 +9,12 @@ Cpp11BracedListStyle: true # Force pointers to the type for C++. DerivePointerAlignment: false PointerAlignment: Left +# Force Precise control over the spacing in parentheses +SpacesInParens: Custom +SpacesInParensOptions: + InCStyleCasts: true + InEmptyParentheses: true + Other: true --- Language: JavaScript # Use 100 columns for JS. From 5b712afb87b4cc940dc135c981b60eed593ce350 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 12:10:11 +0300 Subject: [PATCH 27/32] test use default official default example 5 --- .clang-format | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.clang-format b/.clang-format index c7d8c9955..f9d09e3e0 100644 --- a/.clang-format +++ b/.clang-format @@ -9,21 +9,7 @@ Cpp11BracedListStyle: true # Force pointers to the type for C++. DerivePointerAlignment: false PointerAlignment: Left -# Force Precise control over the spacing in parentheses -SpacesInParens: Custom -SpacesInParensOptions: - InCStyleCasts: true - InEmptyParentheses: true - Other: true ---- -Language: JavaScript -# Use 100 columns for JS. -ColumnLimit: 100 --- Language: Proto # Don't format .proto files. DisableFormat: true ---- -Language: CSharp -# Use 100 columns for C#. -ColumnLimit: 100 From 5b96dd07aeef42ee77f2396ca3e9829643b8f23e Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 12:20:41 +0300 Subject: [PATCH 28/32] final test --- .clang-format-ignore | 2 ++ .github/workflows/SAST_clang_format_on_pr.yml | 4 +++- cr3gui/src/bgfit.cpp | 1 + cr3wx/src/cr3.cpp | 1 + thirdparty_unman/antiword/antiword.h | 1 + thirdparty_unman/antiword/asc85enc.c | 1 + tinydict/tinydict.cpp | 1 + 7 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .clang-format-ignore diff --git a/.clang-format-ignore b/.clang-format-ignore new file mode 100644 index 000000000..f958ffa75 --- /dev/null +++ b/.clang-format-ignore @@ -0,0 +1,2 @@ +thirdparty/* +thirdparty_unman/* \ No newline at end of file diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index 16d078ca9..1c8679f68 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -28,7 +28,9 @@ jobs: uses: tj-actions/changed-files@v45 with: files: '**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' - files_ignore: 'thirdparty_unman/**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' + files_ignore: | + 'thirdparty/**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' + 'thirdparty_unman/**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' - name: List added/changed C/C++/Protobuf source file(s) for check if: steps.changed-files.outputs.any_changed == 'true' diff --git a/cr3gui/src/bgfit.cpp b/cr3gui/src/bgfit.cpp index 4f1cfab7a..000fc8fbd 100644 --- a/cr3gui/src/bgfit.cpp +++ b/cr3gui/src/bgfit.cpp @@ -1,3 +1,4 @@ + /*************************************************************************** * CoolReader GUI * * Copyright (C) 2009,2010 Vadim Lopatin * diff --git a/cr3wx/src/cr3.cpp b/cr3wx/src/cr3.cpp index 4754366b9..6adc35fb0 100644 --- a/cr3wx/src/cr3.cpp +++ b/cr3wx/src/cr3.cpp @@ -1,3 +1,4 @@ + /*************************************************************************** * CoolReader, wxWidgets GUI * * Copyright (C) 2007-2010,2012 Vadim Lopatin * diff --git a/thirdparty_unman/antiword/antiword.h b/thirdparty_unman/antiword/antiword.h index e6f4d68f2..99f7c45cc 100644 --- a/thirdparty_unman/antiword/antiword.h +++ b/thirdparty_unman/antiword/antiword.h @@ -749,3 +749,4 @@ extern void vAddTableRowXML(diagram_type *, char **, int, const short *, UCHAR); #endif /* __antiword_h */ + diff --git a/thirdparty_unman/antiword/asc85enc.c b/thirdparty_unman/antiword/asc85enc.c index 8ff6bc8ce..fb0ecc323 100644 --- a/thirdparty_unman/antiword/asc85enc.c +++ b/thirdparty_unman/antiword/asc85enc.c @@ -1,3 +1,4 @@ + /* * asc85enc.c * Copyright (C) 2000-2003 A.J. van Os; Released under GPL diff --git a/tinydict/tinydict.cpp b/tinydict/tinydict.cpp index fbce811cc..0999a159f 100644 --- a/tinydict/tinydict.cpp +++ b/tinydict/tinydict.cpp @@ -1010,3 +1010,4 @@ int main( int argc, const char * * argv ) return 0; } #endif + From 0e230ea5503feb4285c994a5fb3ca5e88b203738 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 12:24:04 +0300 Subject: [PATCH 29/32] final test 2 --- .github/workflows/SAST_clang_format_on_pr.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/SAST_clang_format_on_pr.yml index 1c8679f68..d232f3090 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/SAST_clang_format_on_pr.yml @@ -28,9 +28,7 @@ jobs: uses: tj-actions/changed-files@v45 with: files: '**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' - files_ignore: | - 'thirdparty/**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' - 'thirdparty_unman/**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' + files_ignore: 'thirdparty*/**/*.{h,H,hpp,hh,h++,hxx,c,C,cpp,cc,c++,cxx,ino,pde,cu,proto}' - name: List added/changed C/C++/Protobuf source file(s) for check if: steps.changed-files.outputs.any_changed == 'true' From e2cd04f7536faee1f6e6558df2ba8da0d32aea65 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 12:33:14 +0300 Subject: [PATCH 30/32] final version --- .clang-format-ignore | 2 +- cr3gui/src/bgfit.cpp | 1 - cr3wx/src/cr3.cpp | 1 - thirdparty_unman/antiword/antiword.h | 1 - thirdparty_unman/antiword/asc85enc.c | 1 - tinydict/tinydict.cpp | 1 - 6 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.clang-format-ignore b/.clang-format-ignore index f958ffa75..c18f65b4b 100644 --- a/.clang-format-ignore +++ b/.clang-format-ignore @@ -1,2 +1,2 @@ thirdparty/* -thirdparty_unman/* \ No newline at end of file +thirdparty_unman/* diff --git a/cr3gui/src/bgfit.cpp b/cr3gui/src/bgfit.cpp index 000fc8fbd..4f1cfab7a 100644 --- a/cr3gui/src/bgfit.cpp +++ b/cr3gui/src/bgfit.cpp @@ -1,4 +1,3 @@ - /*************************************************************************** * CoolReader GUI * * Copyright (C) 2009,2010 Vadim Lopatin * diff --git a/cr3wx/src/cr3.cpp b/cr3wx/src/cr3.cpp index 6adc35fb0..4754366b9 100644 --- a/cr3wx/src/cr3.cpp +++ b/cr3wx/src/cr3.cpp @@ -1,4 +1,3 @@ - /*************************************************************************** * CoolReader, wxWidgets GUI * * Copyright (C) 2007-2010,2012 Vadim Lopatin * diff --git a/thirdparty_unman/antiword/antiword.h b/thirdparty_unman/antiword/antiword.h index 99f7c45cc..e6f4d68f2 100644 --- a/thirdparty_unman/antiword/antiword.h +++ b/thirdparty_unman/antiword/antiword.h @@ -749,4 +749,3 @@ extern void vAddTableRowXML(diagram_type *, char **, int, const short *, UCHAR); #endif /* __antiword_h */ - diff --git a/thirdparty_unman/antiword/asc85enc.c b/thirdparty_unman/antiword/asc85enc.c index fb0ecc323..8ff6bc8ce 100644 --- a/thirdparty_unman/antiword/asc85enc.c +++ b/thirdparty_unman/antiword/asc85enc.c @@ -1,4 +1,3 @@ - /* * asc85enc.c * Copyright (C) 2000-2003 A.J. van Os; Released under GPL diff --git a/tinydict/tinydict.cpp b/tinydict/tinydict.cpp index 0999a159f..fbce811cc 100644 --- a/tinydict/tinydict.cpp +++ b/tinydict/tinydict.cpp @@ -1010,4 +1010,3 @@ int main( int argc, const char * * argv ) return 0; } #endif - From 191f82cf45d4ec481e2077ec69d386d7270105f6 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 13:03:31 +0300 Subject: [PATCH 31/32] final version 2 --- cr3gui/src/bgfit.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/cr3gui/src/bgfit.cpp b/cr3gui/src/bgfit.cpp index 4f1cfab7a..7963b3714 100644 --- a/cr3gui/src/bgfit.cpp +++ b/cr3gui/src/bgfit.cpp @@ -105,4 +105,3 @@ BackgroundFitWindow::draw() } _wm->getScreen()->invalidateRect( fullRect ); } - From c002e139708eeed50163e217eac6e986995626d9 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 13:16:09 +0300 Subject: [PATCH 32/32] fix file name --- ...SAST_clang_format_on_pr.yml => check_clang_format_on_pr.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{SAST_clang_format_on_pr.yml => check_clang_format_on_pr.yml} (97%) diff --git a/.github/workflows/SAST_clang_format_on_pr.yml b/.github/workflows/check_clang_format_on_pr.yml similarity index 97% rename from .github/workflows/SAST_clang_format_on_pr.yml rename to .github/workflows/check_clang_format_on_pr.yml index d232f3090..1f17d26fc 100644 --- a/.github/workflows/SAST_clang_format_on_pr.yml +++ b/.github/workflows/check_clang_format_on_pr.yml @@ -1,4 +1,4 @@ -name: Static Application Security Testing +name: Check Style in Code on: [pull_request]