Skip to content

Commit 49849f4

Browse files
committed
fix: CI
Signed-off-by: Dmitriy Khaustov aka xDimon <[email protected]>
1 parent 616ebd5 commit 49849f4

File tree

6 files changed

+76
-37
lines changed

6 files changed

+76
-37
lines changed

include/soralog/impl/configurator_from_yaml.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ namespace soralog {
231231
const std::optional<std::string> &parent);
232232

233233
/// Reference to the logging system being configured.
234+
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
234235
LoggingSystem &system_;
235236

236237
/// Optional previous configurator applied before parsing YAML.

include/soralog/sink.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ namespace soralog {
103103
events_(max_events, max_message_length) {
104104
// Auto-fix buffer size
105105
if (max_buffer_size_ < max_message_length * 2) {
106-
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast,-warnings-as-errors)
106+
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
107107
const_cast<size_t &>(max_buffer_size_) = max_message_length * 2;
108108
}
109109
}

src/impl/sink_to_console.cpp

+27-13
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ namespace soralog {
5858
V put_style(char *&ptr, T style) {
5959
auto size = std::end(style) - std::begin(style);
6060
std::memcpy(ptr, std::begin(style), size);
61-
ptr += size; // NOLINT
61+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
62+
ptr += size;
6263
return {};
6364
}
6465

@@ -77,7 +78,8 @@ namespace soralog {
7778
const auto &style = reset_color;
7879
auto size = std::end(style) - std::begin(style);
7980
std::memcpy(ptr, std::begin(style), size);
80-
ptr = ptr + size; // NOLINT
81+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
82+
ptr = ptr + size;
8183
}
8284

8385
/**
@@ -87,7 +89,8 @@ namespace soralog {
8789
*/
8890
void put_level_style(char *&ptr, Level level) {
8991
assert(level <= Level::TRACE);
90-
auto color = level_to_color_map[static_cast<size_t>(level)]; // NOLINT
92+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-constant-array-index)
93+
auto color = level_to_color_map[static_cast<size_t>(level)];
9194
put_style(ptr,
9295
fmt::detail::make_foreground_color<char>(color),
9396
fmt::detail::make_emphasis<char>(fmt::emphasis::bold));
@@ -122,7 +125,8 @@ namespace soralog {
122125
*/
123126
void put_separator(char *&ptr) {
124127
for (auto c : separator) {
125-
*ptr++ = c; // NOLINT
128+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
129+
*ptr++ = c;
126130
}
127131
}
128132

@@ -132,12 +136,16 @@ namespace soralog {
132136
* Ensures that the level is padded to a fixed width of 8 characters.
133137
*/
134138
void put_level(char *&ptr, Level level) {
135-
const char *const end = ptr + 8; // NOLINT
139+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
140+
const char *const end = ptr + 8;
136141
const char *str = levelToStr(level);
137-
while (auto c = *str++) { // NOLINT
138-
*ptr++ = c; // Copy characters one by one.
142+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
143+
while (auto c = *str++) {
144+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
145+
*ptr++ = c; // Copy characters one by one.
139146
}
140147
while (ptr < end) {
148+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
141149
*ptr++ = ' '; // Pad with spaces to maintain alignment.
142150
}
143151
}
@@ -146,7 +154,8 @@ namespace soralog {
146154
* @brief Writes a single-character representation of a log level.
147155
*/
148156
void put_level_short(char *&ptr, Level level) {
149-
*ptr++ = levelToChar(level); // NOLINT
157+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
158+
*ptr++ = levelToChar(level);
150159
}
151160

152161
/**
@@ -155,7 +164,8 @@ namespace soralog {
155164
template <typename T>
156165
void put_string(char *&ptr, const T &name) {
157166
for (auto c : name) {
158-
*ptr++ = c; // NOLINT
167+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
168+
*ptr++ = c;
159169
}
160170
}
161171

@@ -173,7 +183,8 @@ namespace soralog {
173183
if (c == '\0' or width == 0) {
174184
break;
175185
}
176-
*ptr++ = c; // NOLINT
186+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
187+
*ptr++ = c;
177188
--width;
178189
}
179190
while (width--) {
@@ -246,7 +257,8 @@ namespace soralog {
246257
}
247258

248259
auto *const begin = buff_.data();
249-
auto *const end = buff_.data() + buff_.size(); // NOLINT
260+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
261+
auto *const end = buff_.data() + buff_.size();
250262
auto *ptr = begin;
251263

252264
decltype(1s / 1s) psec = 0; // Stores previous second timestamp.
@@ -281,15 +293,17 @@ namespace soralog {
281293

282294
// Append timestamp to buffer.
283295
std::memcpy(ptr, datetime.data(), datetime.size());
284-
ptr = ptr + datetime.size(); // NOLINT
296+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
297+
ptr = ptr + datetime.size();
285298

286299
// Apply color if enabled.
287300
if (with_color_) {
288301
const auto &style =
289302
fmt::detail::make_foreground_color<char>(fmt::color::gray);
290303
auto size = std::end(style) - std::begin(style);
291304
std::memcpy(ptr, std::begin(style), size);
292-
ptr = ptr + size; // NOLINT
305+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
306+
ptr = ptr + size;
293307
}
294308

295309
// Append microseconds.

src/impl/sink_to_file.cpp

+23-10
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ namespace soralog {
3131
*/
3232
void put_separator(char *&ptr) {
3333
for (auto c : separator) {
34-
*ptr++ = c; // NOLINT
34+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
35+
*ptr++ = c;
3536
}
3637
}
3738

@@ -43,13 +44,17 @@ namespace soralog {
4344
* @param level The log level to be written.
4445
*/
4546
void put_level(char *&ptr, Level level) {
46-
const char *const end = ptr + 8; // NOLINT - Ensuring fixed width
47+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
48+
const char *const end = ptr + 8; // Ensuring fixed width
4749
const char *str = levelToStr(level);
48-
while (auto c = *str++) { // NOLINT
49-
*ptr++ = c; // NOLINT
50+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
51+
while (auto c = *str++) {
52+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
53+
*ptr++ = c;
5054
}
5155
while (ptr < end) { // Pad with spaces to maintain alignment
52-
*ptr++ = ' '; // NOLINT
56+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
57+
*ptr++ = ' ';
5358
}
5459
}
5560

@@ -60,7 +65,8 @@ namespace soralog {
6065
* @param level The log level to be written.
6166
*/
6267
void put_level_short(char *&ptr, Level level) {
63-
*ptr++ = levelToChar(level); // NOLINT
68+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
69+
*ptr++ = levelToChar(level);
6470
}
6571

6672
/**
@@ -73,7 +79,8 @@ namespace soralog {
7379
template <typename T>
7480
void put_string(char *&ptr, const T &name) {
7581
for (auto c : name) {
76-
*ptr++ = c; // NOLINT
82+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
83+
*ptr++ = c;
7784
}
7885
}
7986

@@ -97,11 +104,14 @@ namespace soralog {
97104
if (c == '\0' or width == 0) {
98105
break;
99106
}
100-
*ptr++ = c; // NOLINT
101-
--width;
107+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
108+
*ptr++ = c;
109+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
110+
-width;
102111
}
103112
while (width--) { // Pad remaining space with spaces
104-
*ptr++ = ' '; // NOLINT
113+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
114+
*ptr++ = ' ';
105115
}
106116
}
107117

@@ -175,6 +185,7 @@ namespace soralog {
175185
// Pointer to the begin of the buffer
176186
auto *const begin = buff_.data();
177187
// Pointer to the end of the buffer
188+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
178189
auto *const end = buff_.data() + buff_.size();
179190
auto *ptr = begin;
180191

@@ -212,6 +223,7 @@ namespace soralog {
212223

213224
// Write timestamp
214225
std::memcpy(ptr, datetime.data(), datetime.size());
226+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
215227
ptr = ptr + datetime.size();
216228
ptr = fmt::format_to_n(ptr, end - ptr, ".{:0>6}", usec).out;
217229
put_separator(ptr);
@@ -244,6 +256,7 @@ namespace soralog {
244256

245257
// Write log message
246258
put_string(ptr, event.message());
259+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
247260
*ptr++ = '\n';
248261

249262
size_ -= event.message().size(); // Adjust buffer size

src/impl/sink_to_syslog.cpp

+22-11
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,35 @@ namespace soralog {
2828
// Appends the separator sequence to the buffer
2929
void put_separator(char *&ptr) {
3030
for (auto c : separator) {
31-
*ptr++ = c; // NOLINT
31+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
32+
*ptr++ = c;
3233
}
3334
}
3435

3536
// Writes the log level string representation to the buffer
3637
void put_level(char *&ptr, Level level) {
37-
const char *const end = ptr + 8; // NOLINT
38+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
39+
const char *const end = ptr + 8;
3840
const char *str = levelToStr(level);
39-
while (auto c = *str++) { // NOLINT
40-
*ptr++ = c; // NOLINT
41+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
42+
while (auto c = *str++) {
43+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
44+
*ptr++ = c;
4145
}
4246
}
4347

4448
// Writes the short log level character representation to the buffer
4549
void put_level_short(char *&ptr, Level level) {
46-
*ptr++ = levelToChar(level); // NOLINT
50+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
51+
*ptr++ = levelToChar(level);
4752
}
4853

4954
// Writes a string to the buffer
5055
template <typename T>
5156
void put_string(char *&ptr, const T &name) {
5257
for (auto c : name) {
53-
*ptr++ = c; // NOLINT
58+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
59+
*ptr++ = c;
5460
}
5561
}
5662

@@ -64,11 +70,13 @@ namespace soralog {
6470
if (c == '\0' or width == 0) {
6571
break;
6672
}
67-
*ptr++ = c; // NOLINT
73+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
74+
*ptr++ = c;
6875
--width;
6976
}
7077
while (width--) {
71-
*ptr++ = ' '; // NOLINT
78+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
79+
*ptr++ = ' ';
7280
}
7381
}
7482

@@ -144,7 +152,8 @@ namespace soralog {
144152
}
145153

146154
auto *const begin = buff_.data();
147-
auto *const end = buff_.data() + buff_.size(); // NOLINT
155+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
156+
auto *const end = buff_.data() + buff_.size();
148157
auto *ptr = begin;
149158

150159
decltype(1s / 1s) psec = 0;
@@ -178,7 +187,8 @@ namespace soralog {
178187

179188
// Write timestamp
180189
std::memcpy(ptr, datetime.data(), datetime.size());
181-
ptr = ptr + datetime.size(); // NOLINT
190+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
191+
ptr = ptr + datetime.size();
182192
ptr = fmt::format_to_n(ptr, end - ptr, ".{:0>6}", usec).out;
183193
put_separator(ptr);
184194

@@ -210,7 +220,8 @@ namespace soralog {
210220

211221
// Write log message
212222
put_string(ptr, event.message());
213-
*ptr++ = '\0'; // NOLINT
223+
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
224+
*ptr++ = '\0';
214225

215226
// Determine syslog priority based on log level
216227
bool must_log = true;

src/logging_system.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ using std::literals::string_literals::operator""s;
2020

2121
namespace soralog {
2222

23-
LoggingSystem::LoggingSystem() {
23+
LoggingSystem::LoggingSystem() : is_configured_(true) {
2424
// Create a fallback sink that discards all logs
2525
makeSink<SinkToNowhere>("*");
2626
makeGroup("*", {}, "*", Level::OFF);
27-
is_configured_ = true;
27+
;
2828
}
2929

3030
LoggingSystem::LoggingSystem(std::shared_ptr<Configurator> configurator)

0 commit comments

Comments
 (0)