bugspots 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/bugspots +0 -3
- data/bin/git-bugspots +4 -1
- data/lib/bugspots/scanner.rb +8 -5
- data/lib/bugspots/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 259d3b2908228f2c10f00b40940048e201af038f
|
4
|
+
data.tar.gz: '096f24e26a03bcc1c98babbcdf7d4310c9e5b6f3'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8b39cdbabcf669409bf06ee112332161361bb04d84c6ccfe7fe40bdedbabd8690e81a70db953742a36ae94726df573b40604d93d307250d7924a7dd693d8604
|
7
|
+
data.tar.gz: 9896635835788e2cbe57b8f81fb0c52d53ae349d4a150157b1644084aaff563a4b853eedeb640933a3ddebe4abe5673c7825accfe152f2b9a073e6fccf9b8f98
|
data/bin/bugspots
CHANGED
data/bin/git-bugspots
CHANGED
data/lib/bugspots/scanner.rb
CHANGED
@@ -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 =
|
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
|
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 - ((
|
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
|
data/lib/bugspots/version.rb
CHANGED
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.
|
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:
|
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.
|
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
|