Class: SlimLint::Linter Abstract
- Inherits:
-
Object
- Object
- SlimLint::Linter
- Extended by:
- SexpVisitor::DSL
- Includes:
- SexpVisitor
- Defined in:
- lib/slim_lint/linter.rb
Overview
Base implementation for all lint checks.
Direct Known Subclasses
CommentControlStatement, ConsecutiveControlStatements, ControlStatementSpacing, EmbeddedEngines, EmptyControlStatement, EmptyLines, FileLength, InstanceVariables, LineLength, RedundantDiv, RuboCop, StrictLocalsMissing, Tab, TagCase, TrailingBlankLines, TrailingWhitespace, Zwsp
Defined Under Namespace
Classes: CommentControlStatement, ConsecutiveControlStatements, ControlStatementSpacing, EmbeddedEngines, EmptyControlStatement, EmptyLines, FileLength, InstanceVariables, LineLength, RedundantDiv, RuboCop, StrictLocalsMissing, Tab, TagCase, TrailingBlankLines, TrailingWhitespace, Zwsp
Instance Attribute Summary collapse
-
#lints ⇒ Object
readonly
List of lints reported by this linter.
Attributes included from SexpVisitor::DSL
Instance Method Summary collapse
-
#initialize(config) ⇒ Linter
constructor
Initializes a linter with the specified configuration.
-
#name ⇒ String
Returns the simple name for this linter.
-
#run(document) ⇒ Object
Runs the linter against the given Slim document.
Methods included from SexpVisitor::DSL
anything, capture, on, on_start
Methods included from SexpVisitor
#captures, #on_start, #patterns, #traverse, #traverse_children, #trigger_pattern_callbacks
Constructor Details
#initialize(config) ⇒ Linter
Initializes a linter with the specified configuration.
21 22 23 24 |
# File 'lib/slim_lint/linter.rb', line 21 def initialize(config) @config = config @lints = [] end |
Instance Attribute Details
#lints ⇒ Object (readonly)
Remove once spec/support/shared_linter_context returns an array of lints for the subject instead of the linter itself.
List of lints reported by this linter.
16 17 18 |
# File 'lib/slim_lint/linter.rb', line 16 def lints @lints end |
Instance Method Details
#name ⇒ String
Returns the simple name for this linter.
40 41 42 |
# File 'lib/slim_lint/linter.rb', line 40 def name self.class.name.split('::').last end |
#run(document) ⇒ Object
Runs the linter against the given Slim document.
29 30 31 32 33 34 35 |
# File 'lib/slim_lint/linter.rb', line 29 def run(document) @document = document @lints = [] @disabled_lines = nil trigger_pattern_callbacks(document.sexp) @lints end |