Closed NaomiReeves closed 5 years ago
This might be a hard thing to do because path(lazy do ... end)
is allowable syntax. It would depend on how much context info we get from Ripper.
The deeper thing to check for probably is lazy
called without a block.
yeah that's what dan suggested in CHEF-4595
@lamont-granquist someone should move that bug from Jira to GH so it actually gets noticed and fixed.
Moved this over to Cookstyle. I already shipped the first guard check there that has detected a good number of bad guards that Foodcritic missed. This seems like it wouldn't be too hard to add there.
We should alert users if they have given lazy
do ... end
instead of using{ ... }
. Using ado .. end
will result in a chef run failing with:ArgumentError: tried to create Proc object without a block
which seems to contradict normal block syntax, unless you are familiar with Ruby precedence.from Ruby:
correct:
will fail:
Reported originally in https://tickets.opscode.com/browse/CHEF-4595