Class: Collie::Linter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/collie/linter/base.rb

Overview

Base class for all lint rules

Class Attribute Summary collapse

Instance Method Summary collapse

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

.autocorrectableObject

Returns the value of attribute autocorrectable.



32
33
34
# File 'lib/collie/linter/base.rb', line 32

def autocorrectable
  @autocorrectable
end

.descriptionObject

Returns the value of attribute description.



32
33
34
# File 'lib/collie/linter/base.rb', line 32

def description
  @description
end

.rule_nameObject

Returns the value of attribute rule_name.



32
33
34
# File 'lib/collie/linter/base.rb', line 32

def rule_name
  @rule_name
end

.severityObject

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

Returns:

  • (Boolean)


44
45
46
# File 'lib/collie/linter/base.rb', line 44

def autocorrectable?
  self.class.autocorrectable
end

#check(_ast, _context = {}) ⇒ Object

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/collie/linter/base.rb', line 40

def check(_ast, _context = {})
  raise NotImplementedError, "#{self.class} must implement #check"
end