diff --git a/CODEOWNERS b/CODEOWNERS index 2254ff2caa..1722f482ac 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -11,6 +11,7 @@ esphome/*.py @esphome/core esphome/core/* @esphome/core # Integrations +esphome/components/ac_dimmer/* @glmnet esphome/components/adc/* @esphome/core esphome/components/api/* @OttoWinter esphome/components/async_tcp/* @OttoWinter @@ -19,7 +20,9 @@ esphome/components/binary_sensor/* @esphome/core esphome/components/captive_portal/* @OttoWinter esphome/components/climate/* @esphome/core esphome/components/climate_ir/* @glmnet +esphome/components/coolix/* @glmnet esphome/components/cover/* @esphome/core +esphome/components/ct_clamp/* @jesserockz esphome/components/debug/* @OttoWinter esphome/components/dfplayer/* @glmnet esphome/components/dht/* @OttoWinter @@ -42,6 +45,7 @@ esphome/components/pid/* @OttoWinter esphome/components/pn532/* @OttoWinter esphome/components/power_supply/* @esphome/core esphome/components/restart/* @esphome/core +esphome/components/rf_bridge/* @jesserockz esphome/components/rtttl/* @glmnet esphome/components/script/* @esphome/core esphome/components/sensor/* @esphome/core @@ -51,8 +55,15 @@ esphome/components/spi/* @esphome/core esphome/components/substitutions/* @esphome/core esphome/components/sun/* @OttoWinter esphome/components/switch/* @esphome/core +esphome/components/tcl112/* @glmnet esphome/components/time/* @OttoWinter +esphome/components/tm1637/* @glmnet +esphome/components/tuya/binary_sensor/* @jesserockz +esphome/components/tuya/climate/* @jesserockz +esphome/components/tuya/sensor/* @jesserockz +esphome/components/tuya/switch/* @jesserockz esphome/components/uart/* @esphome/core esphome/components/ultrasonic/* @OttoWinter esphome/components/version/* @esphome/core esphome/components/web_server_base/* @OttoWinter +esphome/components/whirlpool/* @glmnet diff --git a/esphome/components/ct_clamp/sensor.py b/esphome/components/ct_clamp/sensor.py index 9f41f8c614..42a3b66497 100644 --- a/esphome/components/ct_clamp/sensor.py +++ b/esphome/components/ct_clamp/sensor.py @@ -4,6 +4,7 @@ from esphome.components import sensor, voltage_sampler from esphome.const import CONF_SENSOR, CONF_ID, ICON_FLASH, UNIT_AMPERE AUTO_LOAD = ['voltage_sampler'] +CODEOWNERS = ['@jesserockz'] CONF_SAMPLE_DURATION = 'sample_duration' diff --git a/esphome/components/rf_bridge/__init__.py b/esphome/components/rf_bridge/__init__.py index 1fd4fbc7bd..885e5765dd 100644 --- a/esphome/components/rf_bridge/__init__.py +++ b/esphome/components/rf_bridge/__init__.py @@ -5,6 +5,7 @@ from esphome.const import CONF_ID, CONF_TRIGGER_ID, CONF_CODE, CONF_LOW, CONF_SY from esphome.components import uart DEPENDENCIES = ['uart'] +CODEOWNERS = ['@jesserockz'] rf_bridge_ns = cg.esphome_ns.namespace('rf_bridge') RFBridgeComponent = rf_bridge_ns.class_('RFBridgeComponent', cg.Component, uart.UARTDevice) diff --git a/esphome/components/tuya/binary_sensor/__init__.py b/esphome/components/tuya/binary_sensor/__init__.py index 3ba479bf19..b63638b4cc 100644 --- a/esphome/components/tuya/binary_sensor/__init__.py +++ b/esphome/components/tuya/binary_sensor/__init__.py @@ -5,6 +5,7 @@ from esphome.const import CONF_ID from .. import tuya_ns, CONF_TUYA_ID, Tuya DEPENDENCIES = ['tuya'] +CODEOWNERS = ['@jesserockz'] CONF_SENSOR_DATAPOINT = "sensor_datapoint" diff --git a/esphome/components/tuya/climate/__init__.py b/esphome/components/tuya/climate/__init__.py index b938be7b8c..878c5aefe8 100644 --- a/esphome/components/tuya/climate/__init__.py +++ b/esphome/components/tuya/climate/__init__.py @@ -5,6 +5,7 @@ from esphome.const import CONF_ID, CONF_SWITCH_DATAPOINT from .. import tuya_ns, CONF_TUYA_ID, Tuya DEPENDENCIES = ['tuya'] +CODEOWNERS = ['@jesserockz'] CONF_TARGET_TEMPERATURE_DATAPOINT = "target_temperature_datapoint" CONF_CURRENT_TEMPERATURE_DATAPOINT = "current_temperature_datapoint" diff --git a/esphome/components/tuya/sensor/__init__.py b/esphome/components/tuya/sensor/__init__.py index 5f2ff2d674..b3260bfe0b 100644 --- a/esphome/components/tuya/sensor/__init__.py +++ b/esphome/components/tuya/sensor/__init__.py @@ -5,6 +5,7 @@ from esphome.const import CONF_ID from .. import tuya_ns, CONF_TUYA_ID, Tuya DEPENDENCIES = ['tuya'] +CODEOWNERS = ['@jesserockz'] CONF_SENSOR_DATAPOINT = "sensor_datapoint" diff --git a/esphome/components/tuya/switch/__init__.py b/esphome/components/tuya/switch/__init__.py index 0eadcf0a22..f68bbbcdb6 100644 --- a/esphome/components/tuya/switch/__init__.py +++ b/esphome/components/tuya/switch/__init__.py @@ -5,6 +5,7 @@ from esphome.const import CONF_ID, CONF_SWITCH_DATAPOINT from .. import tuya_ns, CONF_TUYA_ID, Tuya DEPENDENCIES = ['tuya'] +CODEOWNERS = ['@jesserockz'] TuyaSwitch = tuya_ns.class_('TuyaSwitch', switch.Switch, cg.Component) diff --git a/script/build_codeowners.py b/script/build_codeowners.py index 3f2bf5d8c3..fce59b3b95 100755 --- a/script/build_codeowners.py +++ b/script/build_codeowners.py @@ -2,9 +2,10 @@ from pathlib import Path import sys import argparse +from collections import defaultdict from esphome.helpers import write_file_if_changed -from esphome.config import get_component +from esphome.config import get_component, get_platform from esphome.core import CORE parser = argparse.ArgumentParser() @@ -37,20 +38,47 @@ parts = [BASE] # Fake some diretory so that get_component works CORE.config_path = str(root) -for path in sorted(components_dir.iterdir()): +codeowners = defaultdict(list) + +for path in components_dir.iterdir(): if not path.is_dir(): continue if not (path / '__init__.py').is_file(): continue + name = path.name comp = get_component(name) - if comp.codeowners: - for owner in comp.codeowners: - if not owner.startswith('@'): - print(f"Codeowner {owner} for integration {name} must start with an '@' symbol!") - sys.exit(1) + codeowners[f'esphome/components/{name}/*'].extend(comp.codeowners) + + for platform_path in path.iterdir(): + platform_name = platform_path.stem + platform = get_platform(platform_name, name) + if platform is None: + continue + + if platform_path.is_dir(): + # Sub foldered platforms get their own line + if not (platform_path / '__init__.py').is_file(): + continue + codeowners[f'esphome/components/{name}/{platform_name}/*'].extend(platform.codeowners) + continue + + # Non-subfoldered platforms add to codeowners at component level + if not platform_path.is_file() or platform_path.name == '__init__.py': + continue + codeowners[f'esphome/components/{name}/*'].extend(platform.codeowners) + + +for path, owners in sorted(codeowners.items()): + owners = sorted(set(owners)) + if not owners: + continue + for owner in owners: + if not owner.startswith('@'): + print(f"Codeowner {owner} for integration {path} must start with an '@' symbol!") + sys.exit(1) + parts.append(f"{path} {' '.join(owners)}") - parts.append(f"esphome/components/{name}/* {' '.join(comp.codeowners)}") # End newline parts.append('')