defect-density-heatmap 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/heatmap/version.rb +1 -1
- data/lib/heatmap_formatter.rb +6 -6
- data/screenshot.png +0 -0
- data/spec/heatmap_formatter_spec.rb +6 -7
- data/spec/spec_helper.rb +2 -1
- metadata +5 -5
data/lib/heatmap/version.rb
CHANGED
data/lib/heatmap_formatter.rb
CHANGED
@@ -56,16 +56,16 @@ class HeatmapFormatter
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
def calculate_filename_color(total_changes, total_defects)
|
60
|
+
percent_of_defects = total_defects.to_f / total_changes.to_f
|
61
|
+
(percent_of_defects * 255).to_i
|
62
|
+
end
|
63
|
+
|
59
64
|
def compute_style(total_changes, total_defects)
|
60
|
-
|
61
|
-
"font-size: #{size_for(total_changes)}; background-color: rgba(255, 0, 0, #{transparency});"
|
65
|
+
"font-size: #{size_for(total_changes)}; color: rgb(#{calculate_filename_color(total_changes,total_defects)}, 0, 0);"
|
62
66
|
end
|
63
67
|
|
64
68
|
def determine_relative_size_for(value)
|
65
69
|
@size_calculator.size_for(value)
|
66
70
|
end
|
67
|
-
|
68
|
-
def calculate_transparency(total_changes, total_defects)
|
69
|
-
total_defects.to_f / total_changes.to_f
|
70
|
-
end
|
71
71
|
end
|
data/screenshot.png
CHANGED
Binary file
|
@@ -38,16 +38,15 @@ describe HeatmapFormatter do
|
|
38
38
|
file_with( :changes => 12 ).should have_font_size(36)
|
39
39
|
end
|
40
40
|
|
41
|
-
it "Adjusts the
|
42
|
-
file_with( :changes => 3 ).should
|
41
|
+
it "Adjusts the font color of each tag based on the number of changes that were defects" do
|
42
|
+
file_with( :changes => 3 ).should have_color('0, 0, 0')
|
43
43
|
|
44
44
|
file_with( :changes => 3,
|
45
|
-
:defects => 3 ).should
|
46
|
-
|
47
|
-
file_with( :changes => 10,
|
48
|
-
:defects => 5 ).should match("background-color: rgba\\(255, 0, 0, 0.5\\)")
|
49
|
-
end
|
45
|
+
:defects => 3 ).should have_color('255, 0, 0')
|
50
46
|
|
47
|
+
file_with( :changes => 7,
|
48
|
+
:defects => 5 ).should have_color('182, 0, 0')
|
49
|
+
end
|
51
50
|
|
52
51
|
it "Generates a range of font sizes based on a min/max" do
|
53
52
|
@formatter.size_for(12).should == 36
|
data/spec/spec_helper.rb
CHANGED
@@ -3,6 +3,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
3
3
|
|
4
4
|
require 'rspec'
|
5
5
|
require 'heatmap_formatter'
|
6
|
+
require 'command_line_runner'
|
6
7
|
|
7
8
|
RSpec.configure do | config |
|
8
9
|
config.color_enabled = true
|
@@ -16,7 +17,7 @@ end
|
|
16
17
|
|
17
18
|
RSpec::Matchers.define :have_color do | expected |
|
18
19
|
match do | actual |
|
19
|
-
actual =~ Regexp.new(".*color: #{expected};.*")
|
20
|
+
actual =~ Regexp.new(".*color: rgb\\(#{expected}\\);.*")
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: defect-density-heatmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-10-04 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70110389272640 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70110389272640
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: guard
|
27
|
-
requirement: &
|
27
|
+
requirement: &70110389272220 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70110389272220
|
36
36
|
description: Generates a tag cloud based on project file churn.
|
37
37
|
email:
|
38
38
|
- bcarlso@gmail.com
|