[ci] Add lint check to prevent powf in core and base entity platforms

Add a ci-custom.py check that prevents powf() from being introduced
into esphome/core/ and base entity platform components (sensor, light,
climate, etc.). These files are linked into every build, and powf
pulls in __ieee754_powf (~2.3KB flash).

Existing legitimate uses of powf with non-integer exponents (gamma
correction in helpers.cpp) are excluded. New uses can opt out with
// NOLINT if truly necessary.
This commit is contained in:
J. Nick Koston
2026-02-19 15:56:19 -06:00
parent 6a8844e2fc
commit eb83c85a08
3 changed files with 51 additions and 3 deletions
+2 -2
View File
@@ -714,7 +714,7 @@ float gamma_correct(float value, float gamma) {
if (gamma <= 0.0f)
return value;
return powf(value, gamma);
return powf(value, gamma); // NOLINT - deprecated, removal 2026.9.0
}
float gamma_uncorrect(float value, float gamma) {
if (value <= 0.0f)
@@ -722,7 +722,7 @@ float gamma_uncorrect(float value, float gamma) {
if (gamma <= 0.0f)
return value;
return powf(value, 1 / gamma);
return powf(value, 1 / gamma); // NOLINT - deprecated, removal 2026.9.0
}
void rgb_to_hsv(float red, float green, float blue, int &hue, float &saturation, float &value) {