Open perlpunk opened 4 years ago
If yamltidy
did this I would constantly promote it.
People constantly use quotes where they are not needed. And they use double quotes where single quotes would be more appropriate.
I would make the behavior:
as much as the specific value allows.
Literal and folded are pretty much always used purposefully so I wouldn't change them.
I would make "less quoting" the default, but provide an option not to.
yes, I agree. I would like to use the same or similar options as yamllint (where it is possible/makes sense), see https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.quoted_strings
It allows to specify a regex for custom strings that should be quoted.
in version 0.003_002 you can try it out. for now it only works on single line scalars. by default single and double quotes are turned to plain if the schema allows it.
it does not yet work in flow style collections.
Want to try out https://metacpan.org/release/TINITA/YAML-Tidy-0.006_001 ?
This is probably simple at least for single-line scalars.
YAML::PP::Schema allows to check to what type a scalar would be loaded.