Class: HamlLint::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/haml_lint/runner.rb

Overview

Responsible for running the applicable linters against the desired files.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#filesObject (readonly)

Make the list of applicable files available


5
6
7
# File 'lib/haml_lint/runner.rb', line 5

def files
  @files
end

Instance Method Details

#run(options = {}) ⇒ HamlLint::Report

Runs the appropriate linters against the desired files given the specified options.

Parameters:

  • options (Hash) (defaults to: {})

Returns:

Raises:


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/haml_lint/runner.rb', line 13

def run(options = {})
  config = load_applicable_config(options)
  files = extract_applicable_files(options, config)
  linters = extract_enabled_linters(config, options)

  raise HamlLint::Exceptions::NoLintersError, 'No linters specified' if linters.empty?

  @lints = []
  files.each do |file|
    find_lints(file, linters, config)
  end

  linters.each do |linter|
    @lints += linter.lints
  end

  HamlLint::Report.new(@lints, files)
end