Skip to content

Commit 411424b

Browse files
committed
CI: upgrade clang-tidy
1 parent 5e5c287 commit 411424b

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -480,17 +480,17 @@ jobs:
480480
clang-tidy:
481481
needs: clang
482482
name: Clang-Tidy
483-
runs-on: ubuntu-22.04
483+
runs-on: ubuntu-latest
484484
steps:
485485
- name: Install
486-
run: sudo apt-get install -y clang-tidy cmake ninja-build
486+
run: sudo apt-get install -y clang-tidy libc++-dev libc++abi-dev
487487
- name: Checkout
488488
uses: actions/checkout@v4
489489
- name: Configure
490-
run: cmake -G Ninja -DCMAKE_CXX_CLANG_TIDY="clang-tidy-10;--warnings-as-errors=*" -DCMAKE_BUILD_TYPE=Debug .
490+
run: cmake -G Ninja -DCMAKE_CXX_CLANG_TIDY="clang-tidy;--warnings-as-errors=*" -DCMAKE_BUILD_TYPE=Debug .
491491
env:
492-
CC: clang-10
493-
CXX: clang++-10
492+
CC: clang
493+
CXX: clang++
494494
- name: Check
495495
run: cmake --build . -- -k 0
496496

extras/tests/JsonDocument/assignment.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ TEST_CASE("JsonDocument assignment") {
6969
doc2 = std::move(doc1);
7070

7171
REQUIRE(doc2.as<std::string>() == "{\"hello\":\"world\"}");
72+
73+
// NOLINTNEXTLINE(clang-analyzer-cplusplus.Move)
7274
REQUIRE(doc1.as<std::string>() == "null");
7375
}
7476
REQUIRE(spyingAllocator.log() == AllocatorLog{

extras/tests/JsonDocument/constructor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ TEST_CASE("JsonDocument constructor") {
4444
JsonDocument doc2(std::move(doc1));
4545

4646
REQUIRE(doc2.as<std::string>() == "The size of this string is 32!!");
47+
48+
// NOLINTNEXTLINE(clang-analyzer-cplusplus.Move)
4749
REQUIRE(doc1.as<std::string>() == "null");
4850
}
4951
REQUIRE(spyingAllocator.log() == AllocatorLog{

extras/tests/ResourceManager/StringBuilder.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ TEST_CASE("StringBuilder") {
116116
}
117117
}
118118

119-
static JsonString saveString(StringBuilder& builder, const char* s) {
119+
static VariantData saveString(StringBuilder& builder, const char* s) {
120120
VariantData data;
121121
builder.startString();
122122
builder.append(s);
123123
builder.save(&data);
124-
return data.asString();
124+
return data;
125125
}
126126

127127
TEST_CASE("StringBuilder::save() deduplicates strings") {
@@ -134,9 +134,9 @@ TEST_CASE("StringBuilder::save() deduplicates strings") {
134134
auto s2 = saveString(builder, "world");
135135
auto s3 = saveString(builder, "hello");
136136

137-
REQUIRE(s1 == "hello");
138-
REQUIRE(s2 == "world");
139-
REQUIRE(+s1.c_str() == +s3.c_str()); // same address
137+
REQUIRE(s1.asString() == "hello");
138+
REQUIRE(s2.asString() == "world");
139+
REQUIRE(+s1.asString().c_str() == +s3.asString().c_str()); // same address
140140

141141
REQUIRE(spy.log() ==
142142
AllocatorLog{
@@ -152,9 +152,10 @@ TEST_CASE("StringBuilder::save() deduplicates strings") {
152152
auto s1 = saveString(builder, "hello world");
153153
auto s2 = saveString(builder, "hello");
154154

155-
REQUIRE(s1 == "hello world");
156-
REQUIRE(s2 == "hello");
157-
REQUIRE(+s2.c_str() != +s1.c_str()); // different address
155+
REQUIRE(s1.asString() == "hello world");
156+
REQUIRE(s2.asString() == "hello");
157+
REQUIRE(+s2.asString().c_str() !=
158+
+s1.asString().c_str()); // different address
158159

159160
REQUIRE(spy.log() ==
160161
AllocatorLog{
@@ -169,9 +170,10 @@ TEST_CASE("StringBuilder::save() deduplicates strings") {
169170
auto s1 = saveString(builder, "hello world");
170171
auto s2 = saveString(builder, "worl");
171172

172-
REQUIRE(s1 == "hello world");
173-
REQUIRE(s2 == "worl");
174-
REQUIRE(s2.c_str() != s1.c_str()); // different address
173+
REQUIRE(s1.asString() == "hello world");
174+
REQUIRE(s2.asString() == "worl");
175+
REQUIRE(s2.asString().c_str() !=
176+
s1.asString().c_str()); // different address
175177

176178
REQUIRE(spy.log() ==
177179
AllocatorLog{

0 commit comments

Comments
 (0)