Class: SlimLint::LinterSelector

Inherits:
Object
  • Object
show all
Defined in:
lib/slim_lint/linter_selector.rb

Overview

Chooses the appropriate linters to run given the specified configuration.

Instance Method Summary collapse

Constructor Details

#initialize(config, options) ⇒ LinterSelector

Creates a selector using the given configuration and additional options.

Parameters:



10
11
12
13
# File 'lib/slim_lint/linter_selector.rb', line 10

def initialize(config, options)
  @config = config
  @options = options
end

Instance Method Details

#linters_for_file(file) ⇒ Array<SlimLint::Linter>

Returns the set of linters to run against the given file.

Parameters:

  • file (String)

Returns:

Raises:



20
21
22
23
# File 'lib/slim_lint/linter_selector.rb', line 20

def linters_for_file(file)
  @linters ||= extract_enabled_linters(@config, @options)
  @linters.select { |linter| run_linter_on_file?(@config, linter, file) }
end