Skip to content

Commit 2649b2f

Browse files
committed
fix clang-tidy errors
1 parent 9dabe5b commit 2649b2f

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/helper/color.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,22 +131,22 @@ struct Color {
131131
const auto s = static_cast<FloatType>(color.s);
132132
const auto v = static_cast<FloatType>(color.v);
133133

134-
FloatType chroma = v * s;
134+
const FloatType chroma = v * s;
135135

136136
FloatType hue = h;
137137
if (hue >= static_cast<FloatType>(360.0)) {
138138
hue = static_cast<FloatType>(0.0);
139139
}
140140

141141

142-
FloatType x = chroma
143-
* (static_cast<FloatType>(1.0)
144-
- fabs_constexpr(
145-
fmod_constexpr(hue / static_cast<FloatType>(60.0), static_cast<FloatType>(2.0))
146-
- static_cast<FloatType>(1.0)
147-
));
142+
const FloatType x = chroma
143+
* (static_cast<FloatType>(1.0)
144+
- fabs_constexpr(
145+
fmod_constexpr(hue / static_cast<FloatType>(60.0), static_cast<FloatType>(2.0))
146+
- static_cast<FloatType>(1.0)
147+
));
148148

149-
u64 index = static_cast<u64>(hue / static_cast<FloatType>(60.0));
149+
const u64 index = static_cast<u64>(hue / static_cast<FloatType>(60.0));
150150

151151
FloatType d_r{};
152152
FloatType d_g{};
@@ -188,7 +188,7 @@ struct Color {
188188
}
189189

190190

191-
FloatType m = v - chroma;
191+
const FloatType m = v - chroma;
192192

193193
const auto finish_value = [m](FloatType value) -> u8 {
194194
const auto result =

src/helper/color_literals.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,9 @@ static_assert("rgb(0xAB, 0xCD, 0xEF)"_c == "rgb(171, 205, 239)"_c);
597597
static_assert("hsv(0, 0, 0.79)"_c == "#C9C9C9"_c);
598598

599599

600-
// due to an error in MSVC, the "#FFFFFF"_c literal, can't be constants, so juts using the runtime variant (which has a optional access without check, but the CI detects errors in those strings on other platforms and compilers at compiler time, so that's not that bad)
600+
// due to an error in MSVC, the "#FFFFFF"_c literal, can't be constants, so juts using the runtime variant
601+
// (which has a optional access without check, but the CI detects errors in those strings on other platforms and compilers at compiler time,
602+
// so that's not that bad)
601603
#if defined(_MSC_VER)
602604
#define COLOR_LITERAL(color_string) Color::from_string(color_string).value() //NOLINT(cppcoreguidelines-macro-usage)
603605
#else

tests/core/color.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11

22
#include "helper/color.hpp"
33

4-
5-
#include "gtest/gtest.h"
64
#include <gmock/gmock.h>
75
#include <gtest/gtest.h>
86
#include <string>
@@ -212,7 +210,7 @@ TEST(HSVColor, InvalidConstructors) {
212210
#endif
213211

214212

215-
TEST(ColorConversion, HSV_to_RGB_to_HSV) {
213+
TEST(ColorConversion, HSV_to_RGB_to_HSV) { //NOLINT(readability-function-cognitive-complexity)
216214

217215
#if COLOR_TEST_MODE == 0
218216
const std::vector<HSVColor> colors{
@@ -258,7 +256,7 @@ TEST(ColorConversion, HSV_to_RGB_to_HSV) {
258256
}
259257

260258

261-
TEST(ColorConversion, RGG_to_HSV_to_RGB) {
259+
TEST(ColorConversion, RGG_to_HSV_to_RGB) { //NOLINT(readability-function-cognitive-complexity)
262260

263261
#if COLOR_TEST_MODE == 0
264262
const std::vector<Color> colors{

0 commit comments

Comments
 (0)