Sha256: 2e0c9903a86e3094628f27abb306dbe9f96df61b300d4bd84f6d88ab2e61052c
Contents?: true
Size: 661 Bytes
Versions: 5
Compression:
Stored size: 661 Bytes
Contents
class FileInfo attr_accessor :name attr_accessor :changed_lines def initialize(name, changed_lines) self.name = name self.changed_lines = changed_lines end end class Finder def self.parse(diff) files = [] diff.each do |f| name = f.path if f.type != 'modified' files << FileInfo.new(name, 0) next end lines = f.patch.split(/\n/).reject(&:empty?) count = 0 lines[4..-1].each do |line| count += 1 if line.start_with?('-', '+') end files << FileInfo.new(name, count) end files = files.sort_by(&:changed_lines).reverse files.map(&:name) end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
danger-mention-0.6.1 | lib/finder.rb |
danger-mention-0.6.0 | lib/finder.rb |
danger-mention-0.5.0 | lib/finder.rb |
danger-mention-0.4.0 | lib/finder.rb |
danger-mention-0.2 | lib/finder.rb |