Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions lib/rubocop/cop/rspec/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def self.inherited(subclass) # rubocop:disable Lint/MissingSuper
RuboCop::Cop::Base.inherited(subclass)
end

class << self
attr_accessor :rspec_pattern
end

def relevant_file?(file)
relevant_rubocop_rspec_file?(file) && super
end
Expand All @@ -47,11 +51,14 @@ def relevant_rubocop_rspec_file?(file)
end

def rspec_pattern
if rspec_pattern_config?
Regexp.union(rspec_pattern_config.map(&Regexp.public_method(:new)))
else
DEFAULT_PATTERN_RE
end
self.class.rspec_pattern ||=
if rspec_pattern_config?
Regexp.union(
rspec_pattern_config.map(&Regexp.public_method(:new))
)
else
DEFAULT_PATTERN_RE
end
end

def all_cops_config
Expand Down