From b6bd0e7383bdeff8eb5b7c49e09d56feea34d8de Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Sun, 22 Mar 2026 17:07:30 +0100 Subject: [PATCH] Apply 'misc-override-with-different-visibility' clang-tidy remarks, align .clang-tidy files in the test directories --- .clang-tidy | 1 - modules/performance/tests/.clang-tidy | 1 + modules/task/tests/.clang-tidy | 1 + modules/task/tests/task_tests.cpp | 13 +++++++++++ modules/util/include/func_test_util.hpp | 24 +++++++++++++++------ tasks/example_processes/tests/.clang-tidy | 14 ++++++++++++ tasks/example_processes_2/tests/.clang-tidy | 14 ++++++++++++ tasks/example_processes_3/tests/.clang-tidy | 1 + tasks/example_threads/tests/.clang-tidy | 14 ++++++++++++ 9 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 tasks/example_processes/tests/.clang-tidy create mode 100644 tasks/example_processes_2/tests/.clang-tidy create mode 100644 tasks/example_threads/tests/.clang-tidy diff --git a/.clang-tidy b/.clang-tidy index 4562d8293..153e7c5e5 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -38,7 +38,6 @@ Checks: > -misc-const-correctness, -misc-non-private-member-variables-in-classes, -modernize-avoid-c-arrays, - -misc-override-with-different-visibility, -misc-use-internal-linkage, -modernize-use-trailing-return-type, -portability-avoid-pragma-once, diff --git a/modules/performance/tests/.clang-tidy b/modules/performance/tests/.clang-tidy index ef43b7aa8..d1e4c199c 100644 --- a/modules/performance/tests/.clang-tidy +++ b/modules/performance/tests/.clang-tidy @@ -4,6 +4,7 @@ Checks: > -modernize-loop-convert, -cppcoreguidelines-avoid-goto, -cppcoreguidelines-avoid-non-const-global-variables, + -misc-override-with-different-visibility, -misc-use-anonymous-namespace, -modernize-use-std-print, -modernize-type-traits diff --git a/modules/task/tests/.clang-tidy b/modules/task/tests/.clang-tidy index 9e502745e..60505db3c 100644 --- a/modules/task/tests/.clang-tidy +++ b/modules/task/tests/.clang-tidy @@ -4,6 +4,7 @@ Checks: > -modernize-loop-convert, -cppcoreguidelines-avoid-goto, -cppcoreguidelines-avoid-non-const-global-variables, + -misc-override-with-different-visibility, -misc-use-anonymous-namespace, -modernize-use-std-print, -modernize-type-traits diff --git a/modules/task/tests/task_tests.cpp b/modules/task/tests/task_tests.cpp index a374b1df1..91572832e 100644 --- a/modules/task/tests/task_tests.cpp +++ b/modules/task/tests/task_tests.cpp @@ -45,6 +45,7 @@ class TestTask : public ppc::task::Task { this->GetInput() = in; } + protected: bool ValidationImpl() override { return !this->GetInput().empty(); } @@ -71,6 +72,7 @@ class FakeSlowTask : public TestTask { public: explicit FakeSlowTask(const InType &in) : TestTask(in) {} + protected: bool RunImpl() override { std::this_thread::sleep_for(std::chrono::seconds(2)); return TestTask::RunImpl(); @@ -233,9 +235,12 @@ TEST(TaskTest, TaskDestructorThrowsIfStageIncomplete) { { std::vector in(20, 1); struct LocalTask : Task, int32_t> { + public: explicit LocalTask(const std::vector &in) { this->GetInput() = in; } + + protected: bool ValidationImpl() override { return true; } @@ -259,9 +264,12 @@ TEST(TaskTest, TaskDestructorThrowsIfEmpty) { { std::vector in(20, 1); struct LocalTask : Task, int32_t> { + public: explicit LocalTask(const std::vector &in) { this->GetInput() = in; } + + protected: bool ValidationImpl() override { return true; } @@ -285,9 +293,12 @@ TEST(TaskTest, InternalTimeTestThrowsIfTimeoutExceeded) { GTEST_SKIP() << "Skipped on macOS due to time fluctuations."; #endif struct SlowTask : Task, int32_t> { + public: explicit SlowTask(const std::vector &in) { this->GetInput() = in; } + + protected: bool ValidationImpl() override { return true; } @@ -315,6 +326,8 @@ TEST(TaskTest, InternalTimeTestThrowsIfTimeoutExceeded) { class DummyTask : public Task { public: using Task::Task; + + protected: bool ValidationImpl() override { return true; } diff --git a/modules/util/include/func_test_util.hpp b/modules/util/include/func_test_util.hpp index c892bf902..7d49edde9 100644 --- a/modules/util/include/func_test_util.hpp +++ b/modules/util/include/func_test_util.hpp @@ -36,11 +36,6 @@ template /// @tparam TestType Type of the test case or parameter. class BaseRunFuncTests : public ::testing::TestWithParam> { public: - virtual bool CheckTestOutputData(OutType &output_data) = 0; - /// @brief Provides input data for the task. - /// @return Initialized input data. - virtual InType GetTestInputData() = 0; - template static void RequireStaticInterface() { static_assert(HasPrintTestParam, @@ -56,6 +51,11 @@ class BaseRunFuncTests : public ::testing::TestWithParam test_param) { const std::string &test_name = std::get(GTestParamIndex::kNameTest)>(test_param); @@ -95,13 +95,23 @@ class BaseRunFuncTests : public ::testing::TestWithParamValidation()); EXPECT_TRUE(task_->PreProcessing()); + } + + void RunTask() { EXPECT_TRUE(task_->Run()); EXPECT_TRUE(task_->PostProcessing()); + } + + void CheckTaskOutput() { EXPECT_TRUE(CheckTestOutputData(task_->GetOutput())); } diff --git a/tasks/example_processes/tests/.clang-tidy b/tasks/example_processes/tests/.clang-tidy new file mode 100644 index 000000000..d1e4c199c --- /dev/null +++ b/tasks/example_processes/tests/.clang-tidy @@ -0,0 +1,14 @@ +InheritParentConfig: true + +Checks: > + -modernize-loop-convert, + -cppcoreguidelines-avoid-goto, + -cppcoreguidelines-avoid-non-const-global-variables, + -misc-override-with-different-visibility, + -misc-use-anonymous-namespace, + -modernize-use-std-print, + -modernize-type-traits + +CheckOptions: + - key: readability-function-cognitive-complexity.Threshold + value: 50 # Relaxed for tests diff --git a/tasks/example_processes_2/tests/.clang-tidy b/tasks/example_processes_2/tests/.clang-tidy new file mode 100644 index 000000000..d1e4c199c --- /dev/null +++ b/tasks/example_processes_2/tests/.clang-tidy @@ -0,0 +1,14 @@ +InheritParentConfig: true + +Checks: > + -modernize-loop-convert, + -cppcoreguidelines-avoid-goto, + -cppcoreguidelines-avoid-non-const-global-variables, + -misc-override-with-different-visibility, + -misc-use-anonymous-namespace, + -modernize-use-std-print, + -modernize-type-traits + +CheckOptions: + - key: readability-function-cognitive-complexity.Threshold + value: 50 # Relaxed for tests diff --git a/tasks/example_processes_3/tests/.clang-tidy b/tasks/example_processes_3/tests/.clang-tidy index ef43b7aa8..d1e4c199c 100644 --- a/tasks/example_processes_3/tests/.clang-tidy +++ b/tasks/example_processes_3/tests/.clang-tidy @@ -4,6 +4,7 @@ Checks: > -modernize-loop-convert, -cppcoreguidelines-avoid-goto, -cppcoreguidelines-avoid-non-const-global-variables, + -misc-override-with-different-visibility, -misc-use-anonymous-namespace, -modernize-use-std-print, -modernize-type-traits diff --git a/tasks/example_threads/tests/.clang-tidy b/tasks/example_threads/tests/.clang-tidy new file mode 100644 index 000000000..d1e4c199c --- /dev/null +++ b/tasks/example_threads/tests/.clang-tidy @@ -0,0 +1,14 @@ +InheritParentConfig: true + +Checks: > + -modernize-loop-convert, + -cppcoreguidelines-avoid-goto, + -cppcoreguidelines-avoid-non-const-global-variables, + -misc-override-with-different-visibility, + -misc-use-anonymous-namespace, + -modernize-use-std-print, + -modernize-type-traits + +CheckOptions: + - key: readability-function-cognitive-complexity.Threshold + value: 50 # Relaxed for tests