lib/rubocop/cop/lint/useless_setter_call.rb in rubocop-0.46.0 vs lib/rubocop/cop/lint/useless_setter_call.rb in rubocop-0.47.0
- old
+ new
@@ -6,13 +6,25 @@
# This cop checks for setter call to local variable as the final
# expression of a function definition.
#
# @example
#
- # def something
- # x = Something.new
- # x.attr = 5
- # end
+ # # bad
+ #
+ # def something
+ # x = Something.new
+ # x.attr = 5
+ # end
+ #
+ # @example
+ #
+ # # good
+ #
+ # def something
+ # x = Something.new
+ # x.attr = 5
+ # x
+ # end
class UselessSetterCall < Cop
include OnMethodDef
MSG = 'Useless setter call to local variable `%s`.'.freeze
ASSIGNMENT_TYPES = [:lvasgn, :ivasgn, :cvasgn, :gvasgn].freeze