Open main menu

Changes

add several more command switches to the 'tips'; change tips to cheatsheet
Of course, you should have one in your local tools and CI pipeline to ensure that your [[YAML]] is always correct. With the yamllint, there is both a script and a Python module; meaning you can write your own linting tool in Python by invoking (importing) the yamllint module<ref>https://yamllint.readthedocs.io/en/stable/development.html</ref>. See the caveat section below about "using the right tool for the job" - meaning use the right linter for the language/project you are linting.
 
{{Notice|If you have a <tt>.yamllint</tt> file in your working directory, it will be automatically loaded as configuration by yamllint.}}
 
==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.
== Tips Cheatsheet==
You can use '''[https://yamllint.readthedocs.io/en/stable/disable_with_comments.html comment directives]''' to control the behavior of <code>yamllint</code>
</syntaxhighlight>
<code>--no-warnings</code> will suppress the warnings so you can focus only on errors.
 
<code>--list-files</code> will show you the list of files that yamllint finds (and would otherwise lint).
 
<code>--format</code> (or <code>-f</code>) gives you options for how you want the output to display.
==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>.