lib/rubocop/cop/lint/useless_assignment.rb in rubocop-0.46.0 vs lib/rubocop/cop/lint/useless_assignment.rb in rubocop-0.47.0
- old
+ new
@@ -10,9 +10,27 @@
# assigned but unused variable - foo
#
# Currently this cop has advanced logic that detects unreferenced
# reassignments and properly handles varied cases such as branch, loop,
# rescue, ensure, etc.
+ #
+ # @example
+ #
+ # # bad
+ #
+ # def some_method
+ # some_var = 1
+ # do_something
+ # end
+ #
+ # @example
+ #
+ # # good
+ #
+ # def some_method
+ # some_var = 1
+ # do_something(some_var)
+ # end
class UselessAssignment < Cop
include NameSimilarity
MSG = 'Useless assignment to variable - `%s`.'.freeze
def join_force?(force_class)