Skip to content

Commit f79c8bb

Browse files
committed
Fix clang-tidy warnings
I cannot figure out why they started popping up after switching to vcpkg. Seems that without vcpkg tests were not actually going through clang-tidy for some reason. Let's fix those then.
1 parent 852f668 commit f79c8bb

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

tests/auto/foundation/linux_platform_event_loop/tst_linux_platform_event_loop.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ TEST_CASE("Register and unregister for events")
4949
SUBCASE("can register a file descriptor for read notifications")
5050
{
5151
LinuxPlatformEventLoop loop;
52-
bool result = loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Read);
52+
const bool result = loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Read);
5353

5454
REQUIRE(result == true);
5555
}
@@ -58,7 +58,7 @@ TEST_CASE("Register and unregister for events")
5858
{
5959
LinuxPlatformEventLoop loop;
6060
loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Read);
61-
bool result = loop.unregisterFileDescriptor(0, FileDescriptorNotifier::NotificationType::Read);
61+
const bool result = loop.unregisterFileDescriptor(0, FileDescriptorNotifier::NotificationType::Read);
6262

6363
REQUIRE(result == true);
6464
}
@@ -68,15 +68,15 @@ TEST_CASE("Register and unregister for events")
6868
LinuxPlatformEventLoop loop;
6969
loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Read);
7070
loop.unregisterFileDescriptor(0, FileDescriptorNotifier::NotificationType::Read);
71-
bool result = loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Read);
71+
const bool result = loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Read);
7272

7373
REQUIRE(result == true);
7474
}
7575

7676
SUBCASE("can register a file descriptor for write notifications")
7777
{
7878
LinuxPlatformEventLoop loop;
79-
bool result = loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Write);
79+
const bool result = loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Write);
8080

8181
REQUIRE(result == true);
8282
}
@@ -85,7 +85,7 @@ TEST_CASE("Register and unregister for events")
8585
{
8686
LinuxPlatformEventLoop loop;
8787
loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Write);
88-
bool result = loop.unregisterFileDescriptor(0, FileDescriptorNotifier::NotificationType::Write);
88+
const bool result = loop.unregisterFileDescriptor(0, FileDescriptorNotifier::NotificationType::Write);
8989

9090
REQUIRE(result == true);
9191
}
@@ -95,15 +95,15 @@ TEST_CASE("Register and unregister for events")
9595
LinuxPlatformEventLoop loop;
9696
loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Write);
9797
loop.unregisterFileDescriptor(0, FileDescriptorNotifier::NotificationType::Write);
98-
bool result = loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Write);
98+
const bool result = loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Write);
9999

100100
REQUIRE(result == true);
101101
}
102102

103103
SUBCASE("can register a file descriptor for exception notifications")
104104
{
105105
LinuxPlatformEventLoop loop;
106-
bool result = loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Exception);
106+
const bool result = loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Exception);
107107

108108
REQUIRE(result == true);
109109
}
@@ -112,7 +112,7 @@ TEST_CASE("Register and unregister for events")
112112
{
113113
LinuxPlatformEventLoop loop;
114114
loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Exception);
115-
bool result = loop.unregisterFileDescriptor(0, FileDescriptorNotifier::NotificationType::Exception);
115+
const bool result = loop.unregisterFileDescriptor(0, FileDescriptorNotifier::NotificationType::Exception);
116116

117117
REQUIRE(result == true);
118118
}
@@ -122,7 +122,7 @@ TEST_CASE("Register and unregister for events")
122122
LinuxPlatformEventLoop loop;
123123
loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Exception);
124124
loop.unregisterFileDescriptor(0, FileDescriptorNotifier::NotificationType::Exception);
125-
bool result = loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Exception);
125+
const bool result = loop.registerFileDescriptor(0, FileDescriptorNotifier::NotificationType::Exception);
126126

127127
REQUIRE(result == true);
128128
}
@@ -131,7 +131,7 @@ TEST_CASE("Register and unregister for events")
131131
{
132132
LinuxPlatformEventLoop loop;
133133
auto notifier = std::make_unique<FileDescriptorNotifier>(0, FileDescriptorNotifier::NotificationType::Read);
134-
bool result = loop.registerNotifier(notifier.get());
134+
const bool result = loop.registerNotifier(notifier.get());
135135

136136
REQUIRE(result == true);
137137
REQUIRE(loop.registeredFileDescriptorCount() == 1);
@@ -142,7 +142,7 @@ TEST_CASE("Register and unregister for events")
142142
LinuxPlatformEventLoop loop;
143143
auto notifier = std::make_unique<FileDescriptorNotifier>(0, FileDescriptorNotifier::NotificationType::Read);
144144
loop.registerNotifier(notifier.get());
145-
bool result = loop.unregisterNotifier(notifier.get());
145+
const bool result = loop.unregisterNotifier(notifier.get());
146146

147147
REQUIRE(result == true);
148148
REQUIRE(loop.registeredFileDescriptorCount() == 0);
@@ -154,7 +154,7 @@ TEST_CASE("Register and unregister for events")
154154
auto notifier = std::make_unique<FileDescriptorNotifier>(0, FileDescriptorNotifier::NotificationType::Read);
155155
loop.registerNotifier(notifier.get());
156156
loop.unregisterNotifier(notifier.get());
157-
bool result = loop.registerNotifier(notifier.get());
157+
const bool result = loop.registerNotifier(notifier.get());
158158

159159
REQUIRE(result == true);
160160
REQUIRE(loop.registeredFileDescriptorCount() == 1);
@@ -179,7 +179,7 @@ TEST_CASE("Register and unregister for events")
179179
SPDLOG_DEBUG("Failed to create pipe. errno = {}", errno);
180180
REQUIRE(false);
181181
}
182-
bool result = loop.registerNotifier(notifier.get());
182+
const bool result = loop.registerNotifier(notifier.get());
183183

