Class: HamlLint::Reporter Abstract

Inherits:
Object
  • Object
show all
Includes:
Hooks
Defined in:
lib/haml_lint/reporter.rb,
lib/haml_lint/reporter/hooks.rb,
lib/haml_lint/reporter/utils.rb

Overview

This class is abstract.

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

Defined Under Namespace

Modules: Hooks, Utils Classes: CheckstyleReporter, DefaultReporter, HashReporter, JsonReporter, ProgressReporter

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Hooks

#added_lint, #finished_file, #start

Constructor Details

#initialize(logger) ⇒ Reporter

Creates the reporter that will display the given report.

Parameters:



14
15
16
# File 'lib/haml_lint/reporter.rb', line 14

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


30
31
32
# File 'lib/haml_lint/reporter.rb', line 30

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

.inherited(descendant) ⇒ Object

Executed when this class is subclassed.

Parameters:

  • descendant (Class)


37
38
39
# File 'lib/haml_lint/reporter.rb', line 37

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

Instance Method Details

#display_report(report) ⇒ Object

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

Parameters:

Raises:

  • (NotImplementedError)


21
22
23
24
# File 'lib/haml_lint/reporter.rb', line 21

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