yamllint/README.rst

128 lines
2.5 KiB
ReStructuredText
Raw Normal View History

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
: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
:alt: Code coverage status
.. image:: https://readthedocs.org/projects/yamllint/badge/?version=latest
:target: http://yamllint.readthedocs.org/en/latest/?badge=latest
:alt: Documentation status
2016-01-21 15:45:19 -06:00
Written in Python (compatible with Python 2 & 3).
2016-01-21 15:45:19 -06:00
Documentation
-------------
2016-06-27 14:29:56 -05:00
http://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
^^^^^^^^^^^^
On Fedora / CentOS:
.. code:: bash
sudo dnf install yamllint
On Debian 9+ / Ubuntu 16.04+:
.. code:: bash
sudo apt-get install yamllint
Alternatively using pip, the Python package manager:
2016-01-21 15:45:19 -06:00
.. code:: bash
sudo pip install 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
# Use a pre-defined lint configuration
yamllint -d relaxed file.yaml
2016-01-21 15:45:19 -06:00
# Use a custom lint configuration
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...)
yamllint -f parsable file.yaml
2016-06-27 14:29:56 -05:00
`Read more in the complete documentation! <http://yamllint.readthedocs.io/>`_
Features
^^^^^^^^
Here is a yamllint configuration file example:
.. 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
`Read more in the complete documentation! <http://yamllint.readthedocs.io/>`_
License
-------
`GPL version 3 <LICENSE>`_