Linter friendly YAML output
abitrolly opened this issue · 3 comments
abitrolly commented
YAML files produced by dump
are not linter friendly.
Example dumped.yaml
is attached.
require 'psych'
loaded = Psych.load_file('feature_flags.yaml')
#puts loaded
#puts Psych.methods
File.write 'dumped.yaml', Psych.dump(loaded)
$ yamllint dumped.yaml
feature_flags.yaml
4:3 error wrong indentation: expected 4 but found 2 (indentation)
5:81 error line too long (82 > 80 characters) (line-length)
12:81 error line too long (82 > 80 characters) (line-length)
19:81 error line too long (82 > 80 characters) (line-length)
26:81 error line too long (82 > 80 characters) (line-length)
33:81 error line too long (82 > 80 characters) (line-length)
34:23 error trailing spaces (trailing-spaces)
40:81 error line too long (82 > 80 characters) (line-length)
47:81 error line too long (82 > 80 characters) (line-length)
54:81 error line too long (87 > 80 characters) (line-length)
...
So how to produce linter friendly YAML with Psych?
abitrolly commented
The problems occurs when building GitLab Docs https://gitlab.com/gitlab-org/gitlab-docs/-/merge_requests/3160
hsbt commented
I don't have a plan to support the linter tool like yamllint
.
abitrolly commented
If you reconsider to make YAML in Ruby stdlib more flexible, here is link of what is possible https://yamllint.readthedocs.io/en/latest/configuration.html#default-configuration