Module: SlimLint::LinterRegistry
- Included in:
- SlimLint::Linter::CommentControlStatement, SlimLint::Linter::ConsecutiveControlStatements, SlimLint::Linter::ControlStatementSpacing, SlimLint::Linter::EmbeddedEngines, SlimLint::Linter::EmptyControlStatement, SlimLint::Linter::EmptyLines, SlimLint::Linter::FileLength, SlimLint::Linter::InstanceVariables, SlimLint::Linter::LineLength, SlimLint::Linter::QuoteConsistency, SlimLint::Linter::RedundantDiv, SlimLint::Linter::RuboCop, SlimLint::Linter::StrictLocalsMissing, SlimLint::Linter::Tab, SlimLint::Linter::Tag, SlimLint::Linter::TagAttribute, SlimLint::Linter::TagCase, SlimLint::Linter::TrailingBlankLines, SlimLint::Linter::TrailingWhitespace, SlimLint::Linter::Zwsp
- Defined in:
- lib/slim_lint/linter_registry.rb
Overview
Stores all defined linters.
Class Attribute Summary collapse
-
.linters ⇒ Object
readonly
List of all registered linters.
Class Method Summary collapse
-
.extract_linters_from(linter_names) ⇒ Array<Class>
Return a list of Linter Classes corresponding to the specified list of names.
-
.included(subclass) ⇒ Object
Executed when a linter includes the LinterRegistry module.
-
.linter_names ⇒ Array<String>
Returns the short names of all registered linters.
Class Attribute Details
.linters ⇒ Object (readonly)
List of all registered linters.
12 13 14 |
# File 'lib/slim_lint/linter_registry.rb', line 12 def linters @linters end |
Class Method Details
.extract_linters_from(linter_names) ⇒ Array<Class>
Return a list of SlimLint::Linter Classes corresponding to the specified list of names.
35 36 37 38 39 40 41 |
# File 'lib/slim_lint/linter_registry.rb', line 35 def extract_linters_from(linter_names) linter_names.map do |linter_name| SlimLint::Linter.const_get(linter_name) rescue NameError raise NoSuchLinter, "Linter #{linter_name} does not exist" end end |
.included(subclass) ⇒ Object
Executed when a linter includes the SlimLint::LinterRegistry module.
This results in the linter being registered with the registry.
26 27 28 |
# File 'lib/slim_lint/linter_registry.rb', line 26 def included(subclass) @linters << subclass end |
.linter_names ⇒ Array<String>
Returns the short names of all registered linters.
17 18 19 |
# File 'lib/slim_lint/linter_registry.rb', line 17 def linter_names @linters.map { |linter| linter.name.split('::').last } end |