Linters
What is yamllint? An introduction to the YAML linter
yamllint is a linter for YAML files. It checks more than whether the syntax is valid: it also reports key repetition and cosmetic problems such as line length, trailing spaces and indentation. It can be installed with pip.
- Tool
- yamllint
- Made by
- yamllint
- Official site
- github.com/adrienverge/yamllint
- Category
- Linters
Who makes yamllint
yamllint is published under the yamllint name. The official website is the project's GitHub repository, linked below. Its documentation is hosted on Read the Docs.
Official website: github.com/adrienverge/yamllint
What yamllint is for
yamllint helps keep YAML files correct and tidy. A file can be valid YAML and still contain problems, so the tool looks beyond syntax to quirks and cosmetic issues.
Repeated keys are one example of a quirk it reports. Cosmetic checks cover line length, trailing spaces and indentation, which keep files consistent for everyone who edits them.
Who yamllint is for
The vendor does not state a target audience. In practice, the tool is relevant to anyone who maintains YAML files and wants a repeatable way to check them, whether on a single machine or as part of a shared workflow.
Packaging for all major operating systems and installation through pip keep it easy to set up in different environments. The parsable output format is aimed at people who want problems reported directly in their editor.
Notable capabilities
yamllint is flexible about what it checks and where. The following capabilities come from its verified facts.
- Beyond syntax: it checks syntax validity as well as key repetition and cosmetic issues like line length, trailing spaces and indentation.
- Files and directories: it can lint individual files or recursively lint a directory.
- Pre-defined configurations: ready-made configurations such as 'relaxed' can be selected.
- Custom configuration: you can supply your own configuration file, which can extend a default config.
- Rule levels: configuration files can set rule levels, such as warning, or disable rules altogether.
- Inline control: special comments can disable checks for a single line or for a block.
- Ignore patterns: files can be ignored entirely or per rule using .gitignore-style patterns.
- Editor support: a parsable output format is available for editor syntax checking.
How yamllint fits linters
yamllint is a linter for a data and configuration format rather than for a programming language. YAML files often drive settings and automation, so checking them for mistakes and inconsistencies is a natural job for a linter.
Within a collection of linters, static analysis and code quality tools, it covers the YAML layer of a repository. Its configuration model of presets, rule levels and ignore patterns is similar to what developers expect from other linters, so it can be adopted with familiar habits.
Frequently asked questions
What is yamllint used for?
yamllint is used to lint YAML files. It checks syntax validity, key repetition and cosmetic issues such as line length, trailing spaces and indentation.
How do I install yamllint?
yamllint can be installed with pip. It is also packaged for all major operating systems.
Can yamllint lint a whole directory?
Yes. It can lint individual files or recursively lint a directory.
Can I disable yamllint checks for part of a file?
Yes. Special comments can disable checks for a single line or a block. Files can also be ignored entirely or per rule with .gitignore-style patterns.
Does yamllint support custom configuration?
Yes. You can select pre-defined configurations such as 'relaxed' or supply your own configuration file. Custom files can extend a default config, set rule levels such as warning, or disable rules.
Linthelm is independent and is not affiliated with yamllint. Product names belong to their owners. Features change; confirm details on the official website.