Yamllint: Difference between revisions
Add intro sentence |
add multiline section |
||
| Line 1: | Line 1: | ||
A linter for YAML files. <code>'''yamllint'''</code> does not only check for syntax validity, but for weirdness like key repetition and cosmetic problems such as lines length, trailing spaces, indentation, etc. | A linter for YAML files. <code>'''yamllint'''</code> does not only check for syntax validity, but for weirdness like key repetition and cosmetic problems such as lines length, trailing spaces, indentation, etc. | ||
Use an online validator like https://www.yamllint.com/ or https://jsonformatter.org/yaml-validator | Use an online validator like https://www.yamllint.com/ or https://jsonformatter.org/yaml-validator | ||
| Line 38: | Line 36: | ||
<code>--format</code> (or <code>-f</code>) gives you options for how you want the output to display. | <code>--format</code> (or <code>-f</code>) gives you options for how you want the output to display. | ||
== Yaml multiline == | |||
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://symfony.com/doc/current/reference/formats/yaml.html YAML in Symphony] | |||
[https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html YAML in Ansible] | |||
The [https://yaml.org/spec/1.2.2/#scalars YAML 1.2.2 spec on scalars] | |||
<br /> | |||
==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>. | ||