Sha256: 06c0797adf4ef60c02501fabf7872c54cb3bcef914117f7bf1b741b3b60b295a

Contents?: true

Size: 967 Bytes

Versions: 18

Compression:

Stored size: 967 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Report
    # Creates a Report object, based on the current settings
    #
    # @param [String] the filename for the report
    # @return [Report] a report object
    def create(file, output_mode = :default)
      case output_mode
      when :default     then PlainText.new(file)
      when :emacs_style then EmacsStyle.new(file)
      end
    end

    module_function :create

    class Report
      attr_reader :filename

      # @param [String] the filename for this report
      def initialize(filename)
        @filename = filename
        @entries = []
      end

      # Appends offences registered by cops to the report.
      # @param [Cop] a cop with something to report
      def <<(cop)
        cop.offences.each do |entry|
          @entries << entry
        end
      end

      def entries
        @entries.sort_by(&:line_number)
      end

      def empty?
        entries.empty?
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rubocop-0.8.3 lib/rubocop/report/report.rb
rubocop-0.8.2 lib/rubocop/report/report.rb
rubocop-0.8.1 lib/rubocop/report/report.rb
rubocop-0.8.0 lib/rubocop/report/report.rb
rubocop-0.7.2 lib/rubocop/report/report.rb
rubocop-0.7.1 lib/rubocop/report/report.rb
rubocop-0.7.0 lib/rubocop/report/report.rb
rubocop-0.6.1 lib/rubocop/report/report.rb
rubocop-0.6.0 lib/rubocop/report/report.rb
rubocop-0.5.0 lib/rubocop/report/report.rb
rubocop-0.4.6 lib/rubocop/report/report.rb
rubocop-0.4.5 lib/rubocop/report/report.rb
rubocop-0.4.4 lib/rubocop/report/report.rb
rubocop-0.4.3 lib/rubocop/report/report.rb
rubocop-0.4.2 lib/rubocop/report/report.rb
rubocop-0.4.1 lib/rubocop/report/report.rb
rubocop-0.4.0 lib/rubocop/report/report.rb
rubocop-0.3.2 lib/rubocop/report/report.rb