lib/rubocop/cop/style/class_equality_comparison.rb in rubocop-1.56.4 vs lib/rubocop/cop/style/class_equality_comparison.rb in rubocop-1.57.0
- old
+ new
@@ -6,9 +6,14 @@
# Enforces the use of `Object#instance_of?` instead of class comparison
# for equality.
# `==`, `equal?`, and `eql?` custom method definitions are allowed by default.
# These are customizable with `AllowedMethods` option.
#
+ # @safety
+ # This cop's autocorrection is unsafe because there is no guarantee that
+ # the constant `Foo` exists when autocorrecting `var.class.name == 'Foo'` to
+ # `var.instance_of?(Foo)`.
+ #
# @example
# # bad
# var.class == Date
# var.class.equal?(Date)
# var.class.eql?(Date)