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.

Defined Under Namespace

Classes: CheckstyleReporter, DefaultReporter, EmacsReporter, GithubReporter, JsonReporter

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ Reporter

Creates the reporter that will display the given report.

Parameters:



12
13
14
# File 'lib/slim_lint/reporter.rb', line 12

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>)


28
29
30
# File 'lib/slim_lint/reporter.rb', line 28

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

.inherited(descendant) ⇒ Object

Executed when this class is subclassed.

Parameters:

  • descendant (Class)


35
36
37
# File 'lib/slim_lint/reporter.rb', line 35

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)


19
20
21
22
# File 'lib/slim_lint/reporter.rb', line 19

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