Class: RuboCop::RSpecRails::ConfigFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/rspec_rails/config_formatter.rb

Overview

Builds a YAML config file from two config hashes

Constant Summary collapse

EXTENSION_ROOT_DEPARTMENT =
%r{^(RSpecRails/)}.freeze
SUBDEPARTMENTS =
[].freeze
AMENDMENTS =
[].freeze
COP_DOC_BASE_URL =
'https://www.rubydoc.info/gems/rubocop-rspec_rails/RuboCop/Cop/'

Instance Method Summary collapse

Constructor Details

#initialize(config, descriptions) ⇒ ConfigFormatter

Returns a new instance of ConfigFormatter.



14
15
16
17
# File 'lib/rubocop/rspec_rails/config_formatter.rb', line 14

def initialize(config, descriptions)
  @config       = config
  @descriptions = descriptions
end

Instance Method Details

#dumpObject



19
20
21
22
23
24
# File 'lib/rubocop/rspec_rails/config_formatter.rb', line 19

def dump
  YAML.dump(unified_config)
    .gsub(EXTENSION_ROOT_DEPARTMENT, "\n\\1")
    .gsub(/^(\s+)- /, '\1  - ')
    .gsub('"~"', '~')
end