Closed tiborsimko closed 8 months ago
Two options:
(a) Expose the exception that is already thrown by yaml.load
, like this:
==> ERROR: reana.yaml is not a valid YAML file:
while parsing a block mapping
in "<unicode string>", line 3, column 3:
files:
^
expected <block end>, but found '<block mapping start>'
in "<unicode string>", line 6, column 4:
parameters:
^
(b) Add yamllint
to the dependencies of r-commons (as validation and parsing are there) and use it to check whether the YAML file is valid. It does not require too many dependencies:
$ pip install yamllint
$ pip freeze
pathspec==0.11.2
PyYAML==6.0.1
yamllint==1.32.0
Note that pyyaml
and pathspec
are already installed by reana-client (but not by cluster components)
I think option (a) might already be enough to find out where is the issue in the YAML file, even though it does not report specifically that there are indentation issues.
What do you think?
Current behaviour
The
reana-client validate
returns cryptic error message when there is a problem withreana.yaml
validation:This is problematic because the users would not understand what's wong.
Expected behaviour
Users should be given hint that there is a problem with indentation of
reana.yaml
clauses.For example, see what
yamllint
does: