lib/rubocop/rspec/description_extractor.rb in rubocop-rspec-1.39.0 vs lib/rubocop/rspec/description_extractor.rb in rubocop-rspec-1.40.0
- old
+ new
@@ -19,11 +19,11 @@
attr_reader :code_objects
# Decorator of a YARD code object for working with documented rspec cops
class CodeObject
- COP_CLASS_NAMES = %w[RuboCop::Cop RuboCop::Cop::RSpec::Cop].freeze
+ COP_CLASS_NAME = 'RuboCop::Cop::RSpec::Cop'
RSPEC_NAMESPACE = 'RuboCop::Cop::RSpec'
def initialize(yardoc)
@yardoc = yardoc
end
@@ -66,14 +66,10 @@
def documented_constant
yardoc.to_s
end
def cop_subclass?
- # YARD superclass resolution is a bit flaky: All classes loaded before
- # RuboCop::Cop::WorkaroundCop are shown as having RuboCop::Cop as
- # superclass, while all the following classes are listed as having
- # RuboCop::Cop::RSpec::Cop as their superclass.
- COP_CLASS_NAMES.include?(yardoc.superclass.path)
+ yardoc.superclass.path == COP_CLASS_NAME
end
def abstract?
yardoc.tags.any? { |tag| tag.tag_name.eql?('abstract') }
end