Program to lint YAML files? -


so team working on application uses lot of yaml , need enforce rules common formatting. best command-line program can plug our ci.

most importantly, want force 2-space indentation , indentation of lists, this:

list: - not indented - not indented            # bad  list:   - indented   - indented              #  mapping:      5 space indentation  # bad 

also great preventing trailing spaces , non-sense syntaxes.

i've found websites check yaml validity (i.e. whether it's possible load or not) -- no linting. same yaml-lint, ruby app "checks if yaml files can loaded".

is there linter yaml, similar flake8 python or eslint javascript?

you're looking yamllint. in ci:

sudo pip install yamllint yamllint file1.yml ... 

it's highly configurable. specifically, 2-space indents , forcing list indentation, conf be:

rules:   indentation: {spaces: 2, indent-sequences: yes} 

(it handles trailing spaces, line-length etc.)

have fun!


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -