Class: Brut::RubocopConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/brut/rubocop_config.rb

Instance Method Summary collapse

Instance Method Details

#create_ridiculous_yamlObject



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/brut/rubocop_config.rb', line 96

def create_ridiculous_yaml
  if !ARGV[0]
    raise "You must supply the file where the config will be written"
  end
  filename = Pathname(ARGV[0])
  my_big_yaml_hash_of_doom = {}.merge(PREAMBLE)
  IM_NOT_CALLING_THEM_COPS.each do |not_a_cop, config|
    body = case config
           when Hash
             config
           when Array
             config
           when true
             {}
           else
             raise "#{config.class}/#{config} is not handled by this contraption"
           end
    body["Enabled"] = true
    my_big_yaml_hash_of_doom[not_a_cop] = body
  end
  File.open(filename,"w") do |file|
    file.puts "# This file is generated! DO NOT EDIT (not that you'd want to - it's YAML!)"
    file.puts "# The configuration is canonically stored in lib/brut/rubocop_config.rb"
    file.puts my_big_yaml_hash_of_doom.to_yaml
  end
end