Sha256: 7bf5d3efdd63c3b199ae37f4b943f852c8e4cd62dfca2b14d6aa3c103b599e1e

Contents?: true

Size: 1.01 KB

Versions: 20

Compression:

Stored size: 1.01 KB

Contents

module SlimLint
  # Abstract lint reporter. Subclass and override {#display_report} to
  # implement a custom lint reporter.
  #
  # @abstract
  class Reporter
    # Creates the reporter that will display the given report.
    #
    # @param logger [SlimLint::Logger]
    def initialize(logger)
      @log = logger
    end

    # Implemented by subclasses to display lints from a {SlimLint::Report}.
    #
    # @param report [SlimLint::Report]
    def display_report(report)
      raise NotImplementedError,
            "Implement `display_report` to display #{report}"
    end

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

    # Executed when this class is subclassed.
    #
    # @param descendant [Class]
    def self.inherited(descendant)
      descendants << descendant
    end

    private

    # @return [SlimLint::Logger] logger to send output to
    attr_reader :log
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
slim_lint-0.15.1 lib/slim_lint/reporter.rb
slim_lint-0.15.0 lib/slim_lint/reporter.rb
slim_lint-0.14.0 lib/slim_lint/reporter.rb
slim_lint-0.13.0 lib/slim_lint/reporter.rb
slim_lint-0.12.0 lib/slim_lint/reporter.rb
slim_lint-0.11.0 lib/slim_lint/reporter.rb
slim_lint-0.10.0 lib/slim_lint/reporter.rb
slim_lint-0.9.0 lib/slim_lint/reporter.rb
slim_lint-0.8.3 lib/slim_lint/reporter.rb
slim_lint-0.8.2 lib/slim_lint/reporter.rb
slim_lint-0.8.1 lib/slim_lint/reporter.rb
slim_lint-0.8.0 lib/slim_lint/reporter.rb
slim_lint-0.7.2 lib/slim_lint/reporter.rb
slim_lint-0.7.1 lib/slim_lint/reporter.rb
slim_lint-0.7.0 lib/slim_lint/reporter.rb
slim_lint-0.6.1 lib/slim_lint/reporter.rb
slim_lint-0.6.0 lib/slim_lint/reporter.rb
slim_lint-0.5.0 lib/slim_lint/reporter.rb
slim_lint-0.4.0 lib/slim_lint/reporter.rb
slim_lint-0.3.0 lib/slim_lint/reporter.rb