Class: Collie::Linter::Base
- Inherits:
-
Object
- Object
- Collie::Linter::Base
- Defined in:
- lib/collie/linter/base.rb
Overview
Base class for all lint rules
Direct Known Subclasses
Rules::AmbiguousPrecedence, Rules::CircularReference, Rules::ConsistentTagNaming, Rules::DuplicateToken, Rules::EmptyAction, Rules::FactorizableRules, Rules::LeftRecursion, Rules::LongRule, Rules::MissingStartSymbol, Rules::NonterminalNaming, Rules::PrecImprovement, Rules::RedundantEpsilon, Rules::RightRecursion, Rules::TokenNaming, Rules::TrailingWhitespace, Rules::UndefinedSymbol, Rules::UnreachableRule, Rules::UnusedNonterminal, Rules::UnusedToken
Class Attribute Summary collapse
-
.autocorrectable ⇒ Object
Returns the value of attribute autocorrectable.
-
.description ⇒ Object
Returns the value of attribute description.
-
.rule_name ⇒ Object
Returns the value of attribute rule_name.
-
.severity ⇒ Object
Returns the value of attribute severity.
Instance Method Summary collapse
- #autocorrectable? ⇒ Boolean
- #check(_ast, _context = {}) ⇒ Object
-
#initialize(config = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(config = {}) ⇒ Base
Returns a new instance of Base.
35 36 37 38 |
# File 'lib/collie/linter/base.rb', line 35 def initialize(config = {}) @config = config @offenses = [] end |
Class Attribute Details
.autocorrectable ⇒ Object
Returns the value of attribute autocorrectable.
32 33 34 |
# File 'lib/collie/linter/base.rb', line 32 def autocorrectable @autocorrectable end |
.description ⇒ Object
Returns the value of attribute description.
32 33 34 |
# File 'lib/collie/linter/base.rb', line 32 def description @description end |
.rule_name ⇒ Object
Returns the value of attribute rule_name.
32 33 34 |
# File 'lib/collie/linter/base.rb', line 32 def rule_name @rule_name end |
.severity ⇒ Object
Returns the value of attribute severity.
32 33 34 |
# File 'lib/collie/linter/base.rb', line 32 def severity @severity end |
Instance Method Details
#autocorrectable? ⇒ Boolean
44 45 46 |
# File 'lib/collie/linter/base.rb', line 44 def autocorrectable? self.class.autocorrectable end |
#check(_ast, _context = {}) ⇒ Object
40 41 42 |
# File 'lib/collie/linter/base.rb', line 40 def check(_ast, _context = {}) raise NotImplementedError, "#{self.class} must implement #check" end |