Skip to content
This repository has been archived by the owner on Sep 19, 2020. It is now read-only.

FC001, FC019 shouldn't match on node.run_state #66

Closed
jtimberman opened this issue Aug 29, 2012 · 4 comments
Closed

FC001, FC019 shouldn't match on node.run_state #66

jtimberman opened this issue Aug 29, 2012 · 4 comments
Labels

Comments

@jtimberman
Copy link

node.run_state doesn't contain node attributes, and is a Hash, and doesn't allow for arbitrary switching between strings or symbols.

It does have uses inside cookbooks, such as for tracking transient data used by the node between recipes, for example in Opscode's nginx::source recipe and modules that should be compiled.

node.run_state[:nginx_configure_flags] =
  node.run_state[:nginx_configure_flags] | ["--add-module=#{node["nginx"]["passenger"]["root"]}/ext/nginx"]

Match results, e.g.:

FC001: Use strings in preference to symbols to access node attributes
  48|end
  49|
  50|node.run_state[:nginx_configure_flags] =
FC001: Use strings in preference to symbols to access node attributes
  51|  node.run_state[:nginx_configure_flags] | ["--add-module=#{node["nginx"]["passenger"]["root"]}/ext/nginx"]
@acrmp
Copy link
Member

acrmp commented Jul 24, 2013

Hi Joshua,

I've pushed a change that should fix this for FC019. Can you test against master and see if this resolves the issue?

Thanks,

Andrew.

@jtimberman
Copy link
Author

👍 - works for me. :)

@acrmp
Copy link
Member

acrmp commented Jul 29, 2013

Thanks for testing!

@acrmp acrmp closed this as completed Jul 29, 2013
@don-code
Copy link

I'm still seeing an FC001 in the most recent Foodcritic (8.1.0). It is minimally reproducible with:

node.run_state[:something] = 'blah'

Since it looks like this was originally fixed for only FC019, I'd suggest reopening.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants