From 4fc34de573470a1775041e5115f6606eb6e5b4af Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Sat, 21 Jun 2025 13:34:36 +0200 Subject: [PATCH 1/4] Remove NOLINTs --- .clang-tidy | 3 +- modules/core/performance/tests/.clang-tidy | 12 +++++++ modules/core/performance/tests/perf_tests.cpp | 34 +++++++++---------- modules/core/runners/src/runners.cpp | 2 -- modules/core/task/include/task.hpp | 1 + modules/core/task/tests/.clang-tidy | 12 +++++++ modules/core/task/tests/task_tests.cpp | 5 ++- modules/core/task/tests/test_task.hpp | 1 - modules/core/util/include/func_test_util.hpp | 1 - modules/core/util/include/perf_test_util.hpp | 4 +-- modules/core/util/include/util.hpp | 16 +++------ tasks/example_processes/mpi/src/ops_mpi.cpp | 1 - tasks/example_processes/seq/src/ops_seq.cpp | 1 - tasks/example_processes/tests/.clang-tidy | 12 +++++++ .../tests/functional/main.cpp | 2 +- .../tests/performance/main.cpp | 3 +- tasks/example_threads/all/src/ops_all.cpp | 1 - tasks/example_threads/omp/src/ops_omp.cpp | 1 - tasks/example_threads/seq/src/ops_seq.cpp | 1 - tasks/example_threads/stl/src/ops_stl.cpp | 1 - tasks/example_threads/tbb/src/ops_tbb.cpp | 1 - tasks/example_threads/tests/.clang-tidy | 12 +++++++ .../example_threads/tests/functional/main.cpp | 2 +- .../tests/performance/main.cpp | 3 +- 24 files changed, 80 insertions(+), 52 deletions(-) create mode 100644 modules/core/performance/tests/.clang-tidy create mode 100644 modules/core/task/tests/.clang-tidy create mode 100644 tasks/example_processes/tests/.clang-tidy create mode 100644 tasks/example_threads/tests/.clang-tidy diff --git a/.clang-tidy b/.clang-tidy index 1589f0ca3..6fa5717ba 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -26,6 +26,7 @@ Checks: > -modernize-avoid-c-arrays, -modernize-loop-convert, -modernize-use-trailing-return-type, + -portability-template-virtual-member-function, -readability-magic-numbers WarningsAsErrors: "*" @@ -81,7 +82,7 @@ CheckOptions: value: 1 # Functions with scores beyond 15 are typically flagged as potentially problematic (empirically) - key: readability-function-cognitive-complexity.Threshold - value: 20 # default: 25 + value: 15 # default: 25 - key: readability-identifier-length.MinimumVariableNameLength value: 1 - key: readability-identifier-length.MinimumParameterNameLength diff --git a/modules/core/performance/tests/.clang-tidy b/modules/core/performance/tests/.clang-tidy new file mode 100644 index 000000000..b35ef7613 --- /dev/null +++ b/modules/core/performance/tests/.clang-tidy @@ -0,0 +1,12 @@ +InheritParentConfig: true + +Checks: > + -cppcoreguidelines-avoid-goto, + -cppcoreguidelines-avoid-non-const-global-variables, + -misc-use-anonymous-namespace, + -modernize-use-std-print, + -modernize-type-traits, + +CheckOptions: + - key: readability-function-cognitive-complexity.Threshold + value: 50 # default: 25 diff --git a/modules/core/performance/tests/perf_tests.cpp b/modules/core/performance/tests/perf_tests.cpp index d0a5ee002..654c965b0 100644 --- a/modules/core/performance/tests/perf_tests.cpp +++ b/modules/core/performance/tests/perf_tests.cpp @@ -63,7 +63,7 @@ TEST(perf_tests, check_perf_pipeline_uint8_t_slow_test) { }; perf_analyzer.PipelineRun(perf_attr); - ASSERT_ANY_THROW_NOLINT(perf_analyzer.PrintPerfStatistic("check_perf_pipeline_uint8_t_slow_test")); + ASSERT_ANY_THROW(perf_analyzer.PrintPerfStatistic("check_perf_pipeline_uint8_t_slow_test")); } TEST(perf_tests, check_perf_task_exception) { @@ -73,7 +73,7 @@ TEST(perf_tests, check_perf_task_exception) { ppc::core::Perf, uint32_t> perf_analyzer(test_task); - ASSERT_ANY_THROW_NOLINT(perf_analyzer.PrintPerfStatistic("check_perf_task_exception")); + ASSERT_ANY_THROW(perf_analyzer.PrintPerfStatistic("check_perf_task_exception")); ppc::core::PerfAttr perf_attr; perf_analyzer.TaskRun(perf_attr); @@ -109,7 +109,7 @@ TEST_P(GetStringParamNameParamTest, ReturnsExpectedString) { EXPECT_EQ(ppc::core::GetStringParamName(param.input), param.expected_output); } -INSTANTIATE_TEST_SUITE_P_WITH_NAME( +INSTANTIATE_TEST_SUITE_P( ParamTests, GetStringParamNameParamTest, ::testing::Values(ParamTestCase{ppc::core::PerfResults::kTaskRun, "task_run"}, ParamTestCase{ppc::core::PerfResults::kPipeline, "pipeline"}, @@ -151,7 +151,7 @@ TEST_P(GetStringTaskTypeTest, ReturnsExpectedString) { EXPECT_EQ(GetStringTaskType(param.type, temp_path), param.expected) << "Failed on: " << param.label; } -INSTANTIATE_TEST_SUITE_P_NOLINT(AllTypeCases, GetStringTaskTypeTest, +INSTANTIATE_TEST_SUITE_P(AllTypeCases, GetStringTaskTypeTest, ::testing::Values(TaskTypeTestCase{ppc::core::TypeOfTask::kALL, "all_ALL", "kALL"}, TaskTypeTestCase{ppc::core::TypeOfTask::kSTL, "stl_STL", "kSTL"}, TaskTypeTestCase{ppc::core::TypeOfTask::kOMP, "omp_OMP", "kOMP"}, @@ -159,14 +159,14 @@ INSTANTIATE_TEST_SUITE_P_NOLINT(AllTypeCases, GetStringTaskTypeTest, TaskTypeTestCase{ppc::core::TypeOfTask::kTBB, "tbb_TBB", "kTBB"}, TaskTypeTestCase{ppc::core::TypeOfTask::kSEQ, "seq_SEQ", "kSEQ"})); -TEST_NOLINT(GetStringTaskTypeStandaloneTest, ThrowsIfFileMissing) { +TEST(GetStringTaskTypeStandaloneTest, ThrowsIfFileMissing) { std::string missing_path = "non_existent_settings.json"; - EXPECT_THROW_NOLINT(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, missing_path), std::runtime_error); + EXPECT_THROW(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, missing_path), std::runtime_error); } -TEST_NOLINT(GetStringTaskTypeStandaloneTest, ExceptionMessageContainsPath) { +TEST(GetStringTaskTypeStandaloneTest, ExceptionMessageContainsPath) { const std::string missing_path = "non_existent_settings.json"; - EXPECT_THROW_NOLINT( + EXPECT_THROW( try { GetStringTaskType(ppc::core::TypeOfTask::kSEQ, missing_path); } catch (const std::runtime_error& e) { EXPECT_NE(std::string(e.what()).find(missing_path), std::string::npos); throw; @@ -184,23 +184,23 @@ TEST(GetStringTaskTypeStandaloneTest, ReturnsUnknownForInvalidEnum) { std::filesystem::remove(path); } -TEST_NOLINT(GetStringTaskTypeEdgeCases, ThrowsIfFileCannotBeOpened) { - EXPECT_THROW_NOLINT(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, "definitely_missing_file.json"), +TEST(GetStringTaskTypeEdgeCases, ThrowsIfFileCannotBeOpened) { + EXPECT_THROW(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, "definitely_missing_file.json"), std::runtime_error); } -TEST_NOLINT(GetStringTaskTypeEdgeCases, ThrowsIfJsonIsMalformed) { +TEST(GetStringTaskTypeEdgeCases, ThrowsIfJsonIsMalformed) { std::string path = (std::filesystem::temp_directory_path() / "bad_json.json").string(); std::ofstream(path) << "{ this is not valid json "; - EXPECT_THROW_NOLINT(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, path), NlohmannJsonParseError); + EXPECT_THROW(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, path), NlohmannJsonParseError); std::filesystem::remove(path); } -TEST_NOLINT(GetStringTaskTypeEdgeCases, ThrowsIfJsonValueIsNull) { +TEST(GetStringTaskTypeEdgeCases, ThrowsIfJsonValueIsNull) { std::string path = (std::filesystem::temp_directory_path() / "null_value.json").string(); std::ofstream(path) << R"({"tasks": { "seq": null }})"; - EXPECT_THROW_NOLINT(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, path), NlohmannJsonTypeError); + EXPECT_THROW(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, path), NlohmannJsonTypeError); std::filesystem::remove(path); } @@ -237,9 +237,9 @@ TEST(TaskTest, GetDynamicTypeReturnsCorrectEnum) { EXPECT_EQ(task.GetDynamicTypeOfTask(), ppc::core::TypeOfTask::kOMP); } -TEST_NOLINT(TaskTest, DestructorTerminatesIfWrongOrder) { +TEST(TaskTest, DestructorTerminatesIfWrongOrder) { testing::FLAGS_gtest_death_test_style = "threadsafe"; - ASSERT_DEATH_IF_SUPPORTED_NOLINT( + ASSERT_DEATH_IF_SUPPORTED( { DummyTask task; task.Run(); @@ -262,7 +262,7 @@ using TestTypes = ::testing::Types; TYPED_TEST_SUITE(GetNamespaceTest, TestTypes); -TYPED_TEST_NOLINT(GetNamespaceTest, ExtractsNamespaceCorrectly) { +TYPED_TEST(GetNamespaceTest, ExtractsNamespaceCorrectly) { constexpr std::string_view kNs = ppc::util::GetNamespace(); if constexpr (std::is_same_v) { diff --git a/modules/core/runners/src/runners.cpp b/modules/core/runners/src/runners.cpp index 565deafc7..b0db49dea 100644 --- a/modules/core/runners/src/runners.cpp +++ b/modules/core/runners/src/runners.cpp @@ -2,9 +2,7 @@ #include #include -#include -#include #include #include #include diff --git a/modules/core/task/include/task.hpp b/modules/core/task/include/task.hpp index 6455b340d..8223878d8 100644 --- a/modules/core/task/include/task.hpp +++ b/modules/core/task/include/task.hpp @@ -14,6 +14,7 @@ #include #include #include +#include namespace ppc::core { diff --git a/modules/core/task/tests/.clang-tidy b/modules/core/task/tests/.clang-tidy new file mode 100644 index 000000000..b35ef7613 --- /dev/null +++ b/modules/core/task/tests/.clang-tidy @@ -0,0 +1,12 @@ +InheritParentConfig: true + +Checks: > + -cppcoreguidelines-avoid-goto, + -cppcoreguidelines-avoid-non-const-global-variables, + -misc-use-anonymous-namespace, + -modernize-use-std-print, + -modernize-type-traits, + +CheckOptions: + - key: readability-function-cognitive-complexity.Threshold + value: 50 # default: 25 diff --git a/modules/core/task/tests/task_tests.cpp b/modules/core/task/tests/task_tests.cpp index f8edb12fd..6fc764556 100644 --- a/modules/core/task/tests/task_tests.cpp +++ b/modules/core/task/tests/task_tests.cpp @@ -5,7 +5,6 @@ #include #include "core/task/tests/test_task.hpp" -#include "core/util/include/util.hpp" TEST(task_tests, check_int32_t) { // Create data @@ -128,7 +127,7 @@ TEST(task_tests, check_float) { EXPECT_NEAR(test_task.GetOutput(), in.size(), 1e-3); } -TEST_NOLINT(task_tests, check_wrong_order_disabled_valgrind) { +TEST(task_tests, check_wrong_order_disabled_valgrind) { auto destroy_function = [] { // Create data std::vector in(20, 1); @@ -143,7 +142,7 @@ TEST_NOLINT(task_tests, check_wrong_order_disabled_valgrind) { EXPECT_DEATH_IF_SUPPORTED(destroy_function(), ".*ORDER OF FUNCTIONS IS NOT RIGHT.*"); } -TEST_NOLINT(task_tests, check_empty_order_disabled_valgrind) { +TEST(task_tests, check_empty_order_disabled_valgrind) { auto destroy_function = [] { // Create data std::vector in(20, 1); diff --git a/modules/core/task/tests/test_task.hpp b/modules/core/task/tests/test_task.hpp index e3d872e2f..042298a29 100644 --- a/modules/core/task/tests/test_task.hpp +++ b/modules/core/task/tests/test_task.hpp @@ -2,7 +2,6 @@ #include #include -#include #include "core/task/include/task.hpp" diff --git a/modules/core/util/include/func_test_util.hpp b/modules/core/util/include/func_test_util.hpp index c36250c3d..22aac7ac6 100644 --- a/modules/core/util/include/func_test_util.hpp +++ b/modules/core/util/include/func_test_util.hpp @@ -1,7 +1,6 @@ #pragma once #include -#include #include #include diff --git a/modules/core/util/include/perf_test_util.hpp b/modules/core/util/include/perf_test_util.hpp index e877b4b82..10b63f15e 100644 --- a/modules/core/util/include/perf_test_util.hpp +++ b/modules/core/util/include/perf_test_util.hpp @@ -115,8 +115,8 @@ auto MakePerfTaskTuples(const std::string& settings_path) { } template -auto TupleToGTestValuesImpl(Tuple&& tup, std::index_sequence /*unused*/) { - return ::testing::Values(std::get(std::forward(tup))...); +auto TupleToGTestValuesImpl(const Tuple& tup, std::index_sequence /*unused*/) { + return ::testing::Values(std::get(tup)...); } template diff --git a/modules/core/util/include/util.hpp b/modules/core/util/include/util.hpp index 2785084f0..e07a0fcd1 100644 --- a/modules/core/util/include/util.hpp +++ b/modules/core/util/include/util.hpp @@ -1,5 +1,6 @@ #pragma once +#include "nlohmann/json_fwd.hpp" #include #include #include @@ -13,24 +14,16 @@ #pragma warning(disable : 4459) #endif -#include // NOLINT(misc-include-cleaner) +#include /// @brief JSON namespace used for settings and config parsing. -using NlohmannJsonParseError = nlohmann::json::parse_error; // NOLINT(misc-include-cleaner) +using NlohmannJsonParseError = nlohmann::json::parse_error; /// @brief JSON namespace used for settings and config typing. -using NlohmannJsonTypeError = nlohmann::json::type_error; // NOLINT(misc-include-cleaner) +using NlohmannJsonTypeError = nlohmann::json::type_error; #ifdef _MSC_VER #pragma warning(pop) #endif -#define ASSERT_ANY_THROW_NOLINT(stmt) ASSERT_ANY_THROW(stmt) // NOLINT -#define EXPECT_THROW_NOLINT(stmt, error) EXPECT_THROW(stmt, error) // NOLINT -#define TEST_NOLINT(test_suite_name, test_name) TEST(test_suite_name, test_name) // NOLINT -#define ASSERT_DEATH_IF_SUPPORTED_NOLINT(stmt, name) ASSERT_DEATH_IF_SUPPORTED(stmt, name) // NOLINT -#define TYPED_TEST_NOLINT(test_suite_name, test_name) TYPED_TEST(test_suite_name, test_name) // NOLINT -#define INSTANTIATE_TEST_SUITE_P_WITH_NAME(n, t, g, ng) INSTANTIATE_TEST_SUITE_P(n, t, g, ng) // NOLINT -#define INSTANTIATE_TEST_SUITE_P_NOLINT(n, t, g) INSTANTIATE_TEST_SUITE_P(n, t, g) // NOLINT -// INSTANTIATE_TEST_SUITE_P | n, t, g, ng == name, test_case_name, generator, name_generator namespace ppc::util { @@ -97,7 +90,6 @@ constexpr std::string_view GetNamespace() { #endif } -// NOLINTNEXTLINE(misc-include-cleaner) inline std::shared_ptr InitJSONPtr() { return std::make_shared(); } bool IsUnderMpirun(); diff --git a/tasks/example_processes/mpi/src/ops_mpi.cpp b/tasks/example_processes/mpi/src/ops_mpi.cpp index 1a6fb1687..b426c3325 100644 --- a/tasks/example_processes/mpi/src/ops_mpi.cpp +++ b/tasks/example_processes/mpi/src/ops_mpi.cpp @@ -2,7 +2,6 @@ #include -#include #include #include diff --git a/tasks/example_processes/seq/src/ops_seq.cpp b/tasks/example_processes/seq/src/ops_seq.cpp index 8528c11f4..7795d7424 100644 --- a/tasks/example_processes/seq/src/ops_seq.cpp +++ b/tasks/example_processes/seq/src/ops_seq.cpp @@ -1,6 +1,5 @@ #include "example_processes/seq/include/ops_seq.hpp" -#include #include #include diff --git a/tasks/example_processes/tests/.clang-tidy b/tasks/example_processes/tests/.clang-tidy new file mode 100644 index 000000000..506d0dbc2 --- /dev/null +++ b/tasks/example_processes/tests/.clang-tidy @@ -0,0 +1,12 @@ +InheritParentConfig: true + +Checks: > + -cppcoreguidelines-avoid-goto, + -cppcoreguidelines-avoid-non-const-global-variables, + -misc-use-anonymous-namespace, + -modernize-use-std-print, + -modernize-type-traits, + +CheckOptions: + - key: readability-function-cognitive-complexity.Threshold + value: 25 # default: 25 diff --git a/tasks/example_processes/tests/functional/main.cpp b/tasks/example_processes/tests/functional/main.cpp index bd97d2b5e..113c611f4 100644 --- a/tasks/example_processes/tests/functional/main.cpp +++ b/tasks/example_processes/tests/functional/main.cpp @@ -72,7 +72,7 @@ const auto kGtestValues = ppc::util::ExpandToValues(kTestTasksList); const auto kPerfTestName = NesterovARunFuncTestsProcesses::PrintFuncTestName; -INSTANTIATE_TEST_SUITE_P_WITH_NAME(PicMatrixTests, NesterovARunFuncTestsProcesses, kGtestValues, kPerfTestName); +INSTANTIATE_TEST_SUITE_P(PicMatrixTests, NesterovARunFuncTestsProcesses, kGtestValues, kPerfTestName); } // namespace diff --git a/tasks/example_processes/tests/performance/main.cpp b/tasks/example_processes/tests/performance/main.cpp index 5b0fc0a73..1526a7877 100644 --- a/tasks/example_processes/tests/performance/main.cpp +++ b/tasks/example_processes/tests/performance/main.cpp @@ -1,7 +1,6 @@ #include #include "core/util/include/perf_test_util.hpp" -#include "core/util/include/util.hpp" #include "example_processes/common/include/common.hpp" #include "example_processes/mpi/include/ops_mpi.hpp" #include "example_processes/seq/include/ops_seq.hpp" @@ -28,6 +27,6 @@ const auto kGtestValues = ppc::util::TupleToGTestValues(kAllPerfTasks); const auto kPerfTestName = ExampleRunPerfTestProcesses::CustomPerfTestName; -INSTANTIATE_TEST_SUITE_P_WITH_NAME(RunModeTests, ExampleRunPerfTestProcesses, kGtestValues, kPerfTestName); +INSTANTIATE_TEST_SUITE_P(RunModeTests, ExampleRunPerfTestProcesses, kGtestValues, kPerfTestName); } // namespace nesterov_a_test_task_processes diff --git a/tasks/example_threads/all/src/ops_all.cpp b/tasks/example_threads/all/src/ops_all.cpp index 07d899c34..960ad344c 100644 --- a/tasks/example_threads/all/src/ops_all.cpp +++ b/tasks/example_threads/all/src/ops_all.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include #include diff --git a/tasks/example_threads/omp/src/ops_omp.cpp b/tasks/example_threads/omp/src/ops_omp.cpp index b10e5139f..ee3f42df7 100644 --- a/tasks/example_threads/omp/src/ops_omp.cpp +++ b/tasks/example_threads/omp/src/ops_omp.cpp @@ -1,7 +1,6 @@ #include "example_threads/omp/include/ops_omp.hpp" #include -#include #include #include diff --git a/tasks/example_threads/seq/src/ops_seq.cpp b/tasks/example_threads/seq/src/ops_seq.cpp index 073ab1c61..f645d2d52 100644 --- a/tasks/example_threads/seq/src/ops_seq.cpp +++ b/tasks/example_threads/seq/src/ops_seq.cpp @@ -1,6 +1,5 @@ #include "example_threads/seq/include/ops_seq.hpp" -#include #include #include diff --git a/tasks/example_threads/stl/src/ops_stl.cpp b/tasks/example_threads/stl/src/ops_stl.cpp index ea23bdb99..2e84e479e 100644 --- a/tasks/example_threads/stl/src/ops_stl.cpp +++ b/tasks/example_threads/stl/src/ops_stl.cpp @@ -1,7 +1,6 @@ #include "example_threads/stl/include/ops_stl.hpp" #include -#include #include #include #include diff --git a/tasks/example_threads/tbb/src/ops_tbb.cpp b/tasks/example_threads/tbb/src/ops_tbb.cpp index 0f057e676..9e3b37dbf 100644 --- a/tasks/example_threads/tbb/src/ops_tbb.cpp +++ b/tasks/example_threads/tbb/src/ops_tbb.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include #include diff --git a/tasks/example_threads/tests/.clang-tidy b/tasks/example_threads/tests/.clang-tidy new file mode 100644 index 000000000..506d0dbc2 --- /dev/null +++ b/tasks/example_threads/tests/.clang-tidy @@ -0,0 +1,12 @@ +InheritParentConfig: true + +Checks: > + -cppcoreguidelines-avoid-goto, + -cppcoreguidelines-avoid-non-const-global-variables, + -misc-use-anonymous-namespace, + -modernize-use-std-print, + -modernize-type-traits, + +CheckOptions: + - key: readability-function-cognitive-complexity.Threshold + value: 25 # default: 25 diff --git a/tasks/example_threads/tests/functional/main.cpp b/tasks/example_threads/tests/functional/main.cpp index e379679dd..b3131329e 100644 --- a/tasks/example_threads/tests/functional/main.cpp +++ b/tasks/example_threads/tests/functional/main.cpp @@ -78,7 +78,7 @@ const auto kGtestValues = ppc::util::ExpandToValues(kTestTasksList); const auto kPerfTestName = NesterovARunFuncTestsThreads::PrintFuncTestName; -INSTANTIATE_TEST_SUITE_P_WITH_NAME(PicMatrixTests, NesterovARunFuncTestsThreads, kGtestValues, kPerfTestName); +INSTANTIATE_TEST_SUITE_P(PicMatrixTests, NesterovARunFuncTestsThreads, kGtestValues, kPerfTestName); } // namespace diff --git a/tasks/example_threads/tests/performance/main.cpp b/tasks/example_threads/tests/performance/main.cpp index 56fd5810d..a49731afa 100644 --- a/tasks/example_threads/tests/performance/main.cpp +++ b/tasks/example_threads/tests/performance/main.cpp @@ -1,7 +1,6 @@ #include #include "core/util/include/perf_test_util.hpp" -#include "core/util/include/util.hpp" #include "example_threads/all/include/ops_all.hpp" #include "example_threads/common/include/common.hpp" #include "example_threads/omp/include/ops_omp.hpp" @@ -32,6 +31,6 @@ const auto kGtestValues = ppc::util::TupleToGTestValues(kAllPerfTasks); const auto kPerfTestName = ExampleRunPerfTestThreads::CustomPerfTestName; -INSTANTIATE_TEST_SUITE_P_WITH_NAME(RunModeTests, ExampleRunPerfTestThreads, kGtestValues, kPerfTestName); +INSTANTIATE_TEST_SUITE_P(RunModeTests, ExampleRunPerfTestThreads, kGtestValues, kPerfTestName); } // namespace nesterov_a_test_task_threads From 99bbac4641984d5fb26bfcd103769745659fcfe5 Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Sat, 21 Jun 2025 15:44:59 +0200 Subject: [PATCH 2/4] fmt --- modules/core/performance/tests/perf_tests.cpp | 28 +++++++++---------- modules/core/util/include/util.hpp | 4 +-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/core/performance/tests/perf_tests.cpp b/modules/core/performance/tests/perf_tests.cpp index 654c965b0..69d8b3e6c 100644 --- a/modules/core/performance/tests/perf_tests.cpp +++ b/modules/core/performance/tests/perf_tests.cpp @@ -109,12 +109,13 @@ TEST_P(GetStringParamNameParamTest, ReturnsExpectedString) { EXPECT_EQ(ppc::core::GetStringParamName(param.input), param.expected_output); } -INSTANTIATE_TEST_SUITE_P( - ParamTests, GetStringParamNameParamTest, - ::testing::Values(ParamTestCase{ppc::core::PerfResults::kTaskRun, "task_run"}, - ParamTestCase{ppc::core::PerfResults::kPipeline, "pipeline"}, - ParamTestCase{ppc::core::PerfResults::TypeOfRunning::kNone, "none"}), - [](const ::testing::TestParamInfo& info) { return info.param.expected_output; }); +INSTANTIATE_TEST_SUITE_P(ParamTests, GetStringParamNameParamTest, + ::testing::Values(ParamTestCase{ppc::core::PerfResults::kTaskRun, "task_run"}, + ParamTestCase{ppc::core::PerfResults::kPipeline, "pipeline"}, + ParamTestCase{ppc::core::PerfResults::TypeOfRunning::kNone, "none"}), + [](const ::testing::TestParamInfo& info) { + return info.param.expected_output; + }); struct TaskTypeTestCase { ppc::core::TypeOfTask type; @@ -152,12 +153,12 @@ TEST_P(GetStringTaskTypeTest, ReturnsExpectedString) { } INSTANTIATE_TEST_SUITE_P(AllTypeCases, GetStringTaskTypeTest, - ::testing::Values(TaskTypeTestCase{ppc::core::TypeOfTask::kALL, "all_ALL", "kALL"}, - TaskTypeTestCase{ppc::core::TypeOfTask::kSTL, "stl_STL", "kSTL"}, - TaskTypeTestCase{ppc::core::TypeOfTask::kOMP, "omp_OMP", "kOMP"}, - TaskTypeTestCase{ppc::core::TypeOfTask::kMPI, "mpi_MPI", "kMPI"}, - TaskTypeTestCase{ppc::core::TypeOfTask::kTBB, "tbb_TBB", "kTBB"}, - TaskTypeTestCase{ppc::core::TypeOfTask::kSEQ, "seq_SEQ", "kSEQ"})); + ::testing::Values(TaskTypeTestCase{ppc::core::TypeOfTask::kALL, "all_ALL", "kALL"}, + TaskTypeTestCase{ppc::core::TypeOfTask::kSTL, "stl_STL", "kSTL"}, + TaskTypeTestCase{ppc::core::TypeOfTask::kOMP, "omp_OMP", "kOMP"}, + TaskTypeTestCase{ppc::core::TypeOfTask::kMPI, "mpi_MPI", "kMPI"}, + TaskTypeTestCase{ppc::core::TypeOfTask::kTBB, "tbb_TBB", "kTBB"}, + TaskTypeTestCase{ppc::core::TypeOfTask::kSEQ, "seq_SEQ", "kSEQ"})); TEST(GetStringTaskTypeStandaloneTest, ThrowsIfFileMissing) { std::string missing_path = "non_existent_settings.json"; @@ -185,8 +186,7 @@ TEST(GetStringTaskTypeStandaloneTest, ReturnsUnknownForInvalidEnum) { } TEST(GetStringTaskTypeEdgeCases, ThrowsIfFileCannotBeOpened) { - EXPECT_THROW(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, "definitely_missing_file.json"), - std::runtime_error); + EXPECT_THROW(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, "definitely_missing_file.json"), std::runtime_error); } TEST(GetStringTaskTypeEdgeCases, ThrowsIfJsonIsMalformed) { diff --git a/modules/core/util/include/util.hpp b/modules/core/util/include/util.hpp index e07a0fcd1..a6fdea756 100644 --- a/modules/core/util/include/util.hpp +++ b/modules/core/util/include/util.hpp @@ -1,12 +1,13 @@ #pragma once -#include "nlohmann/json_fwd.hpp" #include #include #include #include #include +#include "nlohmann/json_fwd.hpp" + #define PPC_FUNC_NAME __func__ #ifdef _MSC_VER @@ -24,7 +25,6 @@ using NlohmannJsonTypeError = nlohmann::json::type_error; #pragma warning(pop) #endif - namespace ppc::util { enum GTestParamIndex : uint8_t { kTaskGetter, kNameTest, kTestParams }; From cda0c03db27757be614fbc2b2f00a7f42c007a55 Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Sat, 21 Jun 2025 16:02:02 +0200 Subject: [PATCH 3/4] fill --- modules/core/performance/tests/.clang-tidy | 29 ++++++++++++++++++++++ modules/core/task/tests/.clang-tidy | 29 ++++++++++++++++++++++ tasks/example_processes/tests/.clang-tidy | 29 ++++++++++++++++++++++ tasks/example_threads/tests/.clang-tidy | 29 ++++++++++++++++++++++ 4 files changed, 116 insertions(+) diff --git a/modules/core/performance/tests/.clang-tidy b/modules/core/performance/tests/.clang-tidy index b35ef7613..508219a92 100644 --- a/modules/core/performance/tests/.clang-tidy +++ b/modules/core/performance/tests/.clang-tidy @@ -1,6 +1,35 @@ InheritParentConfig: true Checks: > + bugprone-*, + clang-diagnostic-*, + concurrency-*, + cppcoreguidelines-*, + llvm-include-order, + llvm-namespace-comment, + misc-*, + modernize-*, + mpi-*, + openmp-*, + performance-*, + portability-*, + readability-*, + -bugprone-casting-through-void, + -bugprone-easily-swappable-parameters, + -cppcoreguidelines-avoid-magic-numbers, + -cppcoreguidelines-non-private-member-variables-in-classes, + -cppcoreguidelines-owning-memory, + -cppcoreguidelines-pro-bounds-pointer-arithmetic, + -cppcoreguidelines-pro-type-reinterpret-cast, + -cppcoreguidelines-pro-type-vararg, + -cppcoreguidelines-special-member-functions, + -misc-const-correctness, + -misc-non-private-member-variables-in-classes, + -modernize-avoid-c-arrays, + -modernize-loop-convert, + -modernize-use-trailing-return-type, + -portability-template-virtual-member-function, + -readability-magic-numbers, -cppcoreguidelines-avoid-goto, -cppcoreguidelines-avoid-non-const-global-variables, -misc-use-anonymous-namespace, diff --git a/modules/core/task/tests/.clang-tidy b/modules/core/task/tests/.clang-tidy index b35ef7613..508219a92 100644 --- a/modules/core/task/tests/.clang-tidy +++ b/modules/core/task/tests/.clang-tidy @@ -1,6 +1,35 @@ InheritParentConfig: true Checks: > + bugprone-*, + clang-diagnostic-*, + concurrency-*, + cppcoreguidelines-*, + llvm-include-order, + llvm-namespace-comment, + misc-*, + modernize-*, + mpi-*, + openmp-*, + performance-*, + portability-*, + readability-*, + -bugprone-casting-through-void, + -bugprone-easily-swappable-parameters, + -cppcoreguidelines-avoid-magic-numbers, + -cppcoreguidelines-non-private-member-variables-in-classes, + -cppcoreguidelines-owning-memory, + -cppcoreguidelines-pro-bounds-pointer-arithmetic, + -cppcoreguidelines-pro-type-reinterpret-cast, + -cppcoreguidelines-pro-type-vararg, + -cppcoreguidelines-special-member-functions, + -misc-const-correctness, + -misc-non-private-member-variables-in-classes, + -modernize-avoid-c-arrays, + -modernize-loop-convert, + -modernize-use-trailing-return-type, + -portability-template-virtual-member-function, + -readability-magic-numbers, -cppcoreguidelines-avoid-goto, -cppcoreguidelines-avoid-non-const-global-variables, -misc-use-anonymous-namespace, diff --git a/tasks/example_processes/tests/.clang-tidy b/tasks/example_processes/tests/.clang-tidy index 506d0dbc2..44dc4b0fd 100644 --- a/tasks/example_processes/tests/.clang-tidy +++ b/tasks/example_processes/tests/.clang-tidy @@ -1,6 +1,35 @@ InheritParentConfig: true Checks: > + bugprone-*, + clang-diagnostic-*, + concurrency-*, + cppcoreguidelines-*, + llvm-include-order, + llvm-namespace-comment, + misc-*, + modernize-*, + mpi-*, + openmp-*, + performance-*, + portability-*, + readability-*, + -bugprone-casting-through-void, + -bugprone-easily-swappable-parameters, + -cppcoreguidelines-avoid-magic-numbers, + -cppcoreguidelines-non-private-member-variables-in-classes, + -cppcoreguidelines-owning-memory, + -cppcoreguidelines-pro-bounds-pointer-arithmetic, + -cppcoreguidelines-pro-type-reinterpret-cast, + -cppcoreguidelines-pro-type-vararg, + -cppcoreguidelines-special-member-functions, + -misc-const-correctness, + -misc-non-private-member-variables-in-classes, + -modernize-avoid-c-arrays, + -modernize-loop-convert, + -modernize-use-trailing-return-type, + -portability-template-virtual-member-function, + -readability-magic-numbers, -cppcoreguidelines-avoid-goto, -cppcoreguidelines-avoid-non-const-global-variables, -misc-use-anonymous-namespace, diff --git a/tasks/example_threads/tests/.clang-tidy b/tasks/example_threads/tests/.clang-tidy index 506d0dbc2..44dc4b0fd 100644 --- a/tasks/example_threads/tests/.clang-tidy +++ b/tasks/example_threads/tests/.clang-tidy @@ -1,6 +1,35 @@ InheritParentConfig: true Checks: > + bugprone-*, + clang-diagnostic-*, + concurrency-*, + cppcoreguidelines-*, + llvm-include-order, + llvm-namespace-comment, + misc-*, + modernize-*, + mpi-*, + openmp-*, + performance-*, + portability-*, + readability-*, + -bugprone-casting-through-void, + -bugprone-easily-swappable-parameters, + -cppcoreguidelines-avoid-magic-numbers, + -cppcoreguidelines-non-private-member-variables-in-classes, + -cppcoreguidelines-owning-memory, + -cppcoreguidelines-pro-bounds-pointer-arithmetic, + -cppcoreguidelines-pro-type-reinterpret-cast, + -cppcoreguidelines-pro-type-vararg, + -cppcoreguidelines-special-member-functions, + -misc-const-correctness, + -misc-non-private-member-variables-in-classes, + -modernize-avoid-c-arrays, + -modernize-loop-convert, + -modernize-use-trailing-return-type, + -portability-template-virtual-member-function, + -readability-magic-numbers, -cppcoreguidelines-avoid-goto, -cppcoreguidelines-avoid-non-const-global-variables, -misc-use-anonymous-namespace, From ce318b95fe1b9a36907e9f8ff6bef1d4cc146c5f Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Sat, 21 Jun 2025 16:33:36 +0200 Subject: [PATCH 4/4] Do not fix the .clang-tidy config file --- .github/workflows/static-analysis-pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/static-analysis-pr.yml b/.github/workflows/static-analysis-pr.yml index 1b1dd1441..e1d09e537 100644 --- a/.github/workflows/static-analysis-pr.yml +++ b/.github/workflows/static-analysis-pr.yml @@ -29,8 +29,8 @@ jobs: cmake -S . -B build -G Ninja -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - config_file: .clang-tidy exclude: 3rdparty + clang_tidy_checks: "" split_workflow: true clang_tidy_version: "19" lgtm_comment_body: "" @@ -62,8 +62,8 @@ jobs: cmake -S . -B build -G Ninja -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - config_file: .clang-tidy exclude: 3rdparty + clang_tidy_checks: "" split_workflow: true clang_tidy_version: "19" lgtm_comment_body: ""