Sha256: eae4e06ca6d136fff8309c503f64ab8e8c2bfd217ce4d9855a2c9ffc7048f4b7

Contents?: true

Size: 929 Bytes

Versions: 5

Compression:

Stored size: 929 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_accessor :entries
      attr_accessor :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 empty?
        entries.empty?
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-0.3.1 lib/rubocop/report/report.rb
rubocop-0.3.0 lib/rubocop/report/report.rb
rubocop-0.2.1 lib/rubocop/report/report.rb
rubocop-0.2.0 lib/rubocop/report/report.rb
rubocop-0.1.0 lib/rubocop/report/report.rb