Class: SlimLint::Reporter Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/slim_lint/reporter.rb

Overview

This class is abstract.

Abstract lint reporter. Subclass and override #display_report to implement a custom lint reporter.

Direct Known Subclasses

CheckstyleReporter, DefaultReporter, JsonReporter

Defined Under Namespace

Classes: CheckstyleReporter, DefaultReporter, JsonReporter

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ Reporter

Creates the reporter that will display the given report.

Parameters:



10
11
12
# File 'lib/slim_lint/reporter.rb', line 10

def initialize(logger)
  @log = logger
end

Class Method Details

.descendantsArray<Class>

Keep tracking all the descendants of this class for the list of available reporters.

Returns:

  • (Array<Class>)


26
27
28
# File 'lib/slim_lint/reporter.rb', line 26

def self.descendants
  @descendants ||= []
end

.inherited(descendant) ⇒ Object

Executed when this class is subclassed.

Parameters:

  • descendant (Class)


33
34
35
# File 'lib/slim_lint/reporter.rb', line 33

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

Instance Method Details

#display_report(report) ⇒ Object

Implemented by subclasses to display lints from a SlimLint::Report.

Parameters:

Raises:

  • (NotImplementedError)


17
18
19
20
# File 'lib/slim_lint/reporter.rb', line 17

def display_report(report)
  raise NotImplementedError,
        "Implement `display_report` to display #{report}"
end