lib/rubocop/rspec/config_formatter.rb in rubocop-rspec-2.0.0.pre vs lib/rubocop/rspec/config_formatter.rb in rubocop-rspec-2.0.0
- old
+ new
@@ -4,20 +4,20 @@
module RuboCop
module RSpec
# Builds a YAML config file from two config hashes
class ConfigFormatter
- NAMESPACES = /^(RSpec|Capybara|FactoryBot|Rails)/.freeze
+ EXTENSION_ROOT_DEPARTMENT = %r{^(RSpec/)}.freeze
STYLE_GUIDE_BASE_URL = 'https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/'
def initialize(config, descriptions)
@config = config
@descriptions = descriptions
end
def dump
- YAML.dump(unified_config).gsub(NAMESPACES, "\n\\1")
+ YAML.dump(unified_config).gsub(EXTENSION_ROOT_DEPARTMENT, "\n\\1")
end
private
def unified_config
@@ -27,10 +27,10 @@
.merge('StyleGuide' => STYLE_GUIDE_BASE_URL + cop.sub('RSpec/', ''))
end
end
def cops
- (descriptions.keys | config.keys).grep(NAMESPACES)
+ (descriptions.keys | config.keys).grep(EXTENSION_ROOT_DEPARTMENT)
end
attr_reader :config, :descriptions
end
end