This repository has been archived by the owner on Sep 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 153
resource_attribute(cmd, 'foo') does not return blocks #23
Comments
Hi Jon, So I think the call here after our chat on IRC the other day was what to return in the case of attributes that have block values. Does just returning the portion of the AST for the attribute value work for you? Cheers, Andrew. |
I think that should be fine - in the specific case we discussed the other day all I'm interested in finding out is if there's a conditional full stop (and block conditionals being returned). Having the AST of the attribute value should be totally sufficient for more in depth checking I'd say. |
Great - thank you sir. |
acrmp
pushed a commit
that referenced
this issue
Apr 21, 2012
Hi Jon, This change has now been released in foodcritic 1.2.0. Thanks, Andrew. |
Closing this one, let me know if it's still an issue and I'll re-open. Cheers, Andrew. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
resource_attribute(cmd, 'foo) returns nil when the attribute's value is a block not a literal.
ie, using
not_if "test -e /home/auto/.rvm/bin/rvm"
we get:
[2] pry(#FoodCritic::RuleDsl)> resource_attribute(cmd, 'not_if')
=> "test -e /home/auto/.rvm/bin/rvm"
but with
only_if {!File.exists?(foo) || (File.exists?(bar) && File.mtime(baz) < last_changedate)}
we get
[2] pry(#FoodCritic::RuleDsl)> resource_attribute(cmd, 'only_if')
=> nil
The text was updated successfully, but these errors were encountered: