diff mbox series

tools: binman: ti_board_cfg: improve error message

Message ID 20240326093934.2167180-1-mwalle@kernel.org
State Accepted
Commit a26bef219bf56363fa00c355029c04c5d6898697
Delegated to: Tom Rini
Headers show
Series tools: binman: ti_board_cfg: improve error message | expand

Commit Message

Michael Walle March 26, 2024, 9:39 a.m. UTC
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.

Signed-off-by: Michael Walle <mwalle@kernel.org>
---
 tools/binman/etype/ti_board_config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Neha Malcom Francis March 26, 2024, 9:55 a.m. UTC | #1
Hi Michael,

On 26/03/24 15:09, Michael Walle wrote:
> 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.
> 
> Signed-off-by: Michael Walle <mwalle@kernel.org>
> ---
>   tools/binman/etype/ti_board_config.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/binman/etype/ti_board_config.py b/tools/binman/etype/ti_board_config.py
> index 2c3bb8f7b56..c10d66edcb1 100644
> --- a/tools/binman/etype/ti_board_config.py
> +++ b/tools/binman/etype/ti_board_config.py
> @@ -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:

Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
Tom Rini April 12, 2024, 2:12 a.m. UTC | #2
On Tue, 26 Mar 2024 10:39:34 +0100, Michael Walle wrote:

> 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!
diff mbox series

Patch

diff --git a/tools/binman/etype/ti_board_config.py b/tools/binman/etype/ti_board_config.py
index 2c3bb8f7b56..c10d66edcb1 100644
--- a/tools/binman/etype/ti_board_config.py
+++ b/tools/binman/etype/ti_board_config.py
@@ -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: