Difference between revisions of "Yamllint"

From Freephile Wiki
Jump to navigation Jump to search
(add that you have to manually fix errors)
Line 3: Line 3:
 
Of course, you should have one in your local tools and CI pipeline to ensure that your [[YAML]] is always correct.
 
Of course, you should have one in your local tools and CI pipeline to ensure that your [[YAML]] is always correct.
  
You can't just use "one" solution though. 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>.
+
== Manually fix errors==
 +
Unfortunately, <tt>yamllint</tt> does not fix your file for you. There could be ambiguities about the proper fix, so you need to do the fix(es) yourself.
  
 +
== 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>.
 +
 +
== Source, Docs and Reading ==
 
* https://github.com/adrienverge/yamllint
 
* https://github.com/adrienverge/yamllint
 
* https://yamllint.readthedocs.io/en/stable/
 
* https://yamllint.readthedocs.io/en/stable/
 +
* https://www.redhat.com/sysadmin/check-yaml-yamllint
  
 
{{References}}
 
{{References}}

Revision as of 19:41, 16 January 2024

Use an online validator like https://www.yamllint.com/ or https://jsonformatter.org/yaml-validator

Of course, you should have one in your local tools and CI pipeline to ensure that your Yaml is always correct.

Manually fix errors[edit | edit source]

Unfortunately, yamllint does not fix your file for you. There could be ambiguities about the proper fix, so you need to do the fix(es) yourself.

Many linters[edit | edit source]

You can't just use "one" solution either[1]. 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[2].

Source, Docs and Reading[edit | edit source]

References[edit source]