Foodcritic / foodcritic

Lint tool for Chef cookbooks.
http://foodcritic.io
MIT License
408 stars 153 forks source link

Create a rule to check for non-String name_properties without a coerce #744

Closed tas50 closed 5 years ago

tas50 commented 6 years ago

Chef will pass a string to the name property so unless there's a coerce these aren't going to work the way you think it will. Here's the scenario I ran into

property :feature_name, [String, Array], name_property: true
windows_feature_powershell %w(feature1 feature2)

Even thought we pass in an array as the resource name it gets coerced to a comma separated string by Chef in the actual "name" property. Then when it gets passed onto feature_name it's also a string. If you're expectation was that you could accept arrays then that isn't the case.

tas50 commented 5 years ago

Closing this in favor of the above linked Cookstyle issue.