rodjek / puppet-lint

Check that your Puppet manifests conform to the style guide
MIT License
819 stars 204 forks source link

Add a check for a missing trailing comma #894

Open natemccurdy opened 5 years ago

natemccurdy commented 5 years ago

There was a previous issue that requested adding the ability to check for missing trailing commas: #237. That was closed because the Puppet Style Guide, at the time, didn't enforce this style.

A trailing comma is now specifically called out in the style guide: https://puppet.com/docs/puppet/latest/style_guide.html#spacing-indentation-and-whitespace

Must include trailing commas after all resource attributes and parameter definitions.

As puppet-lint is the primary tool used to enforce the source-of-truth for Puppet Style decisions, I think that puppet-lint should check for missing trailing commas out of the box.

A gem for this already exists, but if a user doesn't know about it, they won't get the required style check. https://github.com/voxpupuli/puppet-lint-trailing_comma-check


Note that this was brought up in the PDK office hours in the Puppet Community slack because out of the box, the PDK does not check for missing trailing commas. While the voxpopuli gem could be added to the default gemset of the PDK, it's probably better to just integrate this check into puppet-lint itself so everyone can benefit without any extra work.