lib/rubocop/formatter/offense_count_formatter.rb in rubocop-1.26.1 vs lib/rubocop/formatter/offense_count_formatter.rb in rubocop-1.27.0

- old
+ new

@@ -15,10 +15,11 @@ attr_reader :offense_counts def started(target_files) super @offense_counts = Hash.new(0) + @style_guide_links = {} return unless output.tty? file_phrase = target_files.count == 1 ? 'file' : 'files' @@ -35,10 +36,13 @@ @progressbar.start end def file_finished(_file, offenses) offenses.each { |o| @offense_counts[o.cop_name] += 1 } + if options[:display_style_guide] + offenses.each { |o| @style_guide_links[o.cop_name] ||= o.message[/ \(http\S+\)\Z/] } + end @progressbar.increment if instance_variable_defined?(:@progressbar) end def finished(_inspected_files) report_summary(@offense_counts) @@ -50,11 +54,11 @@ total_count = total_offense_count(offense_counts) output.puts per_cop_counts.each do |cop_name, count| - output.puts "#{count.to_s.ljust(total_count.to_s.length + 2)}" \ - "#{cop_name}\n" + output.puts "#{count.to_s.ljust(total_count.to_s.length + 2)}#{cop_name}" \ + "#{@style_guide_links[cop_name]}\n" end output.puts '--' output.puts "#{total_count} Total" output.puts