Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

FC037 false positive for subscribes #65

Closed
jtimberman opened this Issue Aug 29, 2012 · 5 comments

Comments

Projects
None yet
2 participants
Contributor

jtimberman commented Aug 29, 2012

When a resource has a subscribes notification, foodcritic will match the action incorrectly.

For example:

bash "extract_geolib" do
  code <<-EOH
  # imagine if you would, some code
  EOH
  subscribes :run, resources(:remote_file => geolib_filepath)
end

The recipe has a valid remote_file[#{geolib_filepath}] resource. Foodcritic reports:

% noglob foodcritic -t FC037 -C .                   
recipes/http_geoip_module.rb
FC037: Invalid notification action
  37|end
  38|
  39|bash "extract_geolib" do
  40|  code <<-EOH
Owner

acrmp commented Aug 29, 2012

Hi Joshua,

Thanks for raising this. I've committed 4261f8b that should fix this glaring bug.

Can you test against master and see if this is still an issue?

Cheers,

Andrew.

Contributor

jtimberman commented Aug 29, 2012

This works for my use case. Thanks for the quick turnaround.

When I built the gem from my master branch I didn't have "chef_dsl_metadata.json" - where does that come from? I copied it from an existing foodcritic install so all was fine.

Owner

acrmp commented Aug 29, 2012

The metadata json is generated by a rake file task. You can run the following command to to generate it (assuming it doesn't already exist):

$ bundle exec rake chef_dsl_metadata.json

It's also included in the rake default task list.

Contributor

jtimberman commented Aug 29, 2012

Great. Thanks!

:shipit:

Owner

acrmp commented Aug 30, 2012

Hi Joshua,

This has now been released in 1.6.1.

Cheers,

Andrew.

🚢

@acrmp acrmp closed this Aug 30, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment