Skip to content

Check for multiple documents in YAML files

Steve Traylen requested to merge doubledocs into master

More than once folk very understandably get confused due to multiple documents in their yaml file.

e.g.

---
a: b
---
c: d

while that is completely legal YAML only the first document is ever loaded.

Make this throw an ERROR in CI:

straylen@aiadm86 ~/a/m/m/ci (doubledocs)> ruby extra-yaml-checks.rb.erb
~/ai-rake/hostgroup-ttaas/data/
ERROR:Multiple (>1) documents found in file "/home/straylen/ai-rake/hostgroup-ttaas/data/hostgroup/ttaas.yaml"
Found YAML errors.

I can't ever think of reason why this is useful and you ever want to do this.

Edited by Steve Traylen

Merge request reports