Skip to content


Subversion checkout URL

You can clone with
Download ZIP


ETSY005 AST Corner Cases #3

joewilliams opened this Issue · 2 comments

3 participants


This rule does not seem to detect that the following two notification lines are effectively the same thing:

notifies(:restart, resources(:service => "riak"))

notifies :restart, resources(:service => "riak")

The latter is detected by the rule, the former is not.

Additionally something like the following is not detected:

notifies :restart, "service[openvpn]"

Additionally if the service name happens to be a variable it won't detect it, example:

notifies :restart, resources(:service => riak)


Hi guys,

Just to put my 2p in. If you are using foodcritic 1.4.0+ this rule should be able to be rephrased as:

find_resources(ast).select do |resource|
  notifications(resource).any? do |notification|
    @coreservices.include?(notification[:resource_name]) and
      notification[:action] == :restart

While it's more readable the notifications method also fails to catch your first example. We should fix that.

It will match the third example using new-style notifications though. In general foodcritic rules won't resolve variable values as foodcritic is performing static analysis.



@acrmp acrmp referenced this issue from a commit in acrmp/foodcritic
@acrmp acrmp Match notifications with parentheses. f4e58a1

Closing, changed ETSY005 to @acrmp's suggestion

@jonlives jonlives closed this
@ruizink ruizink referenced this issue from a commit in ruizink/etsy-foodcritic-rules
Mário Santos Fix issue #3 by creating a new Nokogiri::XML before doing xpath query. 235784e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.