Skip to content

Commit cf4e310

Browse files
committed
Remove NOLINTs
1 parent 90e6014 commit cf4e310

24 files changed

Lines changed: 80 additions & 52 deletions

File tree

.clang-tidy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Checks: >
2626
-modernize-avoid-c-arrays,
2727
-modernize-loop-convert,
2828
-modernize-use-trailing-return-type,
29+
-portability-template-virtual-member-function,
2930
-readability-magic-numbers
3031
3132
WarningsAsErrors: "*"
@@ -81,7 +82,7 @@ CheckOptions:
8182
value: 1
8283
# Functions with scores beyond 15 are typically flagged as potentially problematic (empirically)
8384
- key: readability-function-cognitive-complexity.Threshold
84-
value: 20 # default: 25
85+
value: 15 # default: 25
8586
- key: readability-identifier-length.MinimumVariableNameLength
8687
value: 1
8788
- key: readability-identifier-length.MinimumParameterNameLength
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
InheritParentConfig: true
2+
3+
Checks: >
4+
-cppcoreguidelines-avoid-goto,
5+
-cppcoreguidelines-avoid-non-const-global-variables,
6+
-misc-use-anonymous-namespace,
7+
-modernize-use-std-print,
8+
-modernize-type-traits,
9+
10+
CheckOptions:
11+
- key: readability-function-cognitive-complexity.Threshold
12+
value: 50 # default: 25

modules/core/performance/tests/perf_tests.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ TEST(perf_tests, check_perf_pipeline_uint8_t_slow_test) {
6363
};
6464
perf_analyzer.PipelineRun(perf_attr);
6565

66-
ASSERT_ANY_THROW_NOLINT(perf_analyzer.PrintPerfStatistic("check_perf_pipeline_uint8_t_slow_test"));
66+
ASSERT_ANY_THROW(perf_analyzer.PrintPerfStatistic("check_perf_pipeline_uint8_t_slow_test"));
6767
}
6868

