Class: Pronto::Fasterer
- Inherits:
-
Runner
- Object
- Runner
- Pronto::Fasterer
- Defined in:
- lib/pronto/fasterer.rb
Instance Method Summary collapse
Instance Method Details
#config ⇒ Object
36 37 38 |
# File 'lib/pronto/fasterer.rb', line 36 def config @fasterer_config ||= ::Fasterer::Config.new end |
#inspect(patch) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pronto/fasterer.rb', line 15 def inspect(patch) analyzer = ::Fasterer::Analyzer.new(patch.new_file_full_path) analyzer.scan errors = [] analyzer.errors.each { |error| errors << error } errors .select { |error| !config.ignored_speedups.include?(error.name) } .flat_map do |error| patch.added_lines .select { |line| line.new_lineno == error.line } .map { |line| (error, line) } end end |
#new_message(error, line) ⇒ Object
31 32 33 34 |
# File 'lib/pronto/fasterer.rb', line 31 def (error, line) path = line.patch.delta.new_file[:path] Message.new(path, line, :warning, error.explanation, nil, self.class) end |
#run ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/pronto/fasterer.rb', line 7 def run valid_patches = ruby_patches.reject do |patch| config.ignored_files.include?(patch.delta.new_file[:path]) end valid_patches.map { |patch| inspect(patch) }.flatten.compact end |