184184
REQUIRE(result == true);
185185
REQUIRE(loop.registeredFileDescriptorCount() == 1);

tests/auto/utils/bytearray/tst_bytearray.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ TEST_SUITE("ByteArray")
8282
TEST_CASE("checkCopyCtor")
8383
{
8484
// GIVEN
85-
ByteArray b(4, 2);
86-
ByteArray b2(b);
85+
const ByteArray b(4, 2);
86+
const ByteArray b2(b); // NOLINT(performance-unnecessary-copy-initialization)
8787

8888
// THEN
8989
CHECK(b == b2);
@@ -103,8 +103,8 @@ TEST_SUITE("ByteArray")
103103
TEST_CASE("checkCopyAssigmentOperator")
104104
{
105105
// GIVEN
106-
ByteArray b(4, 2);
107-
ByteArray b2 = b;
106+
const ByteArray b(4, 2);
107+
const ByteArray b2 = b; // NOLINT(performance-unnecessary-copy-initialization)
108108

109109
// THEN
110110
CHECK(b == b2);
@@ -290,13 +290,13 @@ TEST_SUITE("ByteArray")
290290
const ByteArray b("hello");
291291

292292
// WHEN
293-
int64_t iu = b.indexOf('u');
293+
const int64_t iu = b.indexOf('u');
294294

295295
// THEN
296296
CHECK(iu == -1);
297297

298298
// WHEN
299-
int64_t il = b.indexOf('l');
299+
const int64_t il = b.indexOf('l');
300300

301301
// THEN
302302
CHECK(il == 2);

tests/auto/utils/dir/tst_dir.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,14 @@ TEST_SUITE("Dir")
197197
CHECK(!d.exists());
198198

199199
// WHEN
200-
bool wasCreated = d.mkdir();
200+
const bool wasCreated = d.mkdir();
201201

202202
// THEN
203203
CHECK(wasCreated);
204204
CHECK(d.exists());
205205

206206
// WHEN
207-
bool wasRemoved = d.rmdir();
207+
const bool wasRemoved = d.rmdir();
208208

209209
// THEN
210210
CHECK(wasRemoved);

tests/auto/utils/elapsedtimer/tst_elapsedtimer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ TEST_SUITE("ElaspedTimer")
3838

3939
// WHEN
4040
std::this_thread::sleep_for(500ms);
41-
ElapsedTimer::NsecDuration elapsed = t.elapsed();
41+
const ElapsedTimer::NsecDuration elapsed = t.elapsed();
4242

4343
// THEN
4444
CHECK(elapsed >= 500ms);

tests/auto/utils/flags/tst_flags.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ TEST_SUITE("Flags")
9595
{
9696
// GIVEN
9797
const Flags<Enum> a;
98-
Flags<Enum> b(A);
98+
const Flags<Enum> b(A);
9999

100100
// THEN
101101
CHECK(!a);

tests/auto/utils/url/tst_url.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,21 +97,21 @@ TEST_SUITE("Url")
9797
{
9898
{
9999
// GIVEN
100-
KC::Url url = KC::Url::fromLocalFile(StringLiteral("file.txt"));
100+
const KC::Url url = KC::Url::fromLocalFile(StringLiteral("file.txt"));
101101

102102
// THEN
103103
CHECK(url == KC::Url(StringLiteral("file:file.txt")));
104104
}
105105
{
106106
// GIVEN
107-
KC::Url url = KC::Url::fromLocalFile(StringLiteral("/home/bruce_w/file.txt"));
107+
const KC::Url url = KC::Url::fromLocalFile(StringLiteral("/home/bruce_w/file.txt"));
108108

109109
// THEN
110110
CHECK(url == KC::Url(StringLiteral("file:///home/bruce_w/file.txt")));
111111
}
112112
{
113113
// GIVEN
114-
KC::Url url = KC::Url::fromLocalFile(StringLiteral("file:file.txt"));
114+
const KC::Url url = KC::Url::fromLocalFile(StringLiteral("file:file.txt"));
115115

116116
// THEN -> Nothing since url has already a scheme
117117
CHECK(url == KC::Url(StringLiteral("file:file.txt")));

0 commit comments

Comments
 (0)