This repository has been archived by the owner. It is now read-only.
Browse files

Empty receivers when validating methods.

When extracting the receiver constant of a method call the scope to use for
this lookup should not be set to a nil value.

This commit fixes #5.

Signed-off-by: Yorick Peterse <>
  • Loading branch information...
1 parent 0aa4df2 commit 084ec5efc1c19f2d31f98482d19cce9b53d562e9 @YorickPeterse committed Nov 15, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/ruby-lint/analyze/method_validation.rb
@@ -66,7 +66,7 @@ def on_method(token)
# Extract the class from a method call.
if value.respond_to?(:receiver)
- while value.respond_to?(:receiver)
+ while value.respond_to?(:receiver) and !value.receiver.nil?

atombender Nov 15, 2012

Out of curiosity, why not write that as ... and value.receiver? (There is no semantic or performance difference as far as I know.)


YorickPeterse Nov 16, 2012


Habit mostly, but you're right that just and value.receiver is shorter and a bit easier to read.

value = value.receiver

0 comments on commit 084ec5e

Please sign in to comment.