Skip to content

Commit 889fef8

Browse files
author
xwei19
committed
Fix lint
1 parent 8c1ecd8 commit 889fef8

File tree

5 files changed

+16
-24
lines changed

5 files changed

+16
-24
lines changed

lint-requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Lock to v19.x until we can upgrade our code to fix new v20 issues.
21
clang-format>=20.1.0
3-
# Lock to v19.x until we can upgrade our code to fix new v20 issues.
42
clang-tidy>=19.1.0
53
colorama>=0.4.6
64
gersemi>=0.16.2

src/ystdlib/containers/test/test_Array.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,36 +75,36 @@ void test_list_initialization_in_function_call(
7575

7676
namespace ystdlib::containers::test {
7777
TEST_CASE("test_array_empty", "[containers][Array]") {
78-
Array<int> arr(0);
78+
Array<size_t> arr(0);
7979
REQUIRE(arr.empty());
8080
// NOLINTNEXTLINE(readability-container-size-empty)
8181
REQUIRE((0 == arr.size()));
8282
REQUIRE((arr.begin() == arr.end()));
8383
}
8484

8585
TEST_CASE("test_array_reference", "[containers][Array]") {
86-
Array<int> arr(cBufferSize);
87-
for (int idx{0}; idx < cBufferSize; ++idx) {
86+
Array<size_t> arr(cBufferSize);
87+
for (size_t idx{0}; idx < cBufferSize; ++idx) {
8888
arr.at(idx) = idx;
8989
}
9090
auto const& arr_const_ref = arr;
9191
REQUIRE(std::ranges::equal(arr, arr_const_ref));
9292
}
9393

9494
TEST_CASE("test_array_ranged_copy", "[containers][Array]") {
95-
std::vector<int> vec;
96-
for (int idx{0}; idx < cBufferSize; ++idx) {
95+
std::vector<size_t> vec;
96+
for (size_t idx{0}; idx < cBufferSize; ++idx) {
9797
vec.push_back(idx);
9898
}
99-
Array<int> arr(cBufferSize);
99+
Array<size_t> arr(cBufferSize);
100100
std::ranges::copy(vec, arr.begin());
101101
REQUIRE(std::ranges::equal(vec, arr));
102102
}
103103

104104
TEST_CASE("test_array_movable", "[containers][Array]") {
105-
Array<int> arr(cBufferSize);
106-
Array<int> reference_array(cBufferSize);
107-
for (int idx{0}; idx < cBufferSize; ++idx) {
105+
Array<size_t> arr(cBufferSize);
106+
Array<size_t> reference_array(cBufferSize);
107+
for (size_t idx{0}; idx < cBufferSize; ++idx) {
108108
arr.at(idx) = idx;
109109
reference_array.at(idx) = idx;
110110
}
@@ -113,7 +113,7 @@ TEST_CASE("test_array_movable", "[containers][Array]") {
113113
}
114114

115115
TEST_CASE("test_array_illegal_access", "[containers][Array]") {
116-
Array<int> arr(cBufferSize);
116+
Array<size_t> arr(cBufferSize);
117117
REQUIRE_THROWS_AS(arr.at(-1), std::out_of_range);
118118
REQUIRE_THROWS_AS(arr.at(cBufferSize), std::out_of_range);
119119
}

src/ystdlib/error_handling/test/test_Result.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ TEST_CASE("test_result_unique_ptr", "[error_handling][Result]") {
106106

107107
auto const result_has_error{cUniquePtrFunc(true)};
108108
REQUIRE(result_has_error.has_error());
109-
REQUIRE(AlwaysSuccessErrorCode{AlwaysSuccessErrorCodeEnum::Success} == result_has_error.error()
110-
);
109+
REQUIRE(AlwaysSuccessErrorCode{AlwaysSuccessErrorCodeEnum::Success}
110+
== result_has_error.error());
111111
}
112112

113113
TEST_CASE("test_result_unique_ptr_in_main", "[error_handling][Result]") {

src/ystdlib/wrapped_facade_headers/test/test_sys_types.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
#include <catch2/catch_test_macros.hpp>
44

55
namespace ystdlib::wrapped_facade_headers::test {
6-
7-
namespace {
86
TEST_CASE("test_sys_types_u_char", "[wrapped_facade_headers][sys_types][u_char]") {
97
u_char const i{0};
108
REQUIRE(0 == i);
@@ -165,6 +163,4 @@ TEST_CASE("test_sys_types_fsfilcnt_t", "[wrapped_facade_headers][sys_types][fsfi
165163
fsfilcnt_t const i{0};
166164
REQUIRE(0 == i);
167165
}
168-
}
169-
170166
} // namespace ystdlib::wrapped_facade_headers::test

taskfiles/lint-cpp.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ tasks:
5353
aliases:
5454
- "cpp-static-fix"
5555
desc: "Runs the C++ static analyzers. Only checks for warnings and violations."
56-
sources: &cpp_format_src_files
56+
sources: &cpp_static_src_files
5757
- "{{.G_CMAKE_CACHE}}"
5858
- "{{.G_COMPILE_COMMANDS_DB}}"
5959
- "{{.G_LINT_VENV_CHECKSUM_FILE}}"
@@ -69,12 +69,10 @@ tasks:
6969
vars:
7070
FLAGS:
7171
- "--config-file '{{.ROOT_DIR}}/.clang-tidy'"
72-
- "-p '{{.G_SPIDER_COMPILE_COMMANDS_DB}}'"
73-
INCLUDE_PATTERNS:
74-
- "{{.G_SRC_SPIDER_DIR}}/**"
75-
- "{{.G_TEST_DIR}}/**"
72+
- "-p '{{.G_COMPILE_COMMANDS_DB}}'"
73+
INCLUDE_PATTERNS: ["*.cpp", "*.h", "*.hpp", "*.inc"]
7674
OUTPUT_DIR: "{{.G_LINT_CLANG_TIDY_DIR}}"
77-
ROOT_PATHS: *cpp_format_src_files
75+
ROOT_PATHS: *cpp_static_src_files
7876
VENV_DIR: "{{.G_LINT_VENV_DIR}}"
7977

8078
cpp-configs:

0 commit comments

Comments
 (0)