Closed mathomp4 closed 2 years ago
NOTE: That if we go from "relaxed and no warnings" (like used on CI) to "strict" things get fun. From no issues, to a lot of errors:
❯ yamllint -d relaxed --no-warnings ./Examples/Simple/simple2.yaml
❯ yamllint ./Examples/Simple/simple2.yaml
./Examples/Simple/simple2.yaml
2:1 warning missing document start "---" (document-start)
2:4 error too many spaces after colon (colons)
4:7 warning truthy value should be one of [false, true] (truthy)
7:13 error too many spaces after colon (colons)
7:15 error too many spaces inside brackets (brackets)
7:17 error too many spaces before comma (commas)
7:21 error too many spaces before comma (commas)
7:25 error too many spaces before comma (commas)
7:29 error too many spaces inside brackets (brackets)
22:13 error too many spaces inside braces (braces)
22:21 error too many spaces before comma (commas)
22:31 error too many spaces inside braces (braces)
23:1 error too many blank lines (1 > 0) (empty-lines)
Though maybe the files here in yaFyaml should be strictly judged?
I say start with relaxed and we'll up our game. Can you check to see if pyyaml chokes on trailing spaces?
Looks like pyyaml and ruamel.yaml are okay with a file that relaxed yamllint doesn't like:
❯ yamllint -d relaxed --no-warnings categories.yaml
categories.yaml
10:13 error trailing spaces (trailing-spaces)
❯ python3 test.pyyaml.py
{'sports': ['soccer', 'football', 'basketball', 'cricket', 'hockey', 'table tennis'], 'countries': ['Pakistan', 'USA', 'India', 'China', 'Germany', 'France', 'Spain']}
❯ python3 test.ruamel.py
{'sports': ['soccer', 'football', 'basketball', 'cricket', 'hockey', 'table tennis'], 'countries': ['Pakistan', 'USA', 'India', 'China', 'Germany', 'France', 'Spain']}
That said, it does seem to be something YAML 1.2 is not happy about, but if PyYAML is happy, then yaFyaml can be as well.
This is something from using
yamllint
now in some CI in GEOS (e.g., https://github.com/GEOS-ESM/GOCART/pull/164) (which could be added here too).The CI runs essentially:
and even in "relaxed" mode, one of the things it returns an error on is "trailing spaces". For example:
I'm not exactly sure what triggers this in the YAML spec but perhaps this (emphasis mine):
Not sure.