Sha256: 59807edbbad37b59195711b57b95541f1c1eb1f62b56a62ff279ed5c07ecc4c9

Contents?: true

Size: 1.55 KB

Versions: 6970

Compression:

Stored size: 1.55 KB

Contents

# frozen_string_literal: true

module RuboCop
  module Formatter
    # This formatter display dots for files with no offenses and
    # letters for files with problems in the them. In the end it
    # appends the regular report data in the clang style format.
    class ProgressFormatter < ClangStyleFormatter
      include TextUtil

      DOT = '.'.freeze

      def initialize(output, options = {})
        super
        @dot = green(DOT)
      end

      def started(target_files)
        super
        @offenses_for_files = {}
        output.puts "Inspecting #{pluralize(target_files.size, 'file')}"
      end

      def file_finished(file, offenses)
        unless offenses.empty?
          count_stats(offenses)
          @offenses_for_files[file] = offenses
        end

        report_file_as_mark(offenses)
      end

      def finished(inspected_files)
        output.puts

        unless @offenses_for_files.empty?
          output.puts
          output.puts 'Offenses:'
          output.puts

          @offenses_for_files.each do |file, offenses|
            report_file(file, offenses)
          end
        end

        report_summary(inspected_files.size,
                       @total_offense_count,
                       @total_correction_count)
      end

      def report_file_as_mark(offenses)
        mark = if offenses.empty?
                 @dot
               else
                 highest_offense = offenses.max_by(&:severity)
                 colored_severity_code(highest_offense)
               end

        output.write mark
      end
    end
  end
end

Version data entries

6,970 entries across 6,964 versions & 27 rubygems

Version Path
cybrid_api_bank_ruby-0.123.234 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_id_ruby-0.123.234 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_organization_ruby-0.123.234 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_id_ruby-0.123.233 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_bank_ruby-0.123.233 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_organization_ruby-0.123.233 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
ory-client-1.16.7 vendor/bundle/ruby/3.1.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_bank_ruby-0.123.231 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_organization_ruby-0.123.231 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_id_ruby-0.123.231 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_bank_ruby-0.123.230 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_organization_ruby-0.123.230 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_id_ruby-0.123.230 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_bank_ruby-0.123.229 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_id_ruby-0.123.229 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_organization_ruby-0.123.229 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_bank_ruby-0.123.228 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_id_ruby-0.123.228 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_organization_ruby-0.123.228 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb
cybrid_api_bank_ruby-0.123.227 vendor/bundle/ruby/3.3.0/gems/rubocop-0.66.0/lib/rubocop/formatter/progress_formatter.rb