brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: yamllint -d relaxed keeps the style nagging down on an existing file

Yaml
~/tips/tip-yamllint-relaxed-preset

yamllint -d relaxed docker-compose.yml

Switch yamllint to a more forgiving preset so real YAML errors stand out.

Run yamllint on an old YAML file and the report fills up with style complaints, which hides the real mistakes.

There is a second built-in configuration called relaxed. It is more tolerant than the default. Pick it with -d:

yamllint -d relaxed docker-compose.yml

For a file with an extra space after a colon, the default configuration reports an error and exits with 1, while relaxed only reports a warning and exits with 0.

You can also extend the preset and change one rule inline, with a YAML string:

yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" file.yaml

A caveat: a relaxed run is a way to find the real problems first, not a reason to leave the style alone forever. If a project has a .yamllint file, put your settings there so everyone uses the same rules.

Further reading: yamllint configuration

Going deeper: Guide: replace a cron job with a systemd timer, and see when it runs next

More Yaml tips yamllint -f parsable config.yaml iif(condition, if_true, if_false, if_none) Sensor is available Today_at() makes time-of-day checks in Home Assistant templates easy actions: All Yaml tips (10) All topics

Link