6969
TEST(perf_tests, check_perf_task_exception) {
@@ -73,7 +73,7 @@ TEST(perf_tests, check_perf_task_exception) {
7373

7474
ppc::core::Perf<std::vector<uint32_t>, uint32_t> perf_analyzer(test_task);
7575

76-
ASSERT_ANY_THROW_NOLINT(perf_analyzer.PrintPerfStatistic("check_perf_task_exception"));
76+
ASSERT_ANY_THROW(perf_analyzer.PrintPerfStatistic("check_perf_task_exception"));
7777

7878
ppc::core::PerfAttr perf_attr;
7979
perf_analyzer.TaskRun(perf_attr);
@@ -109,7 +109,7 @@ TEST_P(GetStringParamNameParamTest, ReturnsExpectedString) {
109109
EXPECT_EQ(ppc::core::GetStringParamName(param.input), param.expected_output);
110110
}
111111

112-
INSTANTIATE_TEST_SUITE_P_WITH_NAME(
112+
INSTANTIATE_TEST_SUITE_P(
113113
ParamTests, GetStringParamNameParamTest,
114114
::testing::Values(ParamTestCase{ppc::core::PerfResults::kTaskRun, "task_run"},
115115
ParamTestCase{ppc::core::PerfResults::kPipeline, "pipeline"},
@@ -151,22 +151,22 @@ TEST_P(GetStringTaskTypeTest, ReturnsExpectedString) {
151151
EXPECT_EQ(GetStringTaskType(param.type, temp_path), param.expected) << "Failed on: " << param.label;
152152
}
153153

154-
INSTANTIATE_TEST_SUITE_P_NOLINT(AllTypeCases, GetStringTaskTypeTest,
154+
INSTANTIATE_TEST_SUITE_P(AllTypeCases, GetStringTaskTypeTest,
155155
::testing::Values(TaskTypeTestCase{ppc::core::TypeOfTask::kALL, "all_ALL", "kALL"},
156156
TaskTypeTestCase{ppc::core::TypeOfTask::kSTL, "stl_STL", "kSTL"},
157157
TaskTypeTestCase{ppc::core::TypeOfTask::kOMP, "omp_OMP", "kOMP"},
158158
TaskTypeTestCase{ppc::core::TypeOfTask::kMPI, "mpi_MPI", "kMPI"},
159159
TaskTypeTestCase{ppc::core::TypeOfTask::kTBB, "tbb_TBB", "kTBB"},
160160
TaskTypeTestCase{ppc::core::TypeOfTask::kSEQ, "seq_SEQ", "kSEQ"}));
161161

162-
TEST_NOLINT(GetStringTaskTypeStandaloneTest, ThrowsIfFileMissing) {
162+
TEST(GetStringTaskTypeStandaloneTest, ThrowsIfFileMissing) {
163163
std::string missing_path = "non_existent_settings.json";
164-
EXPECT_THROW_NOLINT(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, missing_path), std::runtime_error);
164+
EXPECT_THROW(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, missing_path), std::runtime_error);
165165
}
166166

167-
TEST_NOLINT(GetStringTaskTypeStandaloneTest, ExceptionMessageContainsPath) {
167+
TEST(GetStringTaskTypeStandaloneTest, ExceptionMessageContainsPath) {
168168
const std::string missing_path = "non_existent_settings.json";
169-
EXPECT_THROW_NOLINT(
169+
EXPECT_THROW(
170170
try { GetStringTaskType(ppc::core::TypeOfTask::kSEQ, missing_path); } catch (const std::runtime_error& e) {
171171
EXPECT_NE(std::string(e.what()).find(missing_path), std::string::npos);
172172
throw;
@@ -184,23 +184,23 @@ TEST(GetStringTaskTypeStandaloneTest, ReturnsUnknownForInvalidEnum) {
184184
std::filesystem::remove(path);
185185
}
186186

187-
TEST_NOLINT(GetStringTaskTypeEdgeCases, ThrowsIfFileCannotBeOpened) {
188-
EXPECT_THROW_NOLINT(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, "definitely_missing_file.json"),
187+
TEST(GetStringTaskTypeEdgeCases, ThrowsIfFileCannotBeOpened) {
188+
EXPECT_THROW(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, "definitely_missing_file.json"),
189189
std::runtime_error);
190190
}
191191

192-
TEST_NOLINT(GetStringTaskTypeEdgeCases, ThrowsIfJsonIsMalformed) {
192+
TEST(GetStringTaskTypeEdgeCases, ThrowsIfJsonIsMalformed) {
193193
std::string path = (std::filesystem::temp_directory_path() / "bad_json.json").string();
194194
std::ofstream(path) << "{ this is not valid json ";
195-
EXPECT_THROW_NOLINT(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, path), NlohmannJsonParseError);
195+
EXPECT_THROW(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, path), NlohmannJsonParseError);
196196
std::filesystem::remove(path);
197197
}
198198

199-
TEST_NOLINT(GetStringTaskTypeEdgeCases, ThrowsIfJsonValueIsNull) {
199+
TEST(GetStringTaskTypeEdgeCases, ThrowsIfJsonValueIsNull) {
200200
std::string path = (std::filesystem::temp_directory_path() / "null_value.json").string();
201201
std::ofstream(path) << R"({"tasks": { "seq": null }})";
202202

203-
EXPECT_THROW_NOLINT(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, path), NlohmannJsonTypeError);
203+
EXPECT_THROW(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, path), NlohmannJsonTypeError);
204204

205205
std::filesystem::remove(path);
206206
}
@@ -237,9 +237,9 @@ TEST(TaskTest, GetDynamicTypeReturnsCorrectEnum) {
237237
EXPECT_EQ(task.GetDynamicTypeOfTask(), ppc::core::TypeOfTask::kOMP);
238238
}
239239

240-
TEST_NOLINT(TaskTest, DestructorTerminatesIfWrongOrder) {
240+
TEST(TaskTest, DestructorTerminatesIfWrongOrder) {
241241
testing::FLAGS_gtest_death_test_style = "threadsafe";
242-
ASSERT_DEATH_IF_SUPPORTED_NOLINT(
242+
ASSERT_DEATH_IF_SUPPORTED(
243243
{
244244
DummyTask task;
245245
task.Run();
@@ -262,7 +262,7 @@ using TestTypes = ::testing::Types<my::nested::Type, my::Another, int>;
262262

263263
TYPED_TEST_SUITE(GetNamespaceTest, TestTypes);
264264

265-
TYPED_TEST_NOLINT(GetNamespaceTest, ExtractsNamespaceCorrectly) {
265+
TYPED_TEST(GetNamespaceTest, ExtractsNamespaceCorrectly) {
266266
constexpr std::string_view kNs = ppc::util::GetNamespace<TypeParam>();
267267

268268
if constexpr (std::is_same_v<TypeParam, my::nested::Type>) {

modules/core/runners/src/runners.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
#include <gtest/gtest.h>
44
#include <mpi.h>
5-
#include <omp.h>
65

7-
#include <cstdio>
86
#include <cstdlib>
97
#include <format>
108
#include <iostream>

modules/core/task/include/task.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <sstream>
1515
#include <stdexcept>
1616
#include <string>
17+
#include <vector>
1718

1819
namespace ppc::core {
1920

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

modules/core/task/tests/task_tests.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <vector>
66

77
#include "core/task/tests/test_task.hpp"
8-
#include "core/util/include/util.hpp"
98

109
TEST(task_tests, check_int32_t) {
1110
// Create data
@@ -128,7 +127,7 @@ TEST(task_tests, check_float) {
128127
EXPECT_NEAR(test_task.GetOutput(), in.size(), 1e-3);
129128
}
130129

131-
TEST_NOLINT(task_tests, check_wrong_order_disabled_valgrind) {
130+
TEST(task_tests, check_wrong_order_disabled_valgrind) {
132131
auto destroy_function = [] {
133132
// Create data
134133
std::vector<float> in(20, 1);
@@ -143,7 +142,7 @@ TEST_NOLINT(task_tests, check_wrong_order_disabled_valgrind) {
143142
EXPECT_DEATH_IF_SUPPORTED(destroy_function(), ".*ORDER OF FUNCTIONS IS NOT RIGHT.*");
144143
}
145144

146-
TEST_NOLINT(task_tests, check_empty_order_disabled_valgrind) {
145+
TEST(task_tests, check_empty_order_disabled_valgrind) {
147146
auto destroy_function = [] {
148147
// Create data
149148
std::vector<float> in(20, 1);

modules/core/task/tests/test_task.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include <chrono>
44
#include <thread>
5-
#include <vector>
65

76
#include "core/task/include/task.hpp"
87

modules/core/util/include/func_test_util.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22

33
#include <gtest/gtest.h>
4-
#include <omp.h>
54
#include <tbb/tick_count.h>
65

76
#include <concepts>

modules/core/util/include/perf_test_util.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ auto MakePerfTaskTuples(const std::string& settings_path) {
115115
}
116116

117117
template <typename Tuple, std::size_t... I>
118-
auto TupleToGTestValuesImpl(Tuple&& tup, std::index_sequence<I...> /*unused*/) {
119-
return ::testing::Values(std::get<I>(std::forward<Tuple>(tup))...);
118+
auto TupleToGTestValuesImpl(const Tuple& tup, std::index_sequence<I...> /*unused*/) {
119+
return ::testing::Values(std::get<I>(tup)...);
120120
}
121121

122122
template <typename Tuple>

0 commit comments

Comments
 (0)