Sha256: 875185933fc043b9c3a1ad5b7b40474df1bc33c3df388eb37dbb6b8fe4c4d984

Contents?: true

Size: 811 Bytes

Versions: 2

Compression:

Stored size: 811 Bytes

Contents

module SlimLint
  # Abstract lint reporter. Subclass and override {#report_lints} to
  # implement a custom lint reporter.
  #
  # @abstract
  class Reporter
    attr_reader :lints
    attr_reader :files

    # @param logger [SlimLint::Logger]
    # @param report [SlimLint::Report]
    def initialize(logger, report)
      @log = logger
      @lints = report.lints
      @files = report.files
    end

    # Implemented by subclasses to display lints from a {SlimLint::Report}.
    def report_lints
      raise NotImplementedError
    end

    # Keep tracking all the descendants of this class for the list of available reporters
    def self.descendants
      @descendants ||= []
    end

    def self.inherited(descendant)
      descendants << descendant
    end

    private

    attr_reader :log
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slim_lint-0.2.0 lib/slim_lint/reporter.rb
slim_lint-0.1.0 lib/slim_lint/reporter.rb