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 Method Summary collapse

Instance Method Details

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

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

Parameters:

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

Options Hash (options):

  • :config_file (String)

    path of configuration file to load

  • :config (HamlLint::Configuration)

    configuration to use

  • :excluded_files (Array<String>)
  • :included_linters (Array<String>)
  • :excluded_linters (Array<String>)
  • :fail_fast (true, false)

    flag for failing after first failure

  • :fail_level (Object)
  • :reporter (HamlLint::Reporter)

Returns:



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/haml_lint/runner.rb', line 22

def run(options = {})
  @config = load_applicable_config(options)
  @sources = extract_applicable_sources(config, options)
  @linter_selector = HamlLint::LinterSelector.new(config, options)
  @fail_fast = options.fetch(:fail_fast, false)
  @cache = {}
  @autocorrect = options[:autocorrect]
  @autocorrect_only = options[:autocorrect_only]
  @autocorrect_stdout = options[:stdin] && options[:stderr]

  report(options)
end