88#include < string>
99
1010
11- namespace {
11+ namespace { // NOLINT(cert-dcl59-cpp,google-build-namespaces)
12+
1213 namespace const_constants {
1314
1415 // offsets in C strings for hex rgb and rgba
@@ -22,26 +23,26 @@ namespace {
2223 } // namespace const_constants
2324
2425 // decode a decimal number
25- [[nodiscard]] constexpr const_utils::expected<u8 , std::string> single_decimal_number (char n ) {
26- if (n >= ' 0' && n <= ' 9' ) {
27- return const_utils::expected<u8 , std::string>::good_result (static_cast <u8 >(n - ' 0' ));
26+ [[nodiscard]] constexpr const_utils::expected<u8 , std::string> single_decimal_number (char input ) {
27+ if (input >= ' 0' && input <= ' 9' ) {
28+ return const_utils::expected<u8 , std::string>::good_result (static_cast <u8 >(input - ' 0' ));
2829 }
2930
3031 return const_utils::expected<u8 , std::string>::error_result (" the input must be a valid decimal character" );
3132 }
3233
3334 // decode a single_hex_number
34- [[nodiscard]] constexpr const_utils::expected<u8 , std::string> single_hex_number (char n ) {
35- if (n >= ' 0' && n <= ' 9' ) {
36- return const_utils::expected<u8 , std::string>::good_result (static_cast <u8 >(n - ' 0' ));
35+ [[nodiscard]] constexpr const_utils::expected<u8 , std::string> single_hex_number (char input ) {
36+ if (input >= ' 0' && input <= ' 9' ) {
37+ return const_utils::expected<u8 , std::string>::good_result (static_cast <u8 >(input - ' 0' ));
3738 }
3839
39- if (n >= ' A' && n <= ' F' ) {
40- return const_utils::expected<u8 , std::string>::good_result (static_cast <u8 >(n - ' A' + 10 ));
40+ if (input >= ' A' && input <= ' F' ) {
41+ return const_utils::expected<u8 , std::string>::good_result (static_cast <u8 >(input - ' A' + 10 ));
4142 }
4243
43- if (n >= ' a' && n <= ' f' ) {
44- return const_utils::expected<u8 , std::string>::good_result (static_cast <u8 >(n - ' a' + 10 ));
44+ if (input >= ' a' && input <= ' f' ) {
45+ return const_utils::expected<u8 , std::string>::good_result (static_cast <u8 >(input - ' a' + 10 ));
4546 }
4647
4748 return const_utils::expected<u8 , std::string>::error_result (" the input must be a valid hex character" );
@@ -204,37 +205,37 @@ namespace {
204205
205206 if (size == const_constants::hex_rgb_size) {
206207
207- const auto r = single_hex_color_value (input + const_constants::red_offset);
208- PROPAGATE (r , ColorFromHexStringReturnType, std::string);
208+ const auto red = single_hex_color_value (input + const_constants::red_offset);
209+ PROPAGATE (red , ColorFromHexStringReturnType, std::string);
209210
210- const auto g = single_hex_color_value (input + const_constants::green_offset);
211- PROPAGATE (g , ColorFromHexStringReturnType, std::string);
211+ const auto green = single_hex_color_value (input + const_constants::green_offset);
212+ PROPAGATE (green , ColorFromHexStringReturnType, std::string);
212213
213- const auto b = single_hex_color_value (input + const_constants::blue_offset);
214- PROPAGATE (b , ColorFromHexStringReturnType, std::string);
214+ const auto blue = single_hex_color_value (input + const_constants::blue_offset);
215+ PROPAGATE (blue , ColorFromHexStringReturnType, std::string);
215216
216217 return const_utils::expected<ColorFromHexStringReturnType, std::string>::good_result ({
217- Color{ r .value (), g .value (), b .value () },
218+ Color{ red .value (), green .value (), blue .value () },
218219 false
219220 });
220221 }
221222
222223 if (size == const_constants::hex_rgba_size) {
223224
224- const auto r = single_hex_color_value (input + const_constants::red_offset);
225- PROPAGATE (r , ColorFromHexStringReturnType, std::string);
225+ const auto red = single_hex_color_value (input + const_constants::red_offset);
226+ PROPAGATE (red , ColorFromHexStringReturnType, std::string);
226227
227- const auto g = single_hex_color_value (input + const_constants::green_offset);
228- PROPAGATE (g , ColorFromHexStringReturnType, std::string);
228+ const auto green = single_hex_color_value (input + const_constants::green_offset);
229+ PROPAGATE (green , ColorFromHexStringReturnType, std::string);
229230
230- const auto b = single_hex_color_value (input + const_constants::blue_offset);
231- PROPAGATE (b , ColorFromHexStringReturnType, std::string);
231+ const auto blue = single_hex_color_value (input + const_constants::blue_offset);
232+ PROPAGATE (blue , ColorFromHexStringReturnType, std::string);
232233
233- const auto a = single_hex_color_value (input + const_constants::alpha_offset);
234- PROPAGATE (a , ColorFromHexStringReturnType, std::string);
234+ const auto alpha = single_hex_color_value (input + const_constants::alpha_offset);
235+ PROPAGATE (alpha , ColorFromHexStringReturnType, std::string);
235236
236237 return const_utils::expected<ColorFromHexStringReturnType, std::string>::good_result ({
237- Color{ r .value (), g .value (), b .value (), a .value () },
238+ Color{ red .value (), green .value (), blue .value (), alpha .value () },
238239 true
239240 });
240241 }
@@ -247,7 +248,10 @@ namespace {
247248 using ColorFromRGBStringReturnType = std::pair<Color, bool >;
248249
249250 [[nodiscard]] constexpr const_utils::expected<ColorFromRGBStringReturnType, std::string>
250- get_color_from_rgb_string (const char * input, std::size_t ) {
251+ get_color_from_rgb_string ( // NOLINT(readability-function-cognitive-complexity)
252+ const char * input,
253+ std::size_t /* unused*/
254+ ) {
251255
252256 if (input[0 ] == ' r' && input[1 ] == ' g' && input[2 ] == ' b' ) {
253257 if (input[3 ] == ' (' ) {
@@ -415,7 +419,10 @@ namespace {
415419 using ColorFromHSVStringReturnType = std::pair<HSVColor, bool >;
416420
417421 [[nodiscard]] constexpr const_utils::expected<ColorFromHSVStringReturnType, std::string>
418- get_color_from_hsv_string (const char * input, std::size_t ) {
422+ get_color_from_hsv_string ( // NOLINT(readability-function-cognitive-complexity)
423+ const char * input,
424+ std::size_t /* unused*/
425+ ) {
419426
420427 if (input[0 ] == ' h' && input[1 ] == ' s' && input[2 ] == ' v' ) {
421428 if (input[3 ] == ' (' ) {
0 commit comments