Yamllint: Difference between revisions
No edit summary |
explain block scalars a bit |
||
| Line 38: | Line 38: | ||
== Yaml multiline == | == Yaml multiline == | ||
Interactive demonstration of Block scalars and Flow scalars https://yaml-multiline.info/ | <blockquote>When writing YAML in your [[Ansible]] playbooks, you run across values that span multiple lines using <code>|</code> or <code>></code>. Spanning multiple lines using a “Literal Block Scalar” <code>|</code> will '''include the newlines''' and any '''trailing''' '''spaces'''. Using a “Folded Block Scalar” <code>></code> will '''fold newlines to spaces.''' It is used to make what would otherwise be a very long line easier to read and edit. In either case the ''indentation (leading spaces) will be ignored''. </blockquote>from [https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html YAML in Ansible] (Community Documentation) | ||
Interactive demonstration of '''Block scalars''' and '''Flow scalars''' https://yaml-multiline.info/ | |||
[https://stackoverflow.com/questions/3790454/how-do-i-break-a-string-in-yaml-over-multiple-lines/21699210#21699210 The SO answer that describes them all] | [https://stackoverflow.com/questions/3790454/how-do-i-break-a-string-in-yaml-over-multiple-lines/21699210#21699210 The SO answer that describes them all] | ||
==Many linters== | ==Many linters== | ||
You can't just use "one" solution either<ref>https://phabricator.wikimedia.org/T95890</ref>. The leading GPL linter is based on Python, so depending on your code repo, you may instead want to use a JavaScript or PHP implementation. Thus, tools like [[wp:Grunt (software)]] may be used to automate JSHint linting in [[JavaScript]] projects<ref>https://www.codereadability.com/jshint-with-grunt/</ref>. | You can't just use "one" solution either<ref>https://phabricator.wikimedia.org/T95890</ref>. The leading GPL linter is based on Python, so depending on your code repo, you may instead want to use a JavaScript or PHP implementation. Thus, tools like [[wp:Grunt (software)]] may be used to automate JSHint linting in [[JavaScript]] projects<ref>https://www.codereadability.com/jshint-with-grunt/</ref>. | ||
| Line 59: | Line 52: | ||
*https://www.redhat.com/sysadmin/check-yaml-yamllint | *https://www.redhat.com/sysadmin/check-yaml-yamllint | ||
* https://www.redhat.com/en/blog/ansible-lists-dictionaries-yaml | * https://www.redhat.com/en/blog/ansible-lists-dictionaries-yaml | ||
* [https://symfony.com/doc/current/reference/formats/yaml.html YAML in Symphony] | |||
* [https://yaml.org/spec/1.2.2/#scalars YAML 1.2.2 spec on '''scalars'''] | |||
* [https://yaml.org/spec/1.2.2/#8112-block-chomping-indicator YAML 1.2.2 spec on '''block chomping'''] | |||
{{References}} | {{References}} | ||