Class: HamlLint::Reporter::HashReporter

Inherits:
Reporter
  • Object
show all
Defined in:
lib/haml_lint/reporter/hash_reporter.rb

Overview

Outputs report as a Ruby Hash for easy use by other tools.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.available?false

Disables this reporter on the CLI since it doesn't output anything.

Returns:

  • (false)


9
10
11
# File 'lib/haml_lint/reporter/hash_reporter.rb', line 9

def self.available?
  false
end

Instance Method Details

#display_report(report) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/haml_lint/reporter/hash_reporter.rb', line 13

def display_report(report)
  lints = report.lints
  grouped = lints.group_by(&:filename)

  {
    metadata: ,
    files: grouped.map { |l| map_file(l) },
    summary: {
      offense_count: lints.length,
      target_file_count: grouped.length,
      inspected_file_count: report.files.length,
    },
  }
end