Class: LintTrappings::Formatter::Base Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/lint_trappings/formatter/base.rb

Overview

This class is abstract.

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

Direct Known Subclasses

Checkstyle, Default, JSON

Instance Method Summary collapse

Constructor Details

#initialize(application, config, options, output) ⇒ Base

Returns a new instance of Base.

Parameters:



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lint_trappings/formatter/base.rb', line 11

def initialize(application, config, options, output)
  @application = application
  @config = config
  @options = options
  @output = output

  # Used in helpers to determine if severity should be displayed as failure
  # or not
  severities = @config.fetch('severities', error: 'fail', warning: 'warn')
  @fail_severities = severities.select { |_severity, action| action == 'fail' }.keys
  @warn_severities = severities.select { |_severity, action| action == 'warn' }.keys
end

Instance Method Details

#finished(_report) ⇒ Object

Called at the end of the run.



42
43
# File 'lib/lint_trappings/formatter/base.rb', line 42

def finished(_report)
end

#job_finished(_job, _lints) ⇒ Object

Called at the end of a job for a linter run against a file.

This can be called in parallel.



38
39
# File 'lib/lint_trappings/formatter/base.rb', line 38

def job_finished(_job, _lints)
end

#job_started(_job) ⇒ Object

Called at the beginning of a job for a linter run against a file.

This can be called in parallel.



32
33
# File 'lib/lint_trappings/formatter/base.rb', line 32

def job_started(_job)
end

#started(_files_to_lint) ⇒ Object

Called at the start of the run once runner has determined all files it will lint.



26
27
# File 'lib/lint_trappings/formatter/base.rb', line 26

def started(_files_to_lint)
end