Class: Lintrunner::Runner::ChangedFile

Inherits:
Base
  • Object
show all
Defined in:
lib/lintrunner/runner/changed_file.rb

Instance Attribute Summary

Attributes inherited from Base

#executor, #git, #match, #path

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from GitHelpers

#git_changeset, #git_common_ancestor

Constructor Details

This class inherits a constructor from Lintrunner::Runner::Base

Instance Method Details

#run(reporter) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/lintrunner/runner/changed_file.rb', line 5

def run(reporter)
  warnings = []
  git_changeset.each do |patch|
    filename = patch.delta.new_file[:path]
    next if patch.delta.binary?
    next unless filename =~ match
    full_path = File.join(path, filename)

    messages = executor.execute(full_path, filename: filename)
    warnings.concat messages
    output = messages.collect do |message|
      reporter.report(message)
    end
  end
  warnings
end