yamllint/README.rst

141 lines
2.9 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: https://yamllint.readthedocs.io/en/latest/?badge=latest
:alt: Documentation status
2016-01-21 15:45:19 -06:00
Written in Python (compatible with Python 3 only).
2016-01-21 15:45:19 -06:00
Documentation
-------------
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
^^^^^^^^^^^^
Using pip, the Python package manager:
2016-01-21 15:45:19 -06:00
.. code:: bash
pip install --user yamllint
2016-01-21 15:45:19 -06:00
yamllint is also packaged for all major operating systems, see installation
examples (``dnf``, ``apt-get``...) `in the documentation
<https://yamllint.readthedocs.io/en/stable/quickstart.html>`_.
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
2022-06-06 13:48:10 -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:
.. 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
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/*
2022-06-06 13:48:10 -05:00
`Read more in the complete documentation! <https://yamllint.readthedocs.io/>`__
License
-------
`GPL version 3 <LICENSE>`_