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::SymbolConflict, Rules::TokenNaming, Rules::TrailingWhitespace, Rules::UndefinedSymbol, Rules::UnreachableRule, Rules::UnusedNonterminal, Rules::UnusedToken
Constant Summary collapse
- VALID_SEVERITIES =
%i[error warning convention info].freeze
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.
37 38 39 40 |
# File 'lib/collie/linter/base.rb', line 37 def initialize(config = {}) @config = config @offenses = [] end |
Class Attribute Details
.autocorrectable ⇒ Object
Returns the value of attribute autocorrectable.
34 35 36 |
# File 'lib/collie/linter/base.rb', line 34 def autocorrectable @autocorrectable end |
.description ⇒ Object
Returns the value of attribute description.
34 35 36 |
# File 'lib/collie/linter/base.rb', line 34 def description @description end |
.rule_name ⇒ Object
Returns the value of attribute rule_name.
34 35 36 |
# File 'lib/collie/linter/base.rb', line 34 def rule_name @rule_name end |
.severity ⇒ Object
Returns the value of attribute severity.
34 35 36 |
# File 'lib/collie/linter/base.rb', line 34 def severity @severity end |
Instance Method Details
#autocorrectable? ⇒ Boolean
46 47 48 |
# File 'lib/collie/linter/base.rb', line 46 def autocorrectable? self.class.autocorrectable end |
#check(_ast, _context = {}) ⇒ Object
42 43 44 |
# File 'lib/collie/linter/base.rb', line 42 def check(_ast, _context = {}) raise NotImplementedError, "#{self.class} must implement #check" end |