class RuboCop::Formatter::DisabledConfigFormatter
def output_exclude_list(output, offending_files, cop_name)
def output_exclude_list(output, offending_files, cop_name) require 'pathname' parent = Pathname.new(Dir.pwd) # Exclude properties in .rubocop_todo.yml override default ones, as well # as any custom excludes in .rubocop.yml, so in order to retain those # excludes we must copy them. # There can be multiple .rubocop.yml files in subdirectories, but we # just look at the current working directory config = ConfigStore.new.for(parent) cfg = config[cop_name] || {} excludes = ((cfg['Exclude'] || []) + offending_files).uniq output.puts ' Exclude:' excludes.each do |file| file_path = Pathname.new(file) begin relative = file_path.relative_path_from(parent) output.puts " - '#{relative}'" rescue ArgumentError output.puts " - '#{file}'" end end rescue LoadError # Fallback to Enabled: false for Ruby < 1.9.3 output.puts ' Enabled: false' end