Skip to content

Commit

Permalink
Set "CONF_" CI counter to fail on 3 or more definitions (#6668)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesserockz committed May 5, 2024
1 parent c7c0d97 commit ccbf514
Show file tree
Hide file tree
Showing 55 changed files with 95 additions and 81 deletions.
2 changes: 1 addition & 1 deletion esphome/components/ade7880/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
CONF_RESET_PIN,
CONF_REVERSE_ACTIVE_ENERGY,
CONF_VOLTAGE,
CONF_VOLTAGE_GAIN,
DEVICE_CLASS_APPARENT_POWER,
DEVICE_CLASS_CURRENT,
DEVICE_CLASS_ENERGY,
Expand Down Expand Up @@ -47,7 +48,6 @@
CONF_IRQ0_PIN = "irq0_pin"
CONF_IRQ1_PIN = "irq1_pin"
CONF_POWER_GAIN = "power_gain"
CONF_VOLTAGE_GAIN = "voltage_gain"

CONF_NEUTRAL = "neutral"

Expand Down
2 changes: 1 addition & 1 deletion esphome/components/ade7953_base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
CONF_IRQ_PIN,
CONF_VOLTAGE,
CONF_FREQUENCY,
CONF_VOLTAGE_GAIN,
DEVICE_CLASS_CURRENT,
DEVICE_CLASS_APPARENT_POWER,
DEVICE_CLASS_POWER,
Expand Down Expand Up @@ -36,7 +37,6 @@
CONF_VOLTAGE_PGA_GAIN = "voltage_pga_gain"
CONF_CURRENT_PGA_GAIN_A = "current_pga_gain_a"
CONF_CURRENT_PGA_GAIN_B = "current_pga_gain_b"
CONF_VOLTAGE_GAIN = "voltage_gain"
CONF_CURRENT_GAIN_A = "current_gain_a"
CONF_CURRENT_GAIN_B = "current_gain_b"
CONF_ACTIVE_POWER_GAIN_A = "active_power_gain_a"
Expand Down
1 change: 0 additions & 1 deletion esphome/components/at581x/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


CONF_SENSING_DISTANCE = "sensing_distance"
CONF_SENSITIVITY = "sensitivity"
CONF_POWERON_SELFCHECK_TIME = "poweron_selfcheck_time"
CONF_PROTECT_TIME = "protect_time"
CONF_TRIGGER_BASE = "trigger_base"
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/bl0940/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
CONF_ENERGY,
CONF_EXTERNAL_TEMPERATURE,
CONF_ID,
CONF_INTERNAL_TEMPERATURE,
CONF_POWER,
CONF_VOLTAGE,
DEVICE_CLASS_CURRENT,
Expand All @@ -24,7 +25,6 @@

DEPENDENCIES = ["uart"]

CONF_INTERNAL_TEMPERATURE = "internal_temperature"

bl0940_ns = cg.esphome_ns.namespace("bl0940")
BL0940 = bl0940_ns.class_("BL0940", cg.PollingComponent, uart.UARTDevice)
Expand Down
3 changes: 1 addition & 2 deletions esphome/components/bme680_bsec/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import i2c, esp32
from esphome.const import CONF_ID
from esphome.const import CONF_ID, CONF_TEMPERATURE_OFFSET

CODEOWNERS = ["@trvrnrth"]
DEPENDENCIES = ["i2c"]
AUTO_LOAD = ["sensor", "text_sensor"]
MULTI_CONF = True

CONF_BME680_BSEC_ID = "bme680_bsec_id"
CONF_TEMPERATURE_OFFSET = "temperature_offset"
CONF_IAQ_MODE = "iaq_mode"
CONF_SUPPLY_VOLTAGE = "supply_voltage"
CONF_SAMPLE_RATE = "sample_rate"
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/cs5460a/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
CONF_ID,
CONF_POWER,
CONF_VOLTAGE,
CONF_VOLTAGE_GAIN,
UNIT_VOLT,
UNIT_AMPERE,
UNIT_WATT,
Expand Down Expand Up @@ -33,7 +34,6 @@
CONF_PHASE_OFFSET = "phase_offset"
CONF_PGA_GAIN = "pga_gain"
CONF_CURRENT_GAIN = "current_gain"
CONF_VOLTAGE_GAIN = "voltage_gain"
CONF_CURRENT_HPF = "current_hpf"
CONF_VOLTAGE_HPF = "voltage_hpf"
CONF_PULSE_ENERGY = "pulse_energy"
Expand Down
3 changes: 1 addition & 2 deletions esphome/components/daikin_brc/climate.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import climate_ir
from esphome.const import CONF_ID
from esphome.const import CONF_ID, CONF_USE_FAHRENHEIT

AUTO_LOAD = ["climate_ir"]

daikin_brc_ns = cg.esphome_ns.namespace("daikin_brc")
DaikinBrcClimate = daikin_brc_ns.class_("DaikinBrcClimate", climate_ir.ClimateIR)

CONF_USE_FAHRENHEIT = "use_fahrenheit"

CONFIG_SCHEMA = climate_ir.CLIMATE_IR_WITH_RECEIVER_SCHEMA.extend(
{
Expand Down
4 changes: 1 addition & 3 deletions esphome/components/dfrobot_sen0395/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import esphome.config_validation as cv
from esphome import automation
from esphome.automation import maybe_simple_id
from esphome.const import CONF_ID
from esphome.const import CONF_FACTORY_RESET, CONF_ID, CONF_SENSITIVITY
from esphome.components import uart

CODEOWNERS = ["@niklasweber"]
Expand All @@ -28,8 +28,6 @@
CONF_DELAY_AFTER_DISAPPEAR = "delay_after_disappear"
CONF_DETECTION_SEGMENTS = "detection_segments"
CONF_OUTPUT_LATENCY = "output_latency"
CONF_FACTORY_RESET = "factory_reset"
CONF_SENSITIVITY = "sensitivity"

CONFIG_SCHEMA = cv.All(
cv.Schema(
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/emc2101/sensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from esphome.const import (
CONF_EXTERNAL_TEMPERATURE,
CONF_ID,
CONF_INTERNAL_TEMPERATURE,
CONF_SPEED,
DEVICE_CLASS_TEMPERATURE,
STATE_CLASS_MEASUREMENT,
Expand All @@ -16,7 +17,6 @@

DEPENDENCIES = ["emc2101"]

CONF_INTERNAL_TEMPERATURE = "internal_temperature"
CONF_DUTY_CYCLE = "duty_cycle"

EMC2101Sensor = emc2101_ns.class_("EMC2101Sensor", cg.PollingComponent)
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/ens160/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import esphome.config_validation as cv
from esphome.components import i2c, sensor
from esphome.const import (
CONF_COMPENSATION,
CONF_ECO2,
CONF_HUMIDITY,
CONF_ID,
Expand All @@ -27,7 +28,6 @@
)

CONF_AQI = "aqi"
CONF_COMPENSATION = "compensation"
UNIT_INDEX = "index"

CONFIG_SCHEMA = (
Expand Down
3 changes: 1 addition & 2 deletions esphome/components/esp32_ble/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
from esphome.const import CONF_ID
from esphome.const import CONF_ENABLE_ON_BOOT, CONF_ID
from esphome.core import CORE
from esphome.components.esp32 import add_idf_sdkconfig_option, get_esp32_variant, const

Expand All @@ -11,7 +11,6 @@

CONF_BLE_ID = "ble_id"
CONF_IO_CAPABILITY = "io_capability"
CONF_ENABLE_ON_BOOT = "enable_on_boot"

NO_BLUETOOTH_VARIANTS = [const.VARIANT_ESP32S2]

Expand Down
2 changes: 1 addition & 1 deletion esphome/components/esp32_camera/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
CONF_BRIGHTNESS,
CONF_CONTRAST,
CONF_TRIGGER_ID,
CONF_VSYNC_PIN,
)
from esphome.core import CORE
from esphome.components.esp32 import add_idf_sdkconfig_option
Expand Down Expand Up @@ -112,7 +113,6 @@
}

# pin assignment
CONF_VSYNC_PIN = "vsync_pin"
CONF_HREF_PIN = "href_pin"
CONF_PIXEL_CLOCK_PIN = "pixel_clock_pin"
CONF_EXTERNAL_CLOCK = "external_clock"
Expand Down
3 changes: 1 addition & 2 deletions esphome/components/graphical_display_menu/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import display, font, color
from esphome.const import CONF_ID, CONF_TRIGGER_ID
from esphome.const import CONF_DISPLAY, CONF_ID, CONF_TRIGGER_ID
from esphome import automation, core

from esphome.components.display_menu_base import (
Expand All @@ -10,7 +10,6 @@
display_menu_to_code,
)

CONF_DISPLAY = "display"
CONF_FONT = "font"
CONF_MENU_ITEM_VALUE = "menu_item_value"
CONF_FOREGROUND_COLOR = "foreground_color"
Expand Down
4 changes: 2 additions & 2 deletions esphome/components/haier/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
from esphome import automation
from esphome.const import (
CONF_BEEPER,
CONF_DISPLAY,
CONF_ID,
CONF_LEVEL,
CONF_LOGGER,
CONF_LOGS,
CONF_MAX_TEMPERATURE,
CONF_MIN_TEMPERATURE,
CONF_OUTDOOR_TEMPERATURE,
CONF_PROTOCOL,
CONF_SUPPORTED_MODES,
CONF_SUPPORTED_PRESETS,
Expand Down Expand Up @@ -43,11 +45,9 @@
CONF_ANSWER_TIMEOUT = "answer_timeout"
CONF_CONTROL_METHOD = "control_method"
CONF_CONTROL_PACKET_SIZE = "control_packet_size"
CONF_DISPLAY = "display"
CONF_HORIZONTAL_AIRFLOW = "horizontal_airflow"
CONF_ON_ALARM_START = "on_alarm_start"
CONF_ON_ALARM_END = "on_alarm_end"
CONF_OUTDOOR_TEMPERATURE = "outdoor_temperature"
CONF_VERTICAL_AIRFLOW = "vertical_airflow"
CONF_WIFI_SIGNAL = "wifi_signal"

Expand Down
2 changes: 1 addition & 1 deletion esphome/components/haier/sensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import esphome.config_validation as cv
from esphome.components import sensor
from esphome.const import (
CONF_OUTDOOR_TEMPERATURE,
CONF_POWER,
CONF_HUMIDITY,
DEVICE_CLASS_CURRENT,
Expand Down Expand Up @@ -41,7 +42,6 @@
CONF_OUTDOOR_DEFROST_TEMPERATURE = "outdoor_defrost_temperature"
CONF_OUTDOOR_IN_AIR_TEMPERATURE = "outdoor_in_air_temperature"
CONF_OUTDOOR_OUT_AIR_TEMPERATURE = "outdoor_out_air_temperature"
CONF_OUTDOOR_TEMPERATURE = "outdoor_temperature"

# Additional icons
ICON_SNOWFLAKE_THERMOMETER = "mdi:snowflake-thermometer"
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/hmc5883l/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
CONF_FIELD_STRENGTH_X,
CONF_FIELD_STRENGTH_Y,
CONF_FIELD_STRENGTH_Z,
CONF_HEADING,
CONF_ID,
CONF_OVERSAMPLING,
CONF_RANGE,
Expand All @@ -21,7 +22,6 @@

hmc5883l_ns = cg.esphome_ns.namespace("hmc5883l")

CONF_HEADING = "heading"

HMC5883LComponent = hmc5883l_ns.class_(
"HMC5883LComponent", cg.PollingComponent, i2c.I2CDevice
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/inkplate6/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
CONF_ID,
CONF_LAMBDA,
CONF_MODEL,
CONF_OE_PIN,
CONF_PAGES,
CONF_WAKEUP_PIN,
)
Expand All @@ -29,7 +30,6 @@
CONF_GMOD_PIN = "gmod_pin"
CONF_GPIO0_ENABLE_PIN = "gpio0_enable_pin"
CONF_LE_PIN = "le_pin"
CONF_OE_PIN = "oe_pin"
CONF_PARTIAL_UPDATING = "partial_updating"
CONF_POWERUP_PIN = "powerup_pin"
CONF_SPH_PIN = "sph_pin"
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/kmeteriso/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
from esphome.components import i2c, sensor
from esphome.const import (
CONF_ID,
CONF_INTERNAL_TEMPERATURE,
CONF_TEMPERATURE,
DEVICE_CLASS_TEMPERATURE,
STATE_CLASS_MEASUREMENT,
UNIT_CELSIUS,
ENTITY_CATEGORY_DIAGNOSTIC,
)

CONF_INTERNAL_TEMPERATURE = "internal_temperature"
DEPENDENCIES = ["i2c"]

kmeteriso_ns = cg.esphome_ns.namespace("kmeteriso")
Expand Down
6 changes: 3 additions & 3 deletions esphome/components/ld2410/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
ENTITY_CATEGORY_DIAGNOSTIC,
ICON_MOTION_SENSOR,
ICON_ACCOUNT,
CONF_HAS_TARGET,
CONF_HAS_MOVING_TARGET,
CONF_HAS_STILL_TARGET,
)
from . import CONF_LD2410_ID, LD2410Component

DEPENDENCIES = ["ld2410"]
CONF_HAS_TARGET = "has_target"
CONF_HAS_MOVING_TARGET = "has_moving_target"
CONF_HAS_STILL_TARGET = "has_still_target"
CONF_OUT_PIN_PRESENCE_STATUS = "out_pin_presence_status"

CONFIG_SCHEMA = {
Expand Down
4 changes: 2 additions & 2 deletions esphome/components/ld2410/button/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from esphome.components import button
import esphome.config_validation as cv
from esphome.const import (
CONF_FACTORY_RESET,
CONF_RESTART,
DEVICE_CLASS_RESTART,
ENTITY_CATEGORY_DIAGNOSTIC,
ENTITY_CATEGORY_CONFIG,
Expand All @@ -15,8 +17,6 @@
ResetButton = ld2410_ns.class_("ResetButton", button.Button)
RestartButton = ld2410_ns.class_("RestartButton", button.Button)

CONF_FACTORY_RESET = "factory_reset"
CONF_RESTART = "restart"
CONF_QUERY_PARAMS = "query_params"

CONFIG_SCHEMA = {
Expand Down
3 changes: 1 addition & 2 deletions esphome/components/ld2420/binary_sensor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import binary_sensor
from esphome.const import CONF_ID, DEVICE_CLASS_OCCUPANCY
from esphome.const import CONF_ID, DEVICE_CLASS_OCCUPANCY, CONF_HAS_TARGET
from .. import ld2420_ns, LD2420Component, CONF_LD2420_ID

LD2420BinarySensor = ld2420_ns.class_(
"LD2420BinarySensor", binary_sensor.BinarySensor, cg.Component
)

CONF_HAS_TARGET = "has_target"

CONFIG_SCHEMA = cv.All(
cv.COMPONENT_SCHEMA.extend(
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/ld2420/button/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from esphome.components import button
import esphome.config_validation as cv
from esphome.const import (
CONF_FACTORY_RESET,
DEVICE_CLASS_RESTART,
ENTITY_CATEGORY_DIAGNOSTIC,
ENTITY_CATEGORY_CONFIG,
Expand All @@ -19,7 +20,6 @@
CONF_APPLY_CONFIG = "apply_config"
CONF_REVERT_CONFIG = "revert_config"
CONF_RESTART_MODULE = "restart_module"
CONF_FACTORY_RESET = "factory_reset"


CONFIG_SCHEMA = {
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/mcp3008/sensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from esphome.const import (
CONF_ID,
CONF_NUMBER,
CONF_REFERENCE_VOLTAGE,
UNIT_VOLT,
STATE_CLASS_MEASUREMENT,
DEVICE_CLASS_VOLTAGE,
Expand All @@ -22,7 +23,6 @@
voltage_sampler.VoltageSampler,
cg.Parented.template(MCP3008),
)
CONF_REFERENCE_VOLTAGE = "reference_voltage"
CONF_MCP3008_ID = "mcp3008_id"

CONFIG_SCHEMA = (
Expand Down
3 changes: 1 addition & 2 deletions esphome/components/mcp3204/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import spi
from esphome.const import CONF_ID
from esphome.const import CONF_ID, CONF_REFERENCE_VOLTAGE

DEPENDENCIES = ["spi"]
MULTI_CONF = True
Expand All @@ -10,7 +10,6 @@
mcp3204_ns = cg.esphome_ns.namespace("mcp3204")
MCP3204 = mcp3204_ns.class_("MCP3204", cg.Component, spi.SPIDevice)

CONF_REFERENCE_VOLTAGE = "reference_voltage"

CONFIG_SCHEMA = cv.Schema(
{
Expand Down

0 comments on commit ccbf514

Please sign in to comment.