module ERBLint::LinterRegistry

Stores all linters available to the application.

Constants

CUSTOM_LINTERS_DIR

Public Class Methods

clear() click to toggle source
# File lib/erb_lint/linter_registry.rb, line 10
def clear
  @linters = nil
end
find_by_name(name) click to toggle source
# File lib/erb_lint/linter_registry.rb, line 18
def find_by_name(name)
  linters.detect { |linter| linter.simple_name == name }
end
included(linter_class) click to toggle source
# File lib/erb_lint/linter_registry.rb, line 14
def included(linter_class)
  @loaded_linters << linter_class
end
linters() click to toggle source
# File lib/erb_lint/linter_registry.rb, line 22
def linters
  @linters ||= begin
    load_custom_linters
    @loaded_linters
  end
end
load_custom_linters(directory = CUSTOM_LINTERS_DIR) click to toggle source
# File lib/erb_lint/linter_registry.rb, line 29
def load_custom_linters(directory = CUSTOM_LINTERS_DIR)
  ruby_files = Dir.glob(File.expand_path(File.join(directory, "**", "*.rb")))
  ruby_files.each { |file| require file }
end