Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

187 compatibility #2

Merged
merged 2 commits into from

2 participants

Mark Mulder Ilya Grigorik
Mark Mulder

Hi Ilya,

This commit makes sure it works in 1.8.7 as well. The only change is using sprintf for rounding the Spot score instead of Float#round.

bittersweet added some commits
Mark Mulder bittersweet Clear whitespace db68a33
Mark Mulder bittersweet Use sprintf instead of round for 187 compatibility
Float#round with arguments is not supported in 1.8.7 but sprintf can be
used to get the same result.
54bcd08
Ilya Grigorik igrigorik merged commit 6e9a894 into from
Ilya Grigorik
Owner

Nice, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 15, 2011
  1. Mark Mulder

    Clear whitespace

    bittersweet authored
  2. Mark Mulder

    Use sprintf instead of round for 187 compatibility

    bittersweet authored
    Float#round with arguments is not supported in 1.8.7 but sprintf can be
    used to get the same result.
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 6 deletions.
  1. +2 −2 bin/bugspots
  2. +4 −4 lib/bugspots/scanner.rb
4 bin/bugspots
View
@@ -11,12 +11,12 @@ 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
8 lib/bugspots/scanner.rb
View
@@ -9,9 +9,9 @@ def self.scan(repo, depth = 500)
repo = Grit::Repo.new(repo)
fixes = []
- repo.commits('master', depth).each do |commit|
+ repo.commits('master', depth).each do |commit|
if commit.message =~ /fix(es|ed)|close(s|d)/
- files = commit.stats.files.map {|s| s.first}
+ files = commit.stats.files.map {|s| s.first}
fixes << Fix.new(commit.short_message, commit.date, files)
end
end
@@ -25,9 +25,9 @@ def self.scan(repo, depth = 500)
end
spots = hotspots.sort_by {|k,v| v}.reverse.collect do |spot|
- Spot.new(spot.first, spot.last.round(4))
+ Spot.new(spot.first, sprintf('%.4f', spot.last))
end
return fixes, spots
end
-end
+end
Something went wrong with that request. Please try again.