Module: ERBLint::LinterRegistry
- Included in:
- ERBLint::Linters::AllowedScriptType, ERBLint::Linters::ClosingErbTagIndent, ERBLint::Linters::DeprecatedClasses, ERBLint::Linters::ErbSafety, ERBLint::Linters::ExtraNewline, ERBLint::Linters::FinalNewline, ERBLint::Linters::HardCodedString, ERBLint::Linters::NoJavascriptTagHelper, ERBLint::Linters::ParserErrors, ERBLint::Linters::PartialInstanceVariable, ERBLint::Linters::RequireInputAutocomplete, ERBLint::Linters::RequireScriptNonce, ERBLint::Linters::RightTrim, ERBLint::Linters::Rubocop, ERBLint::Linters::RubocopText, ERBLint::Linters::SelfClosingTag, ERBLint::Linters::SpaceAroundErbTag, ERBLint::Linters::SpaceInHtmlTag, ERBLint::Linters::SpaceIndentation, ERBLint::Linters::TrailingWhitespace
- Defined in:
- lib/erb_lint/linter_registry.rb
Overview
Stores all linters available to the application.
Constant Summary collapse
- CUSTOM_LINTERS_DIR =
".erb-linters"
Class Method Summary collapse
- .clear ⇒ Object
- .find_by_name(name) ⇒ Object
- .included(linter_class) ⇒ Object
- .linters ⇒ Object
- .load_custom_linters(directory = CUSTOM_LINTERS_DIR) ⇒ Object
Class Method Details
.clear ⇒ Object
10 11 12 |
# File 'lib/erb_lint/linter_registry.rb', line 10 def clear @linters = nil end |
.find_by_name(name) ⇒ Object
18 19 20 |
# 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) ⇒ Object
14 15 16 |
# File 'lib/erb_lint/linter_registry.rb', line 14 def included(linter_class) @loaded_linters << linter_class end |
.linters ⇒ Object
22 23 24 25 26 27 |
# 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) ⇒ Object
29 30 31 32 |
# File 'lib/erb_lint/linter_registry.rb', line 29 def load_custom_linters(directory = CUSTOM_LINTERS_DIR) ruby_files = Dir.glob(File.(File.join(directory, "**", "*.rb"))) ruby_files.each { |file| require file } end |