lib/fasterer/scanners/method_definition_scanner.rb in fasterer-0.2.0 vs lib/fasterer/scanners/method_definition_scanner.rb in fasterer-0.2.1
- old
+ new
@@ -29,12 +29,12 @@
next unless element.sexp_type == :call
method_call = MethodCall.new(element)
if method_call.receiver.is_a?(Fasterer::VariableReference) &&
- method_call.receiver.name == method_definition.block_argument_name &&
- method_call.method_name == :call
+ method_call.receiver.name == method_definition.block_argument_name &&
+ method_call.method_name == :call
add_offense(:proc_call_vs_yield) && return
end
end
end
@@ -61,26 +61,24 @@
first_argument = method_definition.arguments.first
return if first_argument.type != :regular_argument
if method_definition.body.first.sexp_type == :iasgn &&
- method_definition.body.first[1].to_s == "@#{method_definition.name.to_s[0..-2]}" &&
- method_definition.body.first[2][1] == first_argument.name
+ method_definition.body.first[1].to_s == "@#{method_definition.name.to_s[0..-2]}" &&
+ method_definition.body.first[2][1] == first_argument.name
add_offense(:setter_vs_attr_writer)
end
end
def scan_getter_offense
return if method_definition.arguments.size > 0
return if method_definition.body.size != 1
if method_definition.body.first.sexp_type == :ivar &&
- method_definition.body.first[1].to_s == "@#{method_definition.name}"
+ method_definition.body.first[1].to_s == "@#{method_definition.name}"
add_offense(:getter_vs_attr_reader)
end
end
-
end
-
end