bugspots 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93e2a62274f3a178825b80ad4c30a333b2b104e8
4
- data.tar.gz: 0f03a3e743aa346217c1fab5f3c86def0fa429f5
3
+ metadata.gz: 259d3b2908228f2c10f00b40940048e201af038f
4
+ data.tar.gz: '096f24e26a03bcc1c98babbcdf7d4310c9e5b6f3'
5
5
  SHA512:
6
- metadata.gz: e5279b3728e6788cc6a85e48b56e5452afa5ccdd7f6b92ae40cf57277928bb1dd6ad9dfc229f5cff8a6bd9ed48544fec28dcce791403a1c3c4da6fd08c8c5e7e
7
- data.tar.gz: c028ae36ffe156eb4bd05335afa73432b809c4690d92f565355e924bc9f20a28dcb5ce5e202c33b5b3b9565ad89c828fe11b805fc8095743cc561339b4f3e3e8
6
+ metadata.gz: e8b39cdbabcf669409bf06ee112332161361bb04d84c6ccfe7fe40bdedbabd8690e81a70db953742a36ae94726df573b40604d93d307250d7924a7dd693d8604
7
+ data.tar.gz: 9896635835788e2cbe57b8f81fb0c52d53ae349d4a150157b1644084aaff563a4b853eedeb640933a3ddebe4abe5673c7825accfe152f2b9a073e6fccf9b8f98
@@ -40,9 +40,6 @@ OptionParser.new do |opts|
40
40
  end
41
41
  end.parse!
42
42
 
43
- # Set a reasonable default of depth
44
- options[:depth] ||= 500
45
-
46
43
  # Set master as the default branch
47
44
  options[:branch] ||= "master"
48
45
 
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'shellwords'
4
+
3
5
  if ARGV.empty? or not Dir.exists? ARGV[0]
4
6
  ARGV.unshift Dir.pwd
5
7
  end
6
8
 
7
- exec 'bugspots', ARGV.join(' ')
9
+ cmd = "bugspots #{Shellwords.escape(ARGV[0])} #{ARGV[1..-1].join(' ')}"
10
+ exec cmd
@@ -4,7 +4,7 @@ module Bugspots
4
4
  Fix = Struct.new(:message, :date, :files)
5
5
  Spot = Struct.new(:file, :score)
6
6
 
7
- def self.scan(repo, branch = "master", depth = 500, regex = nil)
7
+ def self.scan(repo, branch = "master", depth = nil, regex = nil)
8
8
  regex ||= /\b(fix(es|ed)?|close(s|d)?)\b/i
9
9
  fixes = []
10
10
 
@@ -14,18 +14,21 @@ module Bugspots
14
14
  end
15
15
 
16
16
  walker = Rugged::Walker.new(repo)
17
- walker.sorting(Rugged::SORT_TOPO | Rugged::SORT_REVERSE)
17
+ walker.sorting(Rugged::SORT_TOPO)
18
18
  walker.push(repo.branches[branch].target)
19
+ walker = walker.take(depth) if depth
19
20
  walker.each do |commit|
20
- if commit.message =~ regex
21
+ if commit.message.scrub =~ regex
21
22
  files = commit.diff(commit.parents.first).deltas.collect do |d|
22
23
  d.old_file[:path]
23
24
  end
24
- fixes << Fix.new(commit.message.split("\n").first, commit.time, files)
25
+ fixes << Fix.new(commit.message.scrub.split("\n").first, commit.time, files)
25
26
  end
26
27
  end
27
28
 
28
29
  hotspots = Hash.new(0)
30
+ currentTime = Time.now
31
+ oldest_fix_date = fixes.last.date
29
32
  fixes.each do |fix|
30
33
  fix.files.each do |file|
31
34
  # The timestamp used in the equation is normalized from 0 to 1, where
@@ -34,7 +37,7 @@ module Bugspots
34
37
  # with this algorithm due to the moving normalization; it's not meant
35
38
  # to provide some objective score, only provide a means of comparison
36
39
  # between one file and another at any one point in time
37
- t = 1 - ((Time.now - fix.date).to_f / (Time.now - fixes.first.date))
40
+ t = 1 - ((currentTime - fix.date).to_f / (currentTime - oldest_fix_date))
38
41
  hotspots[file] += 1/(1+Math.exp((-12*t)+12))
39
42
  end
40
43
  end
@@ -1,3 +1,3 @@
1
1
  module Bugspots
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugspots
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Grigorik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-06 00:00:00.000000000 Z
11
+ date: 2018-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  version: '0'
77
77
  requirements: []
78
78
  rubyforge_project: bugspots
79
- rubygems_version: 2.2.2
79
+ rubygems_version: 2.6.11
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: Implementation of simple bug prediction hotspot heuristic