lib/rubocop/rspec/config_formatter.rb in rubocop-rspec-2.12.1 vs lib/rubocop/rspec/config_formatter.rb in rubocop-rspec-2.13.0

- old
+ new

@@ -19,25 +19,36 @@ def dump YAML.dump(unified_config) .gsub(EXTENSION_ROOT_DEPARTMENT, "\n\\1") .gsub(*AMENDMENTS, "\n\\0") .gsub(/^(\s+)- /, '\1 - ') + .gsub('"~"', '~') end private def unified_config cops.each_with_object(config.dup) do |cop, unified| - next if SUBDEPARTMENTS.include?(cop) - next if AMENDMENTS.include?(cop) + next if SUBDEPARTMENTS.include?(cop) || AMENDMENTS.include?(cop) + replace_nil(unified[cop]) unified[cop].merge!(descriptions.fetch(cop)) - unified[cop]['Reference'] = COP_DOC_BASE_URL + cop.sub('RSpec/', '') + unified[cop]['Reference'] = reference(cop) end end def cops (descriptions.keys | config.keys).grep(EXTENSION_ROOT_DEPARTMENT) + end + + def replace_nil(config) + config.each do |key, value| + config[key] = '~' if value.nil? + end + end + + def reference(cop) + COP_DOC_BASE_URL + cop.sub('RSpec/', '') end attr_reader :config, :descriptions end end