diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d6f9de3c889f1b63390f4f9d70b1172f7e30177a..fac57b105a353a6377a52d45b96b504fb98a4837 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,7 +4,8 @@ before_script:
- apt-get update -qq
- apt-get install -y cmake
- apt-get install -y lcov
- - apt-get install -y clang-tidy
+ - apt-get install -y python3
+ - apt-get install -y clang-format clang-tidy clang-tools clang
# Define the stages of the pipeline
stages:
- lint
@@ -14,14 +15,7 @@ stages:
job:codestyling:
stage: lint
- script:
- - mkdir build
- - cd build
- - cmake ..
- - make
- - make lint
- only:
- - master
+ script: python3 run-clang-format.py -r src include tests
# Define the job for building the project
diff --git a/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-2cb89fdd5fe92c478585.json b/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-2e9568cbc47559f44601.json
similarity index 95%
rename from cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-2cb89fdd5fe92c478585.json
rename to cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-2e9568cbc47559f44601.json
index 2c764ffa649f0787ed3ce2d683f45c2e20fa70a9..ed498df468b3402685cc42999ba5d3d6d337aa25 100644
--- a/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-2cb89fdd5fe92c478585.json
+++ b/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-2e9568cbc47559f44601.json
@@ -146,14 +146,14 @@
{
"directoryIndex" : 0,
"id" : "ExampleTests::@6890427a1f51a3e7e1df",
- "jsonFile" : "target-ExampleTests-Debug-6c6daac53400d70fcacd.json",
+ "jsonFile" : "target-ExampleTests-Debug-725a13db77d4afece0b7.json",
"name" : "ExampleTests",
"projectIndex" : 0
},
{
"directoryIndex" : 0,
"id" : "MINI_PROJECT_TEST_MAINTENANCE::@6890427a1f51a3e7e1df",
- "jsonFile" : "target-MINI_PROJECT_TEST_MAINTENANCE-Debug-9803cc1a521b498c51fc.json",
+ "jsonFile" : "target-MINI_PROJECT_TEST_MAINTENANCE-Debug-c7678dfee2f86bfbf500.json",
"name" : "MINI_PROJECT_TEST_MAINTENANCE",
"projectIndex" : 0
},
diff --git a/cmake-build-debug/.cmake/api/v1/reply/index-2024-04-02T02-37-26-0933.json b/cmake-build-debug/.cmake/api/v1/reply/index-2024-04-03T15-28-08-0112.json
similarity index 93%
rename from cmake-build-debug/.cmake/api/v1/reply/index-2024-04-02T02-37-26-0933.json
rename to cmake-build-debug/.cmake/api/v1/reply/index-2024-04-03T15-28-08-0112.json
index a8262a666c2b42da755f7fbc8a075b37f53aa367..df129e89fcf2aac14fd7692979401ef97a87c37f 100644
--- a/cmake-build-debug/.cmake/api/v1/reply/index-2024-04-02T02-37-26-0933.json
+++ b/cmake-build-debug/.cmake/api/v1/reply/index-2024-04-03T15-28-08-0112.json
@@ -26,7 +26,7 @@
"objects" :
[
{
- "jsonFile" : "codemodel-v2-2cb89fdd5fe92c478585.json",
+ "jsonFile" : "codemodel-v2-2e9568cbc47559f44601.json",
"kind" : "codemodel",
"version" :
{
@@ -86,7 +86,7 @@
},
"codemodel-v2" :
{
- "jsonFile" : "codemodel-v2-2cb89fdd5fe92c478585.json",
+ "jsonFile" : "codemodel-v2-2e9568cbc47559f44601.json",
"kind" : "codemodel",
"version" :
{
diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-ExampleTests-Debug-6c6daac53400d70fcacd.json b/cmake-build-debug/.cmake/api/v1/reply/target-ExampleTests-Debug-725a13db77d4afece0b7.json
similarity index 98%
rename from cmake-build-debug/.cmake/api/v1/reply/target-ExampleTests-Debug-6c6daac53400d70fcacd.json
rename to cmake-build-debug/.cmake/api/v1/reply/target-ExampleTests-Debug-725a13db77d4afece0b7.json
index 1aad3e88cedd4dc77321cf0151d9a9e2571cea17..a9319fc682b3b099ab9607d12c931edd352a0316 100644
--- a/cmake-build-debug/.cmake/api/v1/reply/target-ExampleTests-Debug-6c6daac53400d70fcacd.json
+++ b/cmake-build-debug/.cmake/api/v1/reply/target-ExampleTests-Debug-725a13db77d4afece0b7.json
@@ -30,13 +30,13 @@
{
"command" : 0,
"file" : 0,
- "line" : 81,
+ "line" : 82,
"parent" : 0
},
{
"command" : 1,
"file" : 0,
- "line" : 86,
+ "line" : 87,
"parent" : 0
},
{
@@ -51,7 +51,7 @@
{
"command" : 2,
"file" : 0,
- "line" : 74,
+ "line" : 75,
"parent" : 0
}
]
diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-MINI_PROJECT_TEST_MAINTENANCE-Debug-9803cc1a521b498c51fc.json b/cmake-build-debug/.cmake/api/v1/reply/target-MINI_PROJECT_TEST_MAINTENANCE-Debug-c7678dfee2f86bfbf500.json
similarity index 98%
rename from cmake-build-debug/.cmake/api/v1/reply/target-MINI_PROJECT_TEST_MAINTENANCE-Debug-9803cc1a521b498c51fc.json
rename to cmake-build-debug/.cmake/api/v1/reply/target-MINI_PROJECT_TEST_MAINTENANCE-Debug-c7678dfee2f86bfbf500.json
index edb03077a9ecd04ab5e1ace4e2e8ab83688482eb..50a4ca9c4a0ddbdb2df2a41b094dc92afbc7a752 100644
--- a/cmake-build-debug/.cmake/api/v1/reply/target-MINI_PROJECT_TEST_MAINTENANCE-Debug-9803cc1a521b498c51fc.json
+++ b/cmake-build-debug/.cmake/api/v1/reply/target-MINI_PROJECT_TEST_MAINTENANCE-Debug-c7678dfee2f86bfbf500.json
@@ -28,13 +28,13 @@
{
"command" : 0,
"file" : 0,
- "line" : 76,
+ "line" : 77,
"parent" : 0
},
{
"command" : 1,
"file" : 0,
- "line" : 74,
+ "line" : 75,
"parent" : 0
}
]
diff --git a/cmake-build-debug/.ninja_deps b/cmake-build-debug/.ninja_deps
index ead1a36f5c9a6a8cae8fa5c69c9abf49326b80ea..62cf788f3c82b34d921efe8e2c0efdcc81e96b8a 100644
Binary files a/cmake-build-debug/.ninja_deps and b/cmake-build-debug/.ninja_deps differ
diff --git a/cmake-build-debug/.ninja_log b/cmake-build-debug/.ninja_log
index 596db8926adb54589b71c6051b97d0e8841c51c0..565fd70c982b717f386193768b6cccc9ae9e1a17 100644
--- a/cmake-build-debug/.ninja_log
+++ b/cmake-build-debug/.ninja_log
@@ -4,7 +4,7 @@
0 328 7337213248714332 CMakeFiles/MINI_PROJECT_TEST_MAINTENANCE.dir/src/main.cpp.obj cb9c9be2bc643e79
66 147 7337224459290340 bin/MINI_PROJECT_TEST_MAINTENANCE.exe eac10cfe68d28c9
15 1442 7337219487004756 googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.obj 700f72f183449715
-883 4394 7337227348520238 bin/ExampleTests.exe e524054f521ed215
+1548 5359 7338599975633138 bin/ExampleTests.exe e524054f521ed215
11 135 7337219473953355 CMakeFiles/calculator_tests.dir/src/compt_frequence.c.obj ae1a440fafbde413
8 1693 7337219489516990 CMakeFiles/calculator_tests.dir/tests/CalculatorTest.cpp.obj 34151dfcea83a3e9
4 1687 7337219489447019 CMakeFiles/calculator_tests.dir/tests/ExampleTests.cpp.obj ed20f0e70f2ab206
@@ -12,21 +12,7 @@
10304 13139 7337219603976745 lib/libgtest.a 7dc1040cf51843dc
13139 13198 7337219604576183 lib/libgtest_main.a 15197e58a278424
3 69 7337221552584597 CMakeFiles/ExampleTests.dir/src/Calculator.cpp.obj 209155e5fc26b780
-10 107 7337221552955612 CMakeFiles/ExampleTests.dir/src/compt_frequence.c.obj d97eb00f9fc1d12e
-3 882 7337227313493746 CMakeFiles/ExampleTests.dir/tests/ExampleTests.cpp.obj e28e202807b1bd82
-1 66 7337224458529383 CMakeFiles/MINI_PROJECT_TEST_MAINTENANCE.dir/src/main.c.obj d48a854fb7bbdbb0
-0 99 7337222421042617 CMakeFiles/MINI_PROJECT_TEST_MAINTENANCE.dir/src/compt_frequence.c.obj fbd68f8f639928e7
-57 464 7338580882020580 CMakeFiles/ExampleTests.dir/src/compt_frequence.c.obj 88329e948dd6858a
-6 1705 7338580894416775 CMakeFiles/ExampleTests.dir/tests/ExampleTests.cpp.obj e28e202807b1bd82
-1705 5721 7338580934332570 bin/ExampleTests.exe e524054f521ed215
-5 1461 7338581194451650 CMakeFiles/ExampleTests.dir/tests/ExampleTests.cpp.obj e28e202807b1bd82
-1462 4949 7338581229232871 bin/ExampleTests.exe e524054f521ed215
13 199 7338584889609558 CMakeFiles/ExampleTests.dir/src/compt_frequence.c.obj 88329e948dd6858a
-6 1398 7338584901610282 CMakeFiles/ExampleTests.dir/tests/ExampleTests.cpp.obj e28e202807b1bd82
-1398 5008 7338584937578553 bin/ExampleTests.exe e524054f521ed215
-5 1754 7338585540411418 CMakeFiles/ExampleTests.dir/tests/ExampleTests.cpp.obj e28e202807b1bd82
-1754 5405 7338585576788163 bin/ExampleTests.exe e524054f521ed215
-5 1682 7338586413110088 CMakeFiles/ExampleTests.dir/tests/ExampleTests.cpp.obj e28e202807b1bd82
-1683 5827 7338586454469850 bin/ExampleTests.exe e524054f521ed215
4 1548 7338599937600314 CMakeFiles/ExampleTests.dir/tests/ExampleTests.cpp.obj e28e202807b1bd82
-1548 5359 7338599975633138 bin/ExampleTests.exe e524054f521ed215
+1 66 7337224458529383 CMakeFiles/MINI_PROJECT_TEST_MAINTENANCE.dir/src/main.c.obj d48a854fb7bbdbb0
+0 99 7337222421042617 CMakeFiles/MINI_PROJECT_TEST_MAINTENANCE.dir/src/compt_frequence.c.obj fbd68f8f639928e7
diff --git a/cmake-build-debug/CMakeFiles/clion-Debug-log.txt b/cmake-build-debug/CMakeFiles/clion-Debug-log.txt
index 850bbf0d08ae918e8c3c767113ff6eb670ea3e93..4a9c422d84bc0ab0b1a4a5ee331212d36f8d1072 100644
--- a/cmake-build-debug/CMakeFiles/clion-Debug-log.txt
+++ b/cmake-build-debug/CMakeFiles/clion-Debug-log.txt
@@ -1,5 +1,5 @@
"C:\Program Files\JetBrains\CLion 2022.3.1\bin\cmake\win\x64\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_MAKE_PROGRAM=C:/Program Files/JetBrains/CLion 2022.3.1/bin/ninja/win/x64/ninja.exe" -G Ninja -S C:\Users\imani\CLionProjects\sample-ci-cpp -B C:\Users\imani\CLionProjects\sample-ci-cpp\cmake-build-debug
--- Configuring done (0.1s)
+-- Configuring done (0.8s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download
[1/7] Performing update step for 'googletest'
@@ -9,6 +9,6 @@
[5/7] No install step for 'googletest'
[6/7] No test step for 'googletest'
[7/7] Completed 'googletest'
--- Configuring done (1.2s)
+-- Configuring done (3.2s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug
diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log
index 82adbdc1e059197e03cb5b82ff1dbdad9d77b595..8fe52aa709096d364039542bc27f73010ab787e4 100644
--- a/cmake-build-debug/Testing/Temporary/LastTest.log
+++ b/cmake-build-debug/Testing/Temporary/LastTest.log
@@ -1,3 +1,3 @@
-Start testing: Apr 03 17:06 Romance Daylight Time
+Start testing: Apr 03 17:28 Romance Daylight Time
----------------------------------------------------------
-End testing: Apr 03 17:06 Romance Daylight Time
+End testing: Apr 03 17:28 Romance Daylight Time
diff --git a/cmake-build-debug/build.ninja b/cmake-build-debug/build.ninja
index 6d2e68dbf9594ff139f6e673a3e82252dac8cf97..d6399272f68e490714d1ae51a09478acfffa1fab 100644
--- a/cmake-build-debug/build.ninja
+++ b/cmake-build-debug/build.ninja
@@ -50,6 +50,7 @@ cmake_ninja_workdir = C$:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-de
build cmake_object_order_depends_target_MINI_PROJECT_TEST_MAINTENANCE: phony || CMakeFiles/MINI_PROJECT_TEST_MAINTENANCE.dir
build CMakeFiles/MINI_PROJECT_TEST_MAINTENANCE.dir/src/compt_frequence.c.obj: C_COMPILER__MINI_PROJECT_TEST_MAINTENANCE_unscanned_Debug C$:/Users/imani/CLionProjects/sample-ci-cpp/src/compt_frequence.c || cmake_object_order_depends_target_MINI_PROJECT_TEST_MAINTENANCE
+ CODE_CHECK = "C:\Program Files\JetBrains\CLion 2022.3.1\bin\cmake\win\x64\bin\cmake.exe" -E __run_co_compile --tidy=clang-tidy;-checks=*;--extra-arg-before=--driver-mode=gcc --source=C:\Users\imani\CLionProjects\sample-ci-cpp\src\compt_frequence.c --
DEP_FILE = CMakeFiles\MINI_PROJECT_TEST_MAINTENANCE.dir\src\compt_frequence.c.obj.d
FLAGS = --coverage -g -fdiagnostics-color=always
INCLUDES = -IC:/Users/imani/CLionProjects/sample-ci-cpp/include
@@ -57,6 +58,7 @@ build CMakeFiles/MINI_PROJECT_TEST_MAINTENANCE.dir/src/compt_frequence.c.obj: C_
OBJECT_FILE_DIR = CMakeFiles\MINI_PROJECT_TEST_MAINTENANCE.dir\src
build CMakeFiles/MINI_PROJECT_TEST_MAINTENANCE.dir/src/main.c.obj: C_COMPILER__MINI_PROJECT_TEST_MAINTENANCE_unscanned_Debug C$:/Users/imani/CLionProjects/sample-ci-cpp/src/main.c || cmake_object_order_depends_target_MINI_PROJECT_TEST_MAINTENANCE
+ CODE_CHECK = "C:\Program Files\JetBrains\CLion 2022.3.1\bin\cmake\win\x64\bin\cmake.exe" -E __run_co_compile --tidy=clang-tidy;-checks=*;--extra-arg-before=--driver-mode=gcc --source=C:\Users\imani\CLionProjects\sample-ci-cpp\src\main.c --
DEP_FILE = CMakeFiles\MINI_PROJECT_TEST_MAINTENANCE.dir\src\main.c.obj.d
FLAGS = --coverage -g -fdiagnostics-color=always
INCLUDES = -IC:/Users/imani/CLionProjects/sample-ci-cpp/include
@@ -92,6 +94,7 @@ build bin/MINI_PROJECT_TEST_MAINTENANCE.exe: C_EXECUTABLE_LINKER__MINI_PROJECT_T
build cmake_object_order_depends_target_ExampleTests: phony || cmake_object_order_depends_target_gtest cmake_object_order_depends_target_gtest_main
build CMakeFiles/ExampleTests.dir/src/compt_frequence.c.obj: C_COMPILER__ExampleTests_unscanned_Debug C$:/Users/imani/CLionProjects/sample-ci-cpp/src/compt_frequence.c || cmake_object_order_depends_target_ExampleTests
+ CODE_CHECK = "C:\Program Files\JetBrains\CLion 2022.3.1\bin\cmake\win\x64\bin\cmake.exe" -E __run_co_compile --tidy=clang-tidy;-checks=*;--extra-arg-before=--driver-mode=gcc --source=C:\Users\imani\CLionProjects\sample-ci-cpp\src\compt_frequence.c --
DEP_FILE = CMakeFiles\ExampleTests.dir\src\compt_frequence.c.obj.d
FLAGS = --coverage -g -fdiagnostics-color=always
INCLUDES = -IC:/Users/imani/CLionProjects/sample-ci-cpp/include -isystem C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-src/googletest/include -isystem C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-src/googletest
diff --git a/cmake-build-debug/googletest-download/.ninja_log b/cmake-build-debug/googletest-download/.ninja_log
index f1b9ee9fe4ace4c592e02a2b17ec01d27b1b8431..bac1a0d99d59e1b35134a1094a2326f03aac8dcf 100644
--- a/cmake-build-debug/googletest-download/.ninja_log
+++ b/cmake-build-debug/googletest-download/.ninja_log
@@ -1,37 +1,37 @@
# ninja log v5
1 49 7337176065254970 googletest-prefix/src/googletest-stamp/googletest-mkdir 40c3de5996ef7881
-1 128 0 googletest-prefix/src/googletest-stamp/googletest-update a5f82b73d97f2f0d
-338 408 7337225802907283 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-done 8be4191b9245661a
+1 133 0 googletest-prefix/src/googletest-stamp/googletest-update a5f82b73d97f2f0d
+420 500 7337286463824563 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-done 8be4191b9245661a
1 49 7337176065254970 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-mkdir 40c3de5996ef7881
-1 128 0 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-update a5f82b73d97f2f0d
+1 133 0 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-update a5f82b73d97f2f0d
50 6476 7337176129516039 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-download 56dfe11f77ca598b
-338 408 7337225802907283 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/CMakeFiles/googletest-complete 8be4191b9245661a
-211 252 7337225801366226 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-build 77ac8515f6fb67a0
-128 170 7337225800545275 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-patch 2a7c776ca0c0bf44
+420 500 7337286463824563 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/CMakeFiles/googletest-complete 8be4191b9245661a
+225 273 7337286461568637 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-build 77ac8515f6fb67a0
+133 179 7337286460629943 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-patch 2a7c776ca0c0bf44
50 6476 7337176129516039 googletest-prefix/src/googletest-stamp/googletest-download 56dfe11f77ca598b
-128 170 7337225800545275 googletest-prefix/src/googletest-stamp/googletest-patch 2a7c776ca0c0bf44
-170 211 7337225800956255 googletest-prefix/src/googletest-stamp/googletest-configure bc6269b48a498891
-170 211 7337225800956255 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-configure bc6269b48a498891
-211 252 7337225801366226 googletest-prefix/src/googletest-stamp/googletest-build 77ac8515f6fb67a0
-252 293 7337225801771397 googletest-prefix/src/googletest-stamp/googletest-install 80d3a09463c08df1
-252 293 7337225801771397 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-install 80d3a09463c08df1
-293 337 7337225802204656 googletest-prefix/src/googletest-stamp/googletest-test a0b3d069e28326f1
-293 337 7337225802204656 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-test a0b3d069e28326f1
-338 408 7337225802907283 CMakeFiles/googletest-complete 8be4191b9245661a
-338 408 7337225802907283 googletest-prefix/src/googletest-stamp/googletest-done 8be4191b9245661a
-1 133 0 googletest-prefix/src/googletest-stamp/googletest-update a5f82b73d97f2f0d
-1 133 0 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-update a5f82b73d97f2f0d
133 179 7337286460629943 googletest-prefix/src/googletest-stamp/googletest-patch 2a7c776ca0c0bf44
-133 179 7337286460629943 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-patch 2a7c776ca0c0bf44
179 225 7337286461095848 googletest-prefix/src/googletest-stamp/googletest-configure bc6269b48a498891
179 225 7337286461095848 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-configure bc6269b48a498891
225 273 7337286461568637 googletest-prefix/src/googletest-stamp/googletest-build 77ac8515f6fb67a0
-225 273 7337286461568637 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-build 77ac8515f6fb67a0
274 352 7337286462320720 googletest-prefix/src/googletest-stamp/googletest-install 80d3a09463c08df1
274 352 7337286462320720 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-install 80d3a09463c08df1
352 419 7337286462999327 googletest-prefix/src/googletest-stamp/googletest-test a0b3d069e28326f1
352 419 7337286462999327 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-test a0b3d069e28326f1
420 500 7337286463824563 CMakeFiles/googletest-complete 8be4191b9245661a
420 500 7337286463824563 googletest-prefix/src/googletest-stamp/googletest-done 8be4191b9245661a
-420 500 7337286463824563 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/CMakeFiles/googletest-complete 8be4191b9245661a
-420 500 7337286463824563 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-done 8be4191b9245661a
+1 252 0 googletest-prefix/src/googletest-stamp/googletest-update a5f82b73d97f2f0d
+1 252 0 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-update a5f82b73d97f2f0d
+252 378 7338612861248201 googletest-prefix/src/googletest-stamp/googletest-patch 2a7c776ca0c0bf44
+252 378 7338612861248201 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-patch 2a7c776ca0c0bf44
+378 461 7338612862103905 googletest-prefix/src/googletest-stamp/googletest-configure bc6269b48a498891
+378 461 7338612862103905 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-configure bc6269b48a498891
+462 552 7338612862995825 googletest-prefix/src/googletest-stamp/googletest-build 77ac8515f6fb67a0
+462 552 7338612862995825 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-build 77ac8515f6fb67a0
+552 656 7338612864021022 googletest-prefix/src/googletest-stamp/googletest-install 80d3a09463c08df1
+552 656 7338612864021022 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-install 80d3a09463c08df1
+656 746 7338612864942151 googletest-prefix/src/googletest-stamp/googletest-test a0b3d069e28326f1
+656 746 7338612864942151 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-test a0b3d069e28326f1
+746 878 7338612866252725 CMakeFiles/googletest-complete 8be4191b9245661a
+746 878 7338612866252725 googletest-prefix/src/googletest-stamp/googletest-done 8be4191b9245661a
+746 878 7338612866252725 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/CMakeFiles/googletest-complete 8be4191b9245661a
+746 878 7338612866252725 C:/Users/imani/CLionProjects/sample-ci-cpp/cmake-build-debug/googletest-download/googletest-prefix/src/googletest-stamp/googletest-done 8be4191b9245661a
diff --git a/run-clang-format.py b/run-clang-format.py
new file mode 100644
index 0000000000000000000000000000000000000000..395304e453c91bf0778396b75387395e8abec26c
--- /dev/null
+++ b/run-clang-format.py
@@ -0,0 +1,379 @@
+#!/usr/bin/env python
+"""A wrapper script around clang-format, suitable for linting multiple files
+and to use for continuous integration.
+
+This is an alternative API for the clang-format command line.
+It runs over multiple files and directories in parallel.
+A diff output is produced and a sensible exit code is returned.
+
+"""
+
+from __future__ import print_function, unicode_literals
+
+import argparse
+import codecs
+import difflib
+import fnmatch
+import io
+import errno
+import multiprocessing
+import os
+import signal
+import subprocess
+import sys
+import traceback
+
+from functools import partial
+
+try:
+ from subprocess import DEVNULL # py3k
+except ImportError:
+ DEVNULL = open(os.devnull, "wb")
+
+
+DEFAULT_EXTENSIONS = 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx'
+DEFAULT_CLANG_FORMAT_IGNORE = '.clang-format-ignore'
+
+
+class ExitStatus:
+ SUCCESS = 0
+ DIFF = 1
+ TROUBLE = 2
+
+def excludes_from_file(ignore_file):
+ excludes = []
+ try:
+ with io.open(ignore_file, 'r', encoding='utf-8') as f:
+ for line in f:
+ if line.startswith('#'):
+ # ignore comments
+ continue
+ pattern = line.rstrip()
+ if not pattern:
+ # allow empty lines
+ continue
+ excludes.append(pattern)
+ except EnvironmentError as e:
+ if e.errno != errno.ENOENT:
+ raise
+ return excludes;
+
+def list_files(files, recursive=False, extensions=None, exclude=None):
+ if extensions is None:
+ extensions = []
+ if exclude is None:
+ exclude = []
+
+ out = []
+ for file in files:
+ if recursive and os.path.isdir(file):
+ for dirpath, dnames, fnames in os.walk(file):
+ fpaths = [os.path.join(dirpath, fname) for fname in fnames]
+ for pattern in exclude:
+ # os.walk() supports trimming down the dnames list
+ # by modifying it in-place,
+ # to avoid unnecessary directory listings.
+ dnames[:] = [
+ x for x in dnames
+ if
+ not fnmatch.fnmatch(os.path.join(dirpath, x), pattern)
+ ]
+ fpaths = [
+ x for x in fpaths if not fnmatch.fnmatch(x, pattern)
+ ]
+ for f in fpaths:
+ ext = os.path.splitext(f)[1][1:]
+ if ext in extensions:
+ out.append(f)
+ else:
+ out.append(file)
+ return out
+
+
+def make_diff(file, original, reformatted):
+ return list(
+ difflib.unified_diff(
+ original,
+ reformatted,
+ fromfile='{}\t(original)'.format(file),
+ tofile='{}\t(reformatted)'.format(file),
+ n=3))
+
+
+class DiffError(Exception):
+ def __init__(self, message, errs=None):
+ super(DiffError, self).__init__(message)
+ self.errs = errs or []
+
+
+class UnexpectedError(Exception):
+ def __init__(self, message, exc=None):
+ super(UnexpectedError, self).__init__(message)
+ self.formatted_traceback = traceback.format_exc()
+ self.exc = exc
+
+
+def run_clang_format_diff_wrapper(args, file):
+ try:
+ ret = run_clang_format_diff(args, file)
+ return ret
+ except DiffError:
+ raise
+ except Exception as e:
+ raise UnexpectedError('{}: {}: {}'.format(file, e.__class__.__name__,
+ e), e)
+
+
+def run_clang_format_diff(args, file):
+ try:
+ with io.open(file, 'r', encoding='utf-8') as f:
+ original = f.readlines()
+ except IOError as exc:
+ raise DiffError(str(exc))
+ invocation = [args.clang_format_executable, file]
+
+ # Use of utf-8 to decode the process output.
+ #
+ # Hopefully, this is the correct thing to do.
+ #
+ # It's done due to the following assumptions (which may be incorrect):
+ # - clang-format will returns the bytes read from the files as-is,
+ # without conversion, and it is already assumed that the files use utf-8.
+ # - if the diagnostics were internationalized, they would use utf-8:
+ # > Adding Translations to Clang
+ # >
+ # > Not possible yet!
+ # > Diagnostic strings should be written in UTF-8,
+ # > the client can translate to the relevant code page if needed.
+ # > Each translation completely replaces the format string
+ # > for the diagnostic.
+ # > -- http://clang.llvm.org/docs/InternalsManual.html#internals-diag-translation
+ #
+ # It's not pretty, due to Python 2 & 3 compatibility.
+ encoding_py3 = {}
+ if sys.version_info[0] >= 3:
+ encoding_py3['encoding'] = 'utf-8'
+
+ try:
+ proc = subprocess.Popen(
+ invocation,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ universal_newlines=True,
+ **encoding_py3)
+ except OSError as exc:
+ raise DiffError(
+ "Command '{}' failed to start: {}".format(
+ subprocess.list2cmdline(invocation), exc
+ )
+ )
+ proc_stdout = proc.stdout
+ proc_stderr = proc.stderr
+ if sys.version_info[0] < 3:
+ # make the pipes compatible with Python 3,
+ # reading lines should output unicode
+ encoding = 'utf-8'
+ proc_stdout = codecs.getreader(encoding)(proc_stdout)
+ proc_stderr = codecs.getreader(encoding)(proc_stderr)
+ # hopefully the stderr pipe won't get full and block the process
+ outs = list(proc_stdout.readlines())
+ errs = list(proc_stderr.readlines())
+ proc.wait()
+ if proc.returncode:
+ raise DiffError(
+ "Command '{}' returned non-zero exit status {}".format(
+ subprocess.list2cmdline(invocation), proc.returncode
+ ),
+ errs,
+ )
+ return make_diff(file, original, outs), errs
+
+
+def bold_red(s):
+ return '\x1b[1m\x1b[31m' + s + '\x1b[0m'
+
+
+def colorize(diff_lines):
+ def bold(s):
+ return '\x1b[1m' + s + '\x1b[0m'
+
+ def cyan(s):
+ return '\x1b[36m' + s + '\x1b[0m'
+
+ def green(s):
+ return '\x1b[32m' + s + '\x1b[0m'
+
+ def red(s):
+ return '\x1b[31m' + s + '\x1b[0m'
+
+ for line in diff_lines:
+ if line[:4] in ['--- ', '+++ ']:
+ yield bold(line)
+ elif line.startswith('@@ '):
+ yield cyan(line)
+ elif line.startswith('+'):
+ yield green(line)
+ elif line.startswith('-'):
+ yield red(line)
+ else:
+ yield line
+
+
+def print_diff(diff_lines, use_color):
+ if use_color:
+ diff_lines = colorize(diff_lines)
+ if sys.version_info[0] < 3:
+ sys.stdout.writelines((l.encode('utf-8') for l in diff_lines))
+ else:
+ sys.stdout.writelines(diff_lines)
+
+
+def print_trouble(prog, message, use_colors):
+ error_text = 'error:'
+ if use_colors:
+ error_text = bold_red(error_text)
+ print("{}: {} {}".format(prog, error_text, message), file=sys.stderr)
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument(
+ '--clang-format-executable',
+ metavar='EXECUTABLE',
+ help='path to the clang-format executable',
+ default='clang-format')
+ parser.add_argument(
+ '--extensions',
+ help='comma separated list of file extensions (default: {})'.format(
+ DEFAULT_EXTENSIONS),
+ default=DEFAULT_EXTENSIONS)
+ parser.add_argument(
+ '-r',
+ '--recursive',
+ action='store_true',
+ help='run recursively over directories')
+ parser.add_argument('files', metavar='file', nargs='+')
+ parser.add_argument(
+ '-q',
+ '--quiet',
+ action='store_true',
+ help="disable output, useful for the exit code")
+ parser.add_argument(
+ '-j',
+ metavar='N',
+ type=int,
+ default=0,
+ help='run N clang-format jobs in parallel'
+ ' (default number of cpus + 1)')
+ parser.add_argument(
+ '--color',
+ default='auto',
+ choices=['auto', 'always', 'never'],
+ help='show colored diff (default: auto)')
+ parser.add_argument(
+ '-e',
+ '--exclude',
+ metavar='PATTERN',
+ action='append',
+ default=[],
+ help='exclude paths matching the given glob-like pattern(s)'
+ ' from recursive search')
+
+ args = parser.parse_args()
+
+ # use default signal handling, like diff return SIGINT value on ^C
+ # https://bugs.python.org/issue14229#msg156446
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+ try:
+ signal.SIGPIPE
+ except AttributeError:
+ # compatibility, SIGPIPE does not exist on Windows
+ pass
+ else:
+ signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
+ colored_stdout = False
+ colored_stderr = False
+ if args.color == 'always':
+ colored_stdout = True
+ colored_stderr = True
+ elif args.color == 'auto':
+ colored_stdout = sys.stdout.isatty()
+ colored_stderr = sys.stderr.isatty()
+
+ version_invocation = [args.clang_format_executable, str("--version")]
+ try:
+ subprocess.check_call(version_invocation, stdout=DEVNULL)
+ except subprocess.CalledProcessError as e:
+ print_trouble(parser.prog, str(e), use_colors=colored_stderr)
+ return ExitStatus.TROUBLE
+ except OSError as e:
+ print_trouble(
+ parser.prog,
+ "Command '{}' failed to start: {}".format(
+ subprocess.list2cmdline(version_invocation), e
+ ),
+ use_colors=colored_stderr,
+ )
+ return ExitStatus.TROUBLE
+
+ retcode = ExitStatus.SUCCESS
+
+ excludes = excludes_from_file(DEFAULT_CLANG_FORMAT_IGNORE)
+ excludes.extend(args.exclude)
+
+ files = list_files(
+ args.files,
+ recursive=args.recursive,
+ exclude=excludes,
+ extensions=args.extensions.split(','))
+
+ if not files:
+ return
+
+ njobs = args.j
+ if njobs == 0:
+ njobs = multiprocessing.cpu_count() + 1
+ njobs = min(len(files), njobs)
+
+ if njobs == 1:
+ # execute directly instead of in a pool,
+ # less overhead, simpler stacktraces
+ it = (run_clang_format_diff_wrapper(args, file) for file in files)
+ pool = None
+ else:
+ pool = multiprocessing.Pool(njobs)
+ it = pool.imap_unordered(
+ partial(run_clang_format_diff_wrapper, args), files)
+ while True:
+ try:
+ outs, errs = next(it)
+ except StopIteration:
+ break
+ except DiffError as e:
+ print_trouble(parser.prog, str(e), use_colors=colored_stderr)
+ retcode = ExitStatus.TROUBLE
+ sys.stderr.writelines(e.errs)
+ except UnexpectedError as e:
+ print_trouble(parser.prog, str(e), use_colors=colored_stderr)
+ sys.stderr.write(e.formatted_traceback)
+ retcode = ExitStatus.TROUBLE
+ # stop at the first unexpected error,
+ # something could be very wrong,
+ # don't process all files unnecessarily
+ if pool:
+ pool.terminate()
+ break
+ else:
+ sys.stderr.writelines(errs)
+ if outs == []:
+ continue
+ if not args.quiet:
+ print_diff(outs, use_color=colored_stdout)
+ if retcode == ExitStatus.SUCCESS:
+ retcode = ExitStatus.DIFF
+ return retcode
+
+
+if __name__ == '__main__':
+ sys.exit(main())