Skip to content

Commit cdf6a3f

Browse files
authored
Apply 'misc-override-with-different-visibility' clang-tidy remarks, align .clang-tidy files in the test directories (#764)
1 parent 26bf6f8 commit cdf6a3f

File tree

9 files changed

+75
-8
lines changed

9 files changed

+75
-8
lines changed

.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ Checks: >
3838
-misc-const-correctness,
3939
-misc-non-private-member-variables-in-classes,
4040
-modernize-avoid-c-arrays,
41-
-misc-override-with-different-visibility,
4241
-misc-use-internal-linkage,
4342
-modernize-use-trailing-return-type,
4443
-portability-avoid-pragma-once,

modules/performance/tests/.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Checks: >
44
-modernize-loop-convert,
55
-cppcoreguidelines-avoid-goto,
66
-cppcoreguidelines-avoid-non-const-global-variables,
7+
-misc-override-with-different-visibility,
78
-misc-use-anonymous-namespace,
89
-modernize-use-std-print,
910
-modernize-type-traits

modules/task/tests/.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Checks: >
44
-modernize-loop-convert,
55
-cppcoreguidelines-avoid-goto,
66
-cppcoreguidelines-avoid-non-const-global-variables,
7+
-misc-override-with-different-visibility,
78
-misc-use-anonymous-namespace,
89
-modernize-use-std-print,
910
-modernize-type-traits

modules/task/tests/task_tests.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class TestTask : public ppc::task::Task<InType, OutType> {
4545
this->GetInput() = in;
4646
}
4747

48+
protected:
4849
bool ValidationImpl() override {
4950
return !this->GetInput().empty();
5051
}
@@ -71,6 +72,7 @@ class FakeSlowTask : public TestTask<InType, OutType> {
7172
public:
7273
explicit FakeSlowTask(const InType &in) : TestTask<InType, OutType>(in) {}
7374

75+
protected:
7476
bool RunImpl() override {
7577
std::this_thread::sleep_for(std::chrono::seconds(2));
7678
return TestTask<InType, OutType>::RunImpl();
@@ -233,9 +235,12 @@ TEST(TaskTest, TaskDestructorThrowsIfStageIncomplete) {
233235
{
234236
std::vector<int32_t> in(20, 1);
235237
struct LocalTask : Task<std::vector<int32_t>, int32_t> {
238+
public:
236239
explicit LocalTask(const std::vector<int32_t> &in) {
237240
this->GetInput() = in;
238241
}
242+
243+
protected:
239244
bool ValidationImpl() override {
240245
return true;
241246
}
@@ -259,9 +264,12 @@ TEST(TaskTest, TaskDestructorThrowsIfEmpty) {
259264
{
260265
std::vector<int32_t> in(20, 1);
261266
struct LocalTask : Task<std::vector<int32_t>, int32_t> {
267+
public:
262268
explicit LocalTask(const std::vector<int32_t> &in) {
263269
this->GetInput() = in;
264270
}
271+
272+
protected:
265273
bool ValidationImpl() override {
266274
return true;
267275
}
@@ -285,9 +293,12 @@ TEST(TaskTest, InternalTimeTestThrowsIfTimeoutExceeded) {
285293
GTEST_SKIP() << "Skipped on macOS due to time fluctuations.";
286294
#endif
287295
struct SlowTask : Task<std::vector<int32_t>, int32_t> {
296+
public:
288297
explicit SlowTask(const std::vector<int32_t> &in) {
289298
this->GetInput() = in;
290299
}
300+
301+
protected:
291302
bool ValidationImpl() override {
292303
return true;
293304
}
@@ -315,6 +326,8 @@ TEST(TaskTest, InternalTimeTestThrowsIfTimeoutExceeded) {
315326
class DummyTask : public Task<int, int> {
316327
public:
317328
using Task::Task;
329+
330+
protected:
318331
bool ValidationImpl() override {
319332
return true;
320333
}

modules/util/include/func_test_util.hpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ template <typename InType, typename OutType, typename TestType = void>
3636
/// @tparam TestType Type of the test case or parameter.
3737
class BaseRunFuncTests : public ::testing::TestWithParam<FuncTestParam<InType, OutType, TestType>> {
3838
public:
39-
virtual bool CheckTestOutputData(OutType &output_data) = 0;
40-
/// @brief Provides input data for the task.
41-
/// @return Initialized input data.
42-
virtual InType GetTestInputData() = 0;
43-
4439
template <typename Derived>
4540
static void RequireStaticInterface() {
4641
static_assert(HasPrintTestParam<Derived, TestType>,
@@ -56,6 +51,11 @@ class BaseRunFuncTests : public ::testing::TestWithParam<FuncTestParam<InType, O
5651
}
5752

5853
protected:
54+
virtual bool CheckTestOutputData(OutType &output_data) = 0;
55+
/// @brief Provides input data for the task.
56+
/// @return Initialized input data.
57+
virtual InType GetTestInputData() = 0;
58+
5959
void ExecuteTest(FuncTestParam<InType, OutType, TestType> test_param) {
6060
const std::string &test_name = std::get<static_cast<std::size_t>(GTestParamIndex::kNameTest)>(test_param);
6161

@@ -95,13 +95,23 @@ class BaseRunFuncTests : public ::testing::TestWithParam<FuncTestParam<InType, O
9595
ExecuteTaskPipeline();
9696
}
9797

98-
/// @brief Executes the full task pipeline with validation.
99-
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
10098
void ExecuteTaskPipeline() {
99+
ValidateTask();
100+
RunTask();
101+
CheckTaskOutput();
102+
}
103+
104+
void ValidateTask() {
101105
EXPECT_TRUE(task_->Validation());
102106
EXPECT_TRUE(task_->PreProcessing());
107+
}
108+
109+
void RunTask() {
103110
EXPECT_TRUE(task_->Run());
104111
EXPECT_TRUE(task_->PostProcessing());
112+
}
113+
114+
void CheckTaskOutput() {
105115
EXPECT_TRUE(CheckTestOutputData(task_->GetOutput()));
106116
}
107117

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
InheritParentConfig: true
2+
3+
Checks: >
4+
-modernize-loop-convert,
5+
-cppcoreguidelines-avoid-goto,
6+
-cppcoreguidelines-avoid-non-const-global-variables,
7+
-misc-override-with-different-visibility,
8+
-misc-use-anonymous-namespace,
9+
-modernize-use-std-print,
10+
-modernize-type-traits
11+
12+
CheckOptions:
13+
- key: readability-function-cognitive-complexity.Threshold
14+
value: 50 # Relaxed for tests
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
InheritParentConfig: true
2+
3+
Checks: >
4+
-modernize-loop-convert,
5+
-cppcoreguidelines-avoid-goto,
6+
-cppcoreguidelines-avoid-non-const-global-variables,
7+
-misc-override-with-different-visibility,
8+
-misc-use-anonymous-namespace,
9+
-modernize-use-std-print,
10+
-modernize-type-traits
11+
12+
CheckOptions:
13+
- key: readability-function-cognitive-complexity.Threshold
14+
value: 50 # Relaxed for tests

tasks/example_processes_3/tests/.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Checks: >
44
-modernize-loop-convert,
55
-cppcoreguidelines-avoid-goto,
66
-cppcoreguidelines-avoid-non-const-global-variables,
7+
-misc-override-with-different-visibility,
78
-misc-use-anonymous-namespace,
89
-modernize-use-std-print,
910
-modernize-type-traits
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
InheritParentConfig: true
2+
3+
Checks: >
4+
-modernize-loop-convert,
5+
-cppcoreguidelines-avoid-goto,
6+
-cppcoreguidelines-avoid-non-const-global-variables,
7+
-misc-override-with-different-visibility,
8+
-misc-use-anonymous-namespace,
9+
-modernize-use-std-print,
10+
-modernize-type-traits
11+
12+
CheckOptions:
13+
- key: readability-function-cognitive-complexity.Threshold
14+
value: 50 # Relaxed for tests

0 commit comments

Comments
 (0)