Lint and Cleanup
YAML Lint Error Guide
Fix YAML lint errors caused by indentation, list nesting, tabs, duplicate keys and confusing scalar values in config files. This reference is written for developers who need practical validation behavior, reviewable rules and safe examples rather than copied snippets with no explanation.
Recommended workflow
| Step | Why it matters |
|---|---|
| Look at indentation | Most YAML failures start with a list item or map key aligned one level too far. |
| Remove tabs | Tabs are hard to see and many parsers reject them. |
| Check duplicate keys | Some parsers silently keep the last value, which makes reviews dangerous. |
| Retest with the app | YAML can be syntactically valid while still wrong for Docker, CI or Kubernetes. |
Starter snippet
yamllint config.yml
# Fix indentation before changing application settings.Review checks
- Use spaces consistently.
- Quote values that look like booleans, dates or version numbers when meaning matters.
- Keep environment secrets out of public examples.
- Validate with the target platform after generic linting.
Common mistakes
- Changing indentation and semantic values in the same edit.
- Trusting a formatter to understand product-specific schema rules.
- Copying production secrets into troubleshooting samples.
Validation should help users correct input while protecting systems from bad data. Keep syntax checks, product policy, security review and deliverability checks separate.
Related Formalint references
Continue with Yaml Lint Checklist, Yaml Indentation, Yaml Docker Compose Guide.