Skip to contentSkip to conversation

tools: binman: ti_board_cfg: improve error message

PATCH In review Michael Walle 3 participants 3 messages Mar 26, 2024 – Apr 12, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: binman: ti_board_cfg: improve error message

When there is a lint error the user gets the following cryptic message:

binman: Node '/path/to/some/node': Yamllint error: 18: comments

This isn't very helpful. Improve the message to tell the user that the number is actually a line number and also tell the user in which file they have to look.

---
 tools/binman/etype/ti_board_config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/binman/etype/ti_board_config.py +1 -1
index 2c3bb8f7b56..c10d66edcb1 100644
@@ -248,7 +248,7 @@ class Entry_ti_board_config(Entry_section):
 
             yaml_config = config.YamlLintConfig("extends: default")
             for p in yamllint.linter.run(open(self._config_file, "r"), yaml_config):
-                self.Raise(f"Yamllint error: {p.line}: {p.rule}")
+                self.Raise(f"Yamllint error: Line {p.line} in {self._config_file}: {p.rule}")
             try:
                 validate(self.file_yaml, self.schema_yaml)
             except Exception as e:
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw

Hi Michael,

Quoted 18 lines · Michael Walle

When there is a lint error the user gets the following cryptic message:

binman: Node '/path/to/some/node': Yamllint error: 18: comments

This isn't very helpful. Improve the message to tell the user that the number is actually a line number and also tell the user in which file they have to look.

---
  tools/binman/etype/ti_board_config.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/binman/etype/ti_board_config.py +0 -0
index 2c3bb8f7b56..c10d66edcb1 100644

tools/binman/etype/ti_board_config.py class Entry_ti_board_config(Entry_section): · line 254

Quoted 8 lines
tools/binman/etype/ti_board_config.py +1 -1
@@ -248,7 +248,7 @@ class Entry_ti_board_config(Entry_section):
 
              yaml_config = config.YamlLintConfig("extends: default")
              for p in yamllint.linter.run(open(self._config_file, "r"), yaml_config):
-                self.Raise(f"Yamllint error: {p.line}: {p.rule}")
+                self.Raise(f"Yamllint error: Line {p.line} in {self._config_file}: {p.rule}")
              try:
                  validate(self.file_yaml, self.schema_yaml)
              except Exception as e:
Signature · 2 lines
Thanking You
Neha Malcom Francis
#2 lore raw
In reply to Michael Walle
Quoted 9 lines · Michael Walle

When there is a lint error the user gets the following cryptic message:

binman: Node '/path/to/some/node': Yamllint error: 18: comments

This isn't very helpful. Improve the message to tell the user that the number is actually a line number and also tell the user in which file they have to look.

[...]

Applied to u-boot/master, thanks!

Signature · 1 line
Tom