From a519e5c4754f655bd130e726173e45010ff1e90b Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Wed, 13 Apr 2022 12:26:25 +1200 Subject: [PATCH] Fix silent config errors (#3380) --- esphome/config.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/esphome/config.py b/esphome/config.py index af6c5b0b64..a878f3ef79 100644 --- a/esphome/config.py +++ b/esphome/config.py @@ -161,6 +161,7 @@ class Config(OrderedDict, fv.FinalValidateConfig): # type: (ConfigPath) -> Optional[vol.Invalid] for err in self.errors: if self.get_deepest_path(err.path) == path: + self.errors.remove(err) return err return None @@ -647,7 +648,7 @@ class FinalValidateValidationStep(ConfigValidationStep): fv.full_config.reset(token) -def validate_config(config, command_line_substitutions): +def validate_config(config, command_line_substitutions) -> Config: result = Config() loader.clear_component_meta_finders() @@ -734,9 +735,6 @@ def validate_config(config, command_line_substitutions): result.add_validation_step(LoadValidationStep(key, config[key])) result.run_validation_steps() - if result.errors: - return result - for domain, conf in config.items(): result.add_validation_step(LoadValidationStep(domain, conf)) result.add_validation_step(IDPassValidationStep()) @@ -991,5 +989,10 @@ def read_config(command_line_substitutions): errstr += f" {errline}" safe_print(errstr) safe_print(indent(dump_dict(res, path)[0])) + + for err in res.errors: + safe_print(color(Fore.BOLD_RED, err.msg)) + safe_print("") + return None return OrderedDict(res)