Member-only story

How to easily detect issues in your YAML files

Xavier Jouvenot
2 min readFeb 2, 2022

--

Hello ! I’m Xavier Jouvenot and in this small post, I am going to explain how to easily detect issues in your YAML files.

Self promotion: You can find other articles on computer science and programming on my website 😉

Problematic

Whether you use YAML files to store server or CI/CI configuration, or simply data of your application, YAML is a language where a mistake can easily occurs, since indentation and spaces play a very important role in it. Then, is can be very useful to have a tool which is able to check if the YAML files you are creating, using and modifying, in your daily work, are actually good, or if there are some major (or minor) issues in them.

Solution

When you want to check if some source file contains correct code, the right thing to do is to look for something called a linter. A linter is a software which flags programming errors, bugs, stylistic errors and/or suspicious constructs, in a file, or a full program, so that you can correct the last one accordingly and have a source file of better quality.

For YAML, there is actually a linter available, really easy to use, on all the main platforms, named yamllint. You can use it directly in your terminal by using the following command:

yamllint <path/to/your/yaml/file.yml> <another/path/to/another/yaml/file.yml>

--

--

No responses yet