FC022 block name check appears to be too simplistic #29

Closed
eherot opened this Issue May 9, 2012 · 5 comments

2 participants

@eherot

This code block triggers FC022:

deleted_users.each do |user_to_delete|

  user user_to_delete do
    action :remove
    only_if "/usr/bin/id #{user_to_delete} > /dev/null"
    supports :manage_home => true
  end

end

Even though ti appears to be correct. This one does not:

deleted_users.each do |user_to_delete|

  user "#{user_to_delete}" do
    action :remove
    only_if "/usr/bin/id #{user_to_delete} > /dev/null"
    supports :manage_home => true
  end

end

(although it does trigger FC002, as expected).

@acrmp
Owner

Hi Eric,

Thanks for reporting this and taking the time to give clear examples.

I'm suffering the effects of a cold at the moment but will look into this on the weekend.

Cheers,

Andrew.

@eherot

No worries! I'm at ChefConf this week anyway (Many lovers of Foodcritic here). But thanks for being such a loyal maintainer!

@acrmp
Owner

Thanks for contributing! The community around Chef is seriously awesome.

@acrmp acrmp added a commit that referenced this issue May 21, 2012
@acrmp FC022: Don't match name == block var, refs #29.
Rule previously matched incorrectly when the block var was given by itself as
the name of the resource.
254eeab
@acrmp
Owner

A fix for this has been released in 1.3.0. Please let me know if this resolves the issue for you.

@acrmp
Owner

Hi Eric,

Closing this one as resolved. Please let me know if it's still an issue and we'll re-open.

Cheers,

Andrew.

@acrmp acrmp closed this Jun 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment