houndci / hound

Automated code review for GitHub pull requests.
https://houndci.com
MIT License
1.95k stars 402 forks source link

Linter for YAML #1545

Open ad-m opened 6 years ago

ad-m commented 6 years ago

There is a built-in YAML parser in Ruby. So in the first step, you just need to verify the syntax of whether there is a problem with loading and reporting it.

gylaz commented 6 years ago

Is there a particular styleguide for YAML files? Isn't the usage of the YAML file enough to tell if it's valid or invalid? Or is this useful if a repo has a bunch of arbitrary YAML files, to make sure they are all valid? I'm just trying to understand the use-case, and see how useful a linter like this might be.

ad-m commented 6 years ago

I believe that verification whether YAML files are correct at all is useful.

The YAML files are used, among others in Ansible, which is used to describe server configurations, even large clusters. Running and testing the correctness of cluster configuration is difficult, due cost of spinning up VM & maintaing VM cluster. However, even the smallest test can be helpful to protect for basic mistakes for example in indentation.

Now I use yamllint for that. It validate a many rules ( https://yamllint.readthedocs.io/en/stable/rules.html ). Most of them are very useful and prevents of mistakes with very low effort of maintain that. I think it would not be too difficult to integrate yamllint and open HoundCI to a new group of users. Ansible has 30,684 stars on GitHub (9th most starred Python application at at GitHub)

gylaz commented 6 years ago

Okay, sounds like it would be good to add this linter. We'll get this into our development pipeline.