Foodcritic FC003

http://acrmp.github.com/foodcritic/

I was just looking at Foodcritic, and wondered about FC003…

Modified version
This modified example would not match the FC003 rule:

if Chef::Config[:solo]
  Chef::Log.warn("This recipe uses search. Chef Solo does not

support search.")
else
nodes = search(:node, “hostname:[* TO *] AND
chef_environment:#{node.chef_environment}”)
end

Would it not be better to wrap search() globally and emit that
Chef::Log.warn() each time that function is called inside a Solo run,
and not expect each recipe to do the above?

Cheers,
-Alex

That would also be nicer to users of the chef-solo search lib, and
particularly of LittleChef, which would be able to run the recipe
:wink:

2011/12/27 Alex Howells lists@howells.me:

http://acrmp.github.com/foodcritic/

I was just looking at Foodcritic, and wondered about FC003...

Modified version
This modified example would not match the FC003 rule:

if Chef::Config[:solo]
Chef::Log.warn("This recipe uses search. Chef Solo does not
support search.")
else
nodes = search(:node, "hostname:[* TO *] AND
chef_environment:#{node.chef_environment}")
end

Would it not be better to wrap search() globally and emit that
Chef::Log.warn() each time that function is called inside a Solo run,
and not expect each recipe to do the above?

Cheers,
-Alex

Do we have a ticket open to mainline one of those approaches?

Sent from my iPhone

On Dec 27, 2011, at 12:14 PM, Miquel Torres tobami@googlemail.com wrote:

That would also be nicer to users of the chef-solo search lib, and
particularly of LittleChef, which would be able to run the recipe
:wink:

2011/12/27 Alex Howells lists@howells.me:

http://acrmp.github.com/foodcritic/

I was just looking at Foodcritic, and wondered about FC003...

Modified version
This modified example would not match the FC003 rule:

if Chef::Config[:solo]
Chef::Log.warn("This recipe uses search. Chef Solo does not
support search.")
else
nodes = search(:node, "hostname:[* TO *] AND
chef_environment:#{node.chef_environment}")
end

Would it not be better to wrap search() globally and emit that
Chef::Log.warn() each time that function is called inside a Solo run,
and not expect each recipe to do the above?

Cheers,
-Alex