Foodcritic / foodcritic

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

FC104 fires on directory and cookbook_file #700

Closed martinmosegaard closed 6 years ago

martinmosegaard commented 6 years ago

I have a CI pipeline that just does a gem install foodcritic and I just got foodcritic 12.2.0 with the FC104 rule.

But it fires on a recipe with contents like this:

directory my_dir do
  recursive true
  action :create
end 

...

cookbook_file my_file_path do
  source node['some_attribute']
  action :create
end

But action :run does not make sense for these resources. Is this a bug in the rule? Unfortunately, the pull request https://github.com/Foodcritic/foodcritic/pull/693 does not reference an issue, so it is hard to see the motivation for the new rule.

I may need to pin my foodcritic version.

tas50 commented 6 years ago

@martinmosegaard I just noticed that this was broken on my own. I've added a spec that's failing right now and I'm going to get things green in foodcritic then do another release. Expect something in the next hour or two.

tas50 commented 6 years ago

To clarify this should only be firing on ruby_blocks, but it's firing on all resources instead.

tas50 commented 6 years ago

12.2.1 fixes this. I'll make sure we get this one into ChefDK current as well

martinmosegaard commented 6 years ago

Thanks for the fast turnaround! I have verified the fix. :+1: