cvakiitho / yamllint

YAML Linter written in Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YAML Lint

Apache License, Version 2.0, January 2004 Maven Central Build Status Sonarcloud Status Sonarcloud Status

YAML lint written in Java. Its main purpose is to provide an API and scripts to analyze YAML documents. The YAML documents are syntactically checked as well as against rules. To get the list of rules, please refer to the classes of the com.github.sbaudoin.yamllint.rules package. Among other we have a rule to check the presence of the start and end YAML document marker, the correct and consistent indentation, etc.

API usage

Maven dependency:

<dependency>
    <groupId>com.github.sbaudoin</groupId>
    <artifactId>yamllint</artifactId>
    <version>1.2.0</version>
</dependency>

For use, please refer to the JavaDoc.

The class that will mostly interest you is com.github.sbaudoin.yamllint.Linter: it contains static methods that can be used to analyze a YAML string or a file.

3 errors levels have been defined: info, warning and error.

The linter can return only one syntax error per file (once a syntax error has been met we cannot expect a lot from the rest of the file with respect to the syntax). It is returned apart, not as part of the so called "cosmetic errors", that represent all other errors checked with specific rules.

Batch usage

Get the .zip or .tar.gz distribution archive, unpack and execute the script corresponding to your platform in the bin directory:

bin/yamllint [options] files/directories

or

bin\yamllint [options] files/directories

Warning! The Unix version requires Bash. There is no guaranty that the script will work with other Shell interpreters.

Use the --help (or -h) option to get help. By default, if the terminal supports it, the output is colorized and has the following output format:

file.yml
  line:column       level  message  (ruleId)
  ...

You can specify the -f parsable on the command line to get a parsable output as follows:

file.yml:line:column:ruleId:level:message

About

YAML Linter written in Java

License:Apache License 2.0


Languages

Language:Java 97.8%Language:Shell 0.8%Language:Roff 0.8%Language:Batchfile 0.6%