Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: db68a33fe8
Fetching contributors…

Cannot retrieve contributors at this time

executable file 50 lines (36 sloc) 1.291 kB
#!/usr/bin/env ruby
lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
require 'bugspots'
require 'optparse'
ARGV << '--help' if ARGV.empty?
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: bugspots /path/to/git/repo"
# Option: Set Depth
opts.on('-d', '--depth [depth]', 'depth of log crawl (integer)') do |d|
options[:depth] = d.to_i
end
# Option: Set Timestamp Display
opts.on('--display-timestamps', 'show timestamps of each identified fix commit') do |dt|
options[:display_timestamps] = true
end
end.parse!
# Set a reasonable default of depth
options[:depth] ||= 500
puts "Scanning #{ARGV[0]} repo".foreground(:green)
fixes, spots = Bugspots.scan(ARGV[0], options[:depth])
puts "\tFound #{fixes.size} bugfix commits, with #{spots.size} hotspots:".foreground(:yellow)
puts
puts "\tFixes:".foreground(:green).underline
fixes.each do |fix|
message = "\t\t- "
message << "#{fix.date} " if options[:display_timestamps]
message << "#{fix.message}"
puts message.foreground(:yellow)
end
puts "\n"
puts "\tHotspots:".foreground(:green).underline
spots.each do |spot|
puts "\t\t#{spot.score}".foreground(:red) + " - #{spot.file}".foreground(:yellow)
end
Jump to Line
Something went wrong with that request. Please try again.