Class: Lintrunner::Runner::Base

Inherits:
Object
  • Object
show all
Includes:
GitHelpers
Defined in:
lib/lintrunner/runner/base.rb

Direct Known Subclasses

ChangedFile, Diff, NewFile, Repo

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GitHelpers

#git_changeset, #git_common_ancestor

Constructor Details

#initialize(path:, match:, executor:) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
# File 'lib/lintrunner/runner/base.rb', line 8

def initialize(path:, match:, executor:)
  self.path = path
  self.executor = executor
  self.match = Regexp.new(Regexp.escape(match))
  self.git = Rugged::Repository.new(path)
end

Instance Attribute Details

#executorObject

Returns the value of attribute executor.



6
7
8
# File 'lib/lintrunner/runner/base.rb', line 6

def executor
  @executor
end

#gitObject

Returns the value of attribute git.



6
7
8
# File 'lib/lintrunner/runner/base.rb', line 6

def git
  @git
end

#matchObject

Returns the value of attribute match.



6
7
8
# File 'lib/lintrunner/runner/base.rb', line 6

def match
  @match
end

#pathObject

Returns the value of attribute path.



6
7
8
# File 'lib/lintrunner/runner/base.rb', line 6

def path
  @path
end

Instance Method Details

#run(reporter = nil) ⇒ Object



15
16
17
# File 'lib/lintrunner/runner/base.rb', line 15

def run(reporter = nil)
  raise "Runner must implement #run method"
end