My yamllint configuration.
---
title: yamllint
subtitle: A linter for YAML files.
author: Jon LaBelle
date: May 21, 2024
source: https://yamllint.readthedocs.io/en/latest/index.html
snippet: https://jonlabelle.com/snippets/view/markdown/yamllint
notoc: false
---
## Install yamllint on Windows
1. Install yamllint using pip:
```console
pip install --user yamllint
```
> Installs to: `C:\Users\%USERNAME%\AppData\Roaming\Python\Python37\Scripts`
2. Add `C:\Users\%USERNAME%\AppData\Roaming\Python\Python37\Scripts` to User environment `PATH`.
### Config file
- Environment variable: `YAMLLINT_CONFIG_FILE` > `C:\Users\%USERNAME%\.yamllint.yml`
> <https://yamllint.readthedocs.io/en/stable/configuration.html>
## My yamllint config
```yaml
extends: default
# yamllint rules config
# https://yamllint.readthedocs.io/en/stable/configuration.html
rules:
# line-length
# https://yamllint.readthedocs.io/en/latest/rules.html#module-yamllint.rules.line_length
line-length:
max: 180
level: warning
# document-start
# https://yamllint.readthedocs.io/en/latest/rules.html#module-yamllint.rules.document_start
document-start:
present: false
# comments
# https://yamllint.readthedocs.io/en/latest/rules.html#module-yamllint.rules.comments
comments:
require-starting-space: false
min-spaces-from-content: 1
# truthy
# https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.truthy
truthy:
check-keys: false
```