Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

187 compatibility #2

Merged
merged 2 commits into from

2 participants

@bittersweet

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
@bittersweet bittersweet Clear whitespace db68a33
@bittersweet 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
@igrigorik igrigorik merged commit 6e9a894 into igrigorik:master
@igrigorik
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. @bittersweet

    Clear whitespace

    bittersweet authored
  2. @bittersweet

    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
View
4 bin/bugspots
@@ -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
View
8 lib/bugspots/scanner.rb
@@ -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.