yamllint
TLDR
Lint a YAML file
SYNOPSIS
yamllint [options] [fileordir ...]
DESCRIPTION
yamllint is a linter for YAML files that checks for syntax validity and style issues. Beyond basic syntax checking, it detects problems like duplicate keys, line length violations, trailing spaces, indentation inconsistencies, and truthy value ambiguities.
Configuration is loaded from .yamllint, .yamllint.yaml, or .yamllint.yml in the current or parent directories, $YAMLLINT_CONFIG_FILE, or ~/.config/yamllint/config.
The tool provides multiple output formats suitable for different use cases: human-readable, editor integration, and CI systems (GitHub Actions, GitLab CI).
PARAMETERS
-c, --config-file file
Use specified configuration file.-d, --config-data data
Configuration as YAML string or preset name (default, relaxed).-f, --format format
Output format: standard, parsable, github, gitlab, colored, auto.-s, --strict
Return non-zero exit code on warnings (not just errors).--no-warnings
Suppress warning messages in output.--list-files
List files that would be processed without linting.-v, --version
Display version and exit.-h, --help
Display help message and exit.
CAVEATS
yamllint validates YAML syntax and style but does not validate against schemas. For schema validation, use tools like ajv or language-specific validators. By default, only errors cause non-zero exit; use -s for strict mode where warnings also fail.
HISTORY
yamllint was created by Adrien Vergé and first released in 2016. It was developed to address the need for a comprehensive YAML linter that checks both syntax and style issues. Written in Python, it has become a standard tool in CI/CD pipelines for validating configuration files, Ansible playbooks, Kubernetes manifests, and other YAML-based infrastructure code.
SEE ALSO
yq(1), jsonlint(1), ansible-lint(1)


