2016-01-21 15:45:19 -06:00
|
|
|
yamllint
|
|
|
|
========
|
|
|
|
|
|
|
|
A linter for YAML files.
|
|
|
|
|
2016-02-01 16:03:25 -06:00
|
|
|
yamllint does not only check for syntax validity, but for weirdnesses like key
|
|
|
|
repetition and cosmetic problems such as lines length, trailing spaces,
|
|
|
|
indentation, etc.
|
2016-01-24 11:37:24 -06:00
|
|
|
|
2016-01-21 15:45:19 -06:00
|
|
|
.. image::
|
|
|
|
https://travis-ci.org/adrienverge/yamllint.svg?branch=master
|
|
|
|
:target: https://travis-ci.org/adrienverge/yamllint
|
2016-01-22 10:55:36 -06:00
|
|
|
:alt: CI tests status
|
2016-01-21 15:45:19 -06:00
|
|
|
.. image::
|
|
|
|
https://coveralls.io/repos/github/adrienverge/yamllint/badge.svg?branch=master
|
|
|
|
:target: https://coveralls.io/github/adrienverge/yamllint?branch=master
|
2016-01-22 10:55:36 -06:00
|
|
|
:alt: Code coverage status
|
|
|
|
.. image:: https://readthedocs.org/projects/yamllint/badge/?version=latest
|
2016-09-21 02:13:35 -05:00
|
|
|
:target: https://yamllint.readthedocs.io/en/latest/?badge=latest
|
2016-01-22 10:55:36 -06:00
|
|
|
:alt: Documentation status
|
2016-01-21 15:45:19 -06:00
|
|
|
|
2016-01-23 07:32:02 -06:00
|
|
|
Written in Python (compatible with Python 2 & 3).
|
2016-01-21 15:45:19 -06:00
|
|
|
|
|
|
|
Documentation
|
|
|
|
-------------
|
|
|
|
|
2016-09-21 02:13:35 -05:00
|
|
|
https://yamllint.readthedocs.io/
|
2016-01-21 15:45:19 -06:00
|
|
|
|
2016-06-27 14:29:56 -05:00
|
|
|
Overview
|
|
|
|
--------
|
2016-01-21 15:45:19 -06:00
|
|
|
|
2016-01-23 07:30:24 -06:00
|
|
|
Screenshot
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
.. image:: docs/screenshot.png
|
|
|
|
:alt: yamllint screenshot
|
|
|
|
|
2016-01-21 15:45:19 -06:00
|
|
|
Installation
|
|
|
|
^^^^^^^^^^^^
|
|
|
|
|
2016-03-15 02:03:24 -05:00
|
|
|
On Fedora / CentOS:
|
2016-03-02 12:07:35 -06:00
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
|
|
|
sudo dnf install yamllint
|
|
|
|
|
2016-11-16 11:50:13 -06:00
|
|
|
On Debian 8+ / Ubuntu 16.04+:
|
2016-03-02 12:07:35 -06:00
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
|
|
|
sudo apt-get install yamllint
|
|
|
|
|
2018-05-09 13:17:23 -05:00
|
|
|
On Mac OS 10.11+:
|
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
|
|
|
brew install yamllint
|
|
|
|
|
2016-03-02 12:07:35 -06:00
|
|
|
Alternatively using pip, the Python package manager:
|
|
|
|
|
2016-01-21 15:45:19 -06:00
|
|
|
.. code:: bash
|
|
|
|
|
2018-05-09 13:20:18 -05:00
|
|
|
pip install --user yamllint
|
2016-01-21 15:45:19 -06:00
|
|
|
|
|
|
|
Usage
|
|
|
|
^^^^^
|
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
|
|
|
# Lint one or more files
|
|
|
|
yamllint my_file.yml my_other_file.yaml ...
|
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
|
|
|
# Lint all YAML files in a directory
|
|
|
|
yamllint .
|
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
2016-03-04 11:49:29 -06:00
|
|
|
# Use a pre-defined lint configuration
|
2016-03-07 04:15:04 -06:00
|
|
|
yamllint -d relaxed file.yaml
|
2016-03-04 11:49:29 -06:00
|
|
|
|
2016-01-21 15:45:19 -06:00
|
|
|
# Use a custom lint configuration
|
2016-04-21 15:24:24 -05:00
|
|
|
yamllint -c /path/to/myconfig file-to-lint.yaml
|
2016-01-21 15:45:19 -06:00
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
|
|
|
# Output a parsable format (for syntax checking in editors like Vim, emacs...)
|
2016-03-07 04:15:04 -06:00
|
|
|
yamllint -f parsable file.yaml
|
2016-02-19 02:29:05 -06:00
|
|
|
|
2016-09-21 02:13:35 -05:00
|
|
|
`Read more in the complete documentation! <https://yamllint.readthedocs.io/>`_
|
2016-06-27 14:29:56 -05:00
|
|
|
|
|
|
|
Features
|
|
|
|
^^^^^^^^
|
|
|
|
|
|
|
|
Here is a yamllint configuration file example:
|
2016-02-19 02:29:05 -06:00
|
|
|
|
|
|
|
.. code:: yaml
|
|
|
|
|
|
|
|
extends: default
|
|
|
|
|
|
|
|
rules:
|
|
|
|
# 80 chars should be enough, but don't fail if a line is longer
|
|
|
|
line-length:
|
|
|
|
max: 80
|
|
|
|
level: warning
|
|
|
|
|
|
|
|
# don't bother me with this rule
|
|
|
|
indentation: disable
|
2016-06-27 14:29:56 -05:00
|
|
|
|
|
|
|
Within a YAML file, special comments can be used to disable checks for a single
|
|
|
|
line:
|
|
|
|
|
|
|
|
.. code:: yaml
|
|
|
|
|
|
|
|
This line is waaaaaaaaaay too long # yamllint disable-line
|
|
|
|
|
|
|
|
or for a whole block:
|
|
|
|
|
|
|
|
.. code:: yaml
|
|
|
|
|
|
|
|
# yamllint disable rule:colons
|
|
|
|
- Lorem : ipsum
|
|
|
|
dolor : sit amet,
|
|
|
|
consectetur : adipiscing elit
|
|
|
|
# yamllint enable
|
|
|
|
|
2017-06-06 14:52:59 -05:00
|
|
|
Specific files can be ignored (totally or for some rules only) using a
|
|
|
|
``.gitignore``-style pattern:
|
|
|
|
|
|
|
|
.. code:: yaml
|
|
|
|
|
|
|
|
# For all rules
|
|
|
|
ignore: |
|
|
|
|
*.dont-lint-me.yaml
|
|
|
|
/bin/
|
|
|
|
!/bin/*.lint-me-anyway.yaml
|
|
|
|
|
|
|
|
rules:
|
|
|
|
key-duplicates:
|
|
|
|
ignore: |
|
|
|
|
generated
|
|
|
|
*.template.yaml
|
|
|
|
trailing-spaces:
|
|
|
|
ignore: |
|
|
|
|
*.ignore-trailing-spaces.yaml
|
|
|
|
/ascii-art/*
|
|
|
|
|
2016-09-21 02:13:35 -05:00
|
|
|
`Read more in the complete documentation! <https://yamllint.readthedocs.io/>`_
|
2016-06-27 14:30:14 -05:00
|
|
|
|
|
|
|
License
|
|
|
|
-------
|
|
|
|
|
|
|
|
`GPL version 3 <LICENSE>`_
|