simplecov-html 0.10.2 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +0 -1
- data/.rubocop.yml +42 -17
- data/.tool-versions +1 -0
- data/.travis.yml +16 -20
- data/CHANGELOG.md +32 -2
- data/Gemfile +6 -15
- data/Gemfile.lock +62 -0
- data/Guardfile +2 -0
- data/README.md +2 -2
- data/Rakefile +3 -1
- data/assets/javascripts/application.js +29 -26
- data/assets/stylesheets/screen.css.sass +10 -1
- data/lib/simplecov-html.rb +28 -0
- data/lib/simplecov-html/version.rb +3 -1
- data/public/application.css +41 -31
- data/public/application.js +26 -26
- data/simplecov-html.gemspec +4 -3
- data/test/helper.rb +2 -0
- data/test/test_simple_cov-html.rb +3 -1
- data/views/covered_percent.erb +3 -0
- data/views/file_list.erb +44 -13
- data/views/layout.erb +6 -6
- data/views/source_file.erb +40 -9
- metadata +11 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d594be7e34adc2ed339f5a6df223c55cc58082d31bd023905184eb61bf678e75
|
4
|
+
data.tar.gz: c32f8b988081ea79136aa7f36a381a8f534dd2d96b860328e3021187aa602ebb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz: '
|
6
|
+
metadata.gz: e907b2fe612c02ceb6400afdabab01968730551e72c7e7247fcd07f5ac206b9a13fac25eff83027b2a27e8e137c9593adffde43b69674a1a50522db988ddc472
|
7
|
+
data.tar.gz: '08de96a271d330ac91eecf9b60cfe99027cbd5fff212041a6e32964c19aab6ef198fdf59a0f4d832f4fc13318ca628521094df7953213499fac13a37b5b63b3c'
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,7 +1,23 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.6
|
3
|
+
DisplayCopNames: true
|
4
|
+
|
5
|
+
Bundler/DuplicatedGem:
|
6
|
+
Enabled: false
|
7
|
+
|
8
|
+
Gemspec/RequiredRubyVersion:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Layout/AccessModifierIndentation:
|
12
|
+
EnforcedStyle: outdent
|
13
|
+
|
14
|
+
Layout/SpaceInsideHashLiteralBraces:
|
15
|
+
EnforcedStyle: no_space
|
16
|
+
|
1
17
|
Metrics/BlockNesting:
|
2
18
|
Max: 2
|
3
19
|
|
4
|
-
|
20
|
+
Layout/LineLength:
|
5
21
|
AllowURI: true
|
6
22
|
Enabled: false
|
7
23
|
|
@@ -13,15 +29,17 @@ Metrics/ParameterLists:
|
|
13
29
|
Max: 4
|
14
30
|
CountKeywordArgs: true
|
15
31
|
|
16
|
-
|
17
|
-
|
32
|
+
Naming/FileName:
|
33
|
+
Exclude:
|
34
|
+
- "lib/simplecov-html.rb"
|
35
|
+
- "test/test_simple_cov-html.rb"
|
18
36
|
|
19
37
|
Style/CollectionMethods:
|
20
38
|
PreferredMethods:
|
21
|
-
map:
|
22
|
-
reduce:
|
23
|
-
find:
|
24
|
-
find_all:
|
39
|
+
map: "collect"
|
40
|
+
reduce: "inject"
|
41
|
+
find: "detect"
|
42
|
+
find_all: "select"
|
25
43
|
|
26
44
|
Style/Documentation:
|
27
45
|
Enabled: false
|
@@ -29,26 +47,33 @@ Style/Documentation:
|
|
29
47
|
Style/DoubleNegation:
|
30
48
|
Enabled: false
|
31
49
|
|
32
|
-
Style/
|
33
|
-
|
34
|
-
|
35
|
-
|
50
|
+
Style/ExpandPathArguments:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
Style/FrozenStringLiteralComment:
|
54
|
+
Enabled: true
|
36
55
|
|
37
56
|
Style/HashSyntax:
|
38
57
|
EnforcedStyle: hash_rockets
|
39
58
|
|
40
59
|
Style/MutableConstant:
|
41
60
|
Exclude:
|
42
|
-
-
|
61
|
+
- "lib/simplecov-html/version.rb"
|
43
62
|
|
44
|
-
Style/
|
63
|
+
Style/NumericPredicate:
|
45
64
|
Enabled: false
|
46
65
|
|
47
|
-
Style/
|
48
|
-
|
66
|
+
Style/RegexpLiteral:
|
67
|
+
Enabled: false
|
49
68
|
|
50
69
|
Style/StringLiterals:
|
51
70
|
EnforcedStyle: double_quotes
|
52
71
|
|
53
|
-
Style/
|
54
|
-
|
72
|
+
Style/SymbolArray:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
Style/TrailingCommaInHashLiteral:
|
76
|
+
EnforcedStyleForMultiline: "comma"
|
77
|
+
|
78
|
+
Style/TrailingCommaInArrayLiteral:
|
79
|
+
EnforcedStyleForMultiline: "comma"
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.6.5
|
data/.travis.yml
CHANGED
@@ -1,29 +1,25 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
3
|
before_install:
|
4
|
-
- gem
|
4
|
+
- gem i bundler
|
5
5
|
|
6
|
-
bundler_args: --without
|
7
|
-
|
8
|
-
cache: bundler
|
9
|
-
|
10
|
-
sudo: false
|
11
|
-
|
12
|
-
rvm:
|
13
|
-
- 1.8.7
|
14
|
-
- 1.9.3
|
15
|
-
- 2.0.0
|
16
|
-
- 2.1
|
17
|
-
- 2.2
|
18
|
-
- 2.3.1
|
19
|
-
- ruby-head
|
20
|
-
- jruby
|
21
|
-
- rbx-2
|
22
|
-
- jruby-9.1.12.0
|
6
|
+
bundler_args: --without benchmark --jobs=3 --retry=3
|
23
7
|
|
24
8
|
matrix:
|
9
|
+
include:
|
10
|
+
- rvm: 2.4.9
|
11
|
+
- rvm: 2.5.7
|
12
|
+
- rvm: 2.6.5
|
13
|
+
- rvm: 2.7.0
|
14
|
+
- rvm: jruby-9.2.9.0
|
15
|
+
env: JRUBY_OPTS=--debug
|
16
|
+
jdk: openjdk8
|
17
|
+
- rvm: ruby-head
|
18
|
+
- rvm: jruby-head
|
19
|
+
env: JRUBY_OPTS=--debug
|
20
|
+
jdk: openjdk8
|
25
21
|
allow_failures:
|
26
22
|
- rvm: ruby-head
|
27
|
-
- rvm: jruby
|
28
|
-
|
23
|
+
- rvm: jruby-head
|
24
|
+
env: JRUBY_OPTS=--debug
|
29
25
|
fast_finish: true
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,41 @@
|
|
1
|
-
0.
|
1
|
+
0.11.0 (2020-01-28)
|
2
|
+
=======
|
3
|
+
|
4
|
+
This release goes together with simplecov 0.18 to bring branch coverage support to you. Please also check the notes of the beta releases.
|
5
|
+
|
6
|
+
## Enhancements
|
7
|
+
* Display total branch coverage percentage in the overview (if branch coverage enabled)
|
8
|
+
|
9
|
+
0.11.0.beta2 (2020-01-19)
|
10
|
+
=======
|
11
|
+
|
12
|
+
## Enhancements
|
13
|
+
* changed display of branch coverage to be `branch_type: hit_count` which should be more expressive and more intuitive
|
14
|
+
* Cached lookup of whether we're doing branch coverage or not (should be faster)
|
15
|
+
|
16
|
+
## Bugfixes
|
17
|
+
* Fixed sorting of percent column (regression in previous release)
|
18
|
+
|
19
|
+
0.11.0.beta1 (2020-01-05)
|
20
|
+
========
|
21
|
+
|
22
|
+
Changes ruby support to 2.4+, adds branch coverage support. Meant to be used with simplecov 0.18
|
23
|
+
|
24
|
+
## Breaking Changes
|
25
|
+
* Drops support for EOL'ed ruby versions, new support is ~> 2.4
|
26
|
+
|
27
|
+
## Enhancements
|
28
|
+
* Support/display of branch coverage from simplecov 0.18.0.beta1, little badges saying `hit_count, positive_or_negative` will appear next to lines if branch coverage is activated. `0, +` means positive branch was never hit, `2, -` means negative branch was hit twice
|
29
|
+
* Encoding compatibility errors are now caught and printed out
|
30
|
+
|
31
|
+
0.10.2 (2017-08-14)
|
2
32
|
========
|
3
33
|
|
4
34
|
## Bugfixes
|
5
35
|
|
6
36
|
* Allow usage with frozen-string-literal-enabled. See [#56](https://github.com/colszowka/simplecov-html/pull/56) (thanks @pat)
|
7
37
|
|
8
|
-
0.10.1 2017-05-17
|
38
|
+
0.10.1 (2017-05-17)
|
9
39
|
========
|
10
40
|
|
11
41
|
## Bugfixes
|
data/Gemfile
CHANGED
@@ -1,26 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source "https://rubygems.org"
|
2
4
|
|
3
5
|
gemspec
|
4
6
|
|
5
|
-
|
6
|
-
gem "rake", "~> 10.5"
|
7
|
-
else
|
8
|
-
gem "rake", ">= 11"
|
9
|
-
end
|
7
|
+
gem "rake", ">= 11"
|
10
8
|
|
11
9
|
# Use local copy of simplecov in development when checked out, fetch from git otherwise
|
12
10
|
if File.directory?(File.dirname(__FILE__) + "/../simplecov")
|
13
11
|
gem "simplecov", :path => File.dirname(__FILE__) + "/../simplecov"
|
14
12
|
else
|
15
|
-
gem "simplecov", :
|
16
|
-
end
|
17
|
-
|
18
|
-
platforms :ruby_18, :ruby_19 do
|
19
|
-
gem "json", "~> 1.8"
|
20
|
-
end
|
21
|
-
|
22
|
-
platforms :ruby_18, :ruby_19, :ruby_20, :ruby_21 do
|
23
|
-
gem "rack", "~> 1.6"
|
13
|
+
gem "simplecov", :github => "colszowka/simplecov"
|
24
14
|
end
|
25
15
|
|
26
16
|
group :test do
|
@@ -30,5 +20,6 @@ end
|
|
30
20
|
group :development do
|
31
21
|
gem "rubocop"
|
32
22
|
gem "sass"
|
33
|
-
|
23
|
+
# sprockets 4.0 requires ruby 2.5+
|
24
|
+
gem "sprockets", "~> 3.7"
|
34
25
|
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
simplecov-html (0.11.0)
|
5
|
+
|
6
|
+
PATH
|
7
|
+
remote: /home/tobi/github/simplecov
|
8
|
+
specs:
|
9
|
+
simplecov (0.18.0)
|
10
|
+
docile (~> 1.1)
|
11
|
+
simplecov-html (~> 0.11.0)
|
12
|
+
|
13
|
+
GEM
|
14
|
+
remote: https://rubygems.org/
|
15
|
+
specs:
|
16
|
+
ast (2.4.0)
|
17
|
+
concurrent-ruby (1.1.5)
|
18
|
+
docile (1.3.2)
|
19
|
+
ffi (1.11.3)
|
20
|
+
jaro_winkler (1.5.4)
|
21
|
+
minitest (5.13.0)
|
22
|
+
parallel (1.19.1)
|
23
|
+
parser (2.7.0.1)
|
24
|
+
ast (~> 2.4.0)
|
25
|
+
rack (2.0.7)
|
26
|
+
rainbow (3.0.0)
|
27
|
+
rake (13.0.1)
|
28
|
+
rb-fsevent (0.10.3)
|
29
|
+
rb-inotify (0.10.0)
|
30
|
+
ffi (~> 1.0)
|
31
|
+
rubocop (0.78.0)
|
32
|
+
jaro_winkler (~> 1.5.1)
|
33
|
+
parallel (~> 1.10)
|
34
|
+
parser (>= 2.6)
|
35
|
+
rainbow (>= 2.2.2, < 4.0)
|
36
|
+
ruby-progressbar (~> 1.7)
|
37
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
38
|
+
ruby-progressbar (1.10.1)
|
39
|
+
sass (3.7.4)
|
40
|
+
sass-listen (~> 4.0.0)
|
41
|
+
sass-listen (4.0.0)
|
42
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
43
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
44
|
+
sprockets (3.7.2)
|
45
|
+
concurrent-ruby (~> 1.0)
|
46
|
+
rack (> 1, < 3)
|
47
|
+
unicode-display_width (1.6.0)
|
48
|
+
|
49
|
+
PLATFORMS
|
50
|
+
ruby
|
51
|
+
|
52
|
+
DEPENDENCIES
|
53
|
+
minitest
|
54
|
+
rake (>= 11)
|
55
|
+
rubocop
|
56
|
+
sass
|
57
|
+
simplecov!
|
58
|
+
simplecov-html!
|
59
|
+
sprockets (~> 3.7)
|
60
|
+
|
61
|
+
BUNDLED WITH
|
62
|
+
2.0.2
|
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@ Default HTML formatter for SimpleCov
|
|
3
3
|
|
4
4
|
***Note: To learn more about SimpleCov, check out the main repo at https://github.com/colszowka/simplecov***
|
5
5
|
|
6
|
-
Generates a nice HTML report of your SimpleCov ruby code coverage results on Ruby
|
6
|
+
Generates a nice HTML report of your SimpleCov ruby code coverage results on Ruby 2.4+ using client-side Javascript
|
7
7
|
quite extensively.
|
8
8
|
|
9
9
|
|
@@ -17,7 +17,7 @@ modify the formatter, please make sure the simplecov test suites still pass by d
|
|
17
17
|
* `cd` there, run `bundle`
|
18
18
|
* You should end up with all dev dependencies installed and simplecov-html being used from your disk
|
19
19
|
* Run the tests (units and features)
|
20
|
-
|
20
|
+
|
21
21
|
Please remember to add tests if you add functionality.
|
22
22
|
|
23
23
|
**Important:** If you modify the JS/CSS assets, you'll have to precompile them using `rake assets:compile` - otherwise,
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "bundler"
|
2
4
|
Bundler::GemHelper.install_tasks
|
3
5
|
|
@@ -21,7 +23,7 @@ begin
|
|
21
23
|
RuboCop::RakeTask.new
|
22
24
|
rescue LoadError
|
23
25
|
task :rubocop do
|
24
|
-
|
26
|
+
warn "Rubocop is disabled"
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
@@ -2,34 +2,36 @@
|
|
2
2
|
//= require_directory ./plugins/
|
3
3
|
//= require_self
|
4
4
|
|
5
|
-
$(document).ready(function() {
|
5
|
+
$(document).ready(function () {
|
6
|
+
branchCoverageActivated = $("body").data("branch-coverage") == true;
|
7
|
+
|
6
8
|
// Configuration for fancy sortable tables for source file groups
|
9
|
+
// For what these columns are, cecl out file_list.erb - null basically
|
10
|
+
// does normal/number style sorting which fine for hit/missed lines only
|
11
|
+
// percentages like "covered percent" need special sorting arguments.
|
12
|
+
lineColumns = [null, { "sType": "percent" }, null, null, null, null, null];
|
13
|
+
branchColumns = [{ "sType": "percent" }, null, null, null];
|
14
|
+
|
15
|
+
dataColumns = branchCoverageActivated ? lineColumns.concat(branchColumns) : lineColumns;
|
16
|
+
|
7
17
|
$('.file_list').dataTable({
|
8
|
-
"aaSorting": [[
|
18
|
+
"aaSorting": [[1, "asc"]],
|
9
19
|
"bPaginate": false,
|
10
20
|
"bJQueryUI": true,
|
11
|
-
"aoColumns":
|
12
|
-
null,
|
13
|
-
{ "sType": "percent" },
|
14
|
-
null,
|
15
|
-
null,
|
16
|
-
null,
|
17
|
-
null,
|
18
|
-
null
|
19
|
-
]
|
21
|
+
"aoColumns": dataColumns
|
20
22
|
});
|
21
23
|
|
22
24
|
// Syntax highlight all files up front - deactivated
|
23
25
|
// $('.source_table pre code').each(function(i, e) {hljs.highlightBlock(e, ' ')});
|
24
26
|
|
25
27
|
// Syntax highlight source files on first toggle of the file view popup
|
26
|
-
$("a.src_link").click(function() {
|
28
|
+
$("a.src_link").click(function () {
|
27
29
|
// Get the source file element that corresponds to the clicked element
|
28
30
|
var source_table = $($(this).attr('href'));
|
29
31
|
|
30
32
|
// If not highlighted yet, do it!
|
31
33
|
if (!source_table.hasClass('highlighted')) {
|
32
|
-
source_table.find('pre code').each(function(i, e) {hljs.highlightBlock(e, ' ')});
|
34
|
+
source_table.find('pre code').each(function (i, e) { hljs.highlightBlock(e, ' ') });
|
33
35
|
source_table.addClass('highlighted');
|
34
36
|
};
|
35
37
|
});
|
@@ -44,14 +46,14 @@ $(document).ready(function() {
|
|
44
46
|
opacity: 1,
|
45
47
|
width: "95%",
|
46
48
|
height: "95%",
|
47
|
-
onLoad: function() {
|
49
|
+
onLoad: function () {
|
48
50
|
prev_anchor = curr_anchor ? curr_anchor : jQuery.url.attr('anchor');
|
49
51
|
curr_anchor = this.href.split('#')[1];
|
50
52
|
window.location.hash = curr_anchor;
|
51
53
|
},
|
52
|
-
onCleanup: function() {
|
54
|
+
onCleanup: function () {
|
53
55
|
if (prev_anchor && prev_anchor != curr_anchor) {
|
54
|
-
$('a[href="#'+prev_anchor+'"]').click();
|
56
|
+
$('a[href="#' + prev_anchor + '"]').click();
|
55
57
|
curr_anchor = prev_anchor;
|
56
58
|
} else {
|
57
59
|
$('.group_tabs a:first').click();
|
@@ -62,13 +64,13 @@ $(document).ready(function() {
|
|
62
64
|
}
|
63
65
|
});
|
64
66
|
|
65
|
-
window.onpopstate = function(event){
|
66
|
-
if (location.hash.substring(0,2) == "#_") {
|
67
|
+
window.onpopstate = function (event) {
|
68
|
+
if (location.hash.substring(0, 2) == "#_") {
|
67
69
|
$.colorbox.close();
|
68
70
|
curr_anchor = jQuery.url.attr('anchor');
|
69
71
|
} else {
|
70
72
|
if ($('#colorbox').is(':hidden')) {
|
71
|
-
$('a.src_link[href="'+location.hash+'"]').colorbox({ open: true });
|
73
|
+
$('a.src_link[href="' + location.hash + '"]').colorbox({ open: true });
|
72
74
|
}
|
73
75
|
}
|
74
76
|
};
|
@@ -78,23 +80,23 @@ $(document).ready(function() {
|
|
78
80
|
$('.file_list_container').hide();
|
79
81
|
|
80
82
|
// Add tabs based upon existing file_list_containers
|
81
|
-
$('.file_list_container h2').each(function(){
|
83
|
+
$('.file_list_container h2').each(function () {
|
82
84
|
var container_id = $(this).parent().attr('id');
|
83
85
|
var group_name = $(this).find('.group_name').first().html();
|
84
86
|
var covered_percent = $(this).find('.covered_percent').first().html();
|
85
87
|
|
86
|
-
$('.group_tabs').append('<li><a href="#' + container_id + '">' + group_name + ' ('+ covered_percent +')</a></li>');
|
88
|
+
$('.group_tabs').append('<li><a href="#' + container_id + '">' + group_name + ' (' + covered_percent + ')</a></li>');
|
87
89
|
});
|
88
90
|
|
89
|
-
$('.group_tabs a').each(
|
91
|
+
$('.group_tabs a').each(function () {
|
90
92
|
$(this).addClass($(this).attr('href').replace('#', ''));
|
91
93
|
});
|
92
94
|
|
93
95
|
// Make sure tabs don't get ugly focus borders when active
|
94
|
-
$('.group_tabs a').live('focus', function() { $(this).blur(); });
|
96
|
+
$('.group_tabs a').live('focus', function () { $(this).blur(); });
|
95
97
|
|
96
98
|
var favicon_path = $('link[rel="shortcut icon"]').attr('href');
|
97
|
-
$('.group_tabs a').live('click', function(){
|
99
|
+
$('.group_tabs a').live('click', function () {
|
98
100
|
if (!$(this).parent().hasClass('active')) {
|
99
101
|
$('.group_tabs a').parent().removeClass('active');
|
100
102
|
$(this).parent().addClass('active');
|
@@ -105,7 +107,7 @@ $(document).ready(function() {
|
|
105
107
|
// Force favicon reload - otherwise the location change containing anchor would drop the favicon...
|
106
108
|
// Works only on firefox, but still... - Anyone know a better solution to force favicon on local file?
|
107
109
|
$('link[rel="shortcut icon"]').remove();
|
108
|
-
$('head').append('<link rel="shortcut icon" type="image/png" href="'+ favicon_path +'" />');
|
110
|
+
$('head').append('<link rel="shortcut icon" type="image/png" href="' + favicon_path + '" />');
|
109
111
|
};
|
110
112
|
return false;
|
111
113
|
});
|
@@ -115,7 +117,7 @@ $(document).ready(function() {
|
|
115
117
|
if (anchor.length == 40) {
|
116
118
|
$('a.src_link[href=#' + anchor + ']').click();
|
117
119
|
} else {
|
118
|
-
$('.group_tabs a.'+anchor.replace('_', '')).click();
|
120
|
+
$('.group_tabs a.' + anchor.replace('_', '')).click();
|
119
121
|
}
|
120
122
|
} else {
|
121
123
|
$('.group_tabs a:first').click();
|
@@ -124,4 +126,5 @@ $(document).ready(function() {
|
|
124
126
|
$("abbr.timeago").timeago();
|
125
127
|
$('#loading').fadeOut();
|
126
128
|
$('#wrapper').show();
|
129
|
+
$('.dataTables_filter input').focus()
|
127
130
|
});
|
@@ -188,6 +188,8 @@ td
|
|
188
188
|
|
189
189
|
.yellow
|
190
190
|
color: #da0
|
191
|
+
.blue
|
192
|
+
color: blue
|
191
193
|
|
192
194
|
.source_table
|
193
195
|
.covered
|
@@ -198,6 +200,8 @@ td
|
|
198
200
|
border-color: black
|
199
201
|
.skipped
|
200
202
|
border-color: #fc0
|
203
|
+
.missed-branch
|
204
|
+
border-color: #bf0000
|
201
205
|
.covered
|
202
206
|
&:nth-child(odd)
|
203
207
|
background-color: #CDF2CD
|
@@ -217,4 +221,9 @@ td
|
|
217
221
|
&:nth-child(odd)
|
218
222
|
background-color: #FBF0C0
|
219
223
|
&:nth-child(even)
|
220
|
-
background-color: #FBFfCf
|
224
|
+
background-color: #FBFfCf
|
225
|
+
.missed-branch
|
226
|
+
&:nth-child(odd)
|
227
|
+
background-color: #cc8e8e
|
228
|
+
&:nth-child(even)
|
229
|
+
background-color: #cc6e6e
|
data/lib/simplecov-html.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "erb"
|
2
4
|
require "cgi"
|
3
5
|
require "fileutils"
|
@@ -14,6 +16,10 @@ end
|
|
14
16
|
module SimpleCov
|
15
17
|
module Formatter
|
16
18
|
class HTMLFormatter
|
19
|
+
def initialize
|
20
|
+
@branchable_result = SimpleCov.branch_coverage?
|
21
|
+
end
|
22
|
+
|
17
23
|
def format(result)
|
18
24
|
Dir[File.join(File.dirname(__FILE__), "../public/*")].each do |path|
|
19
25
|
FileUtils.cp_r(path, asset_output_path)
|
@@ -29,6 +35,21 @@ module SimpleCov
|
|
29
35
|
"Coverage report generated for #{result.command_name} to #{output_path}. #{result.covered_lines} / #{result.total_lines} LOC (#{result.covered_percent.round(2)}%) covered."
|
30
36
|
end
|
31
37
|
|
38
|
+
def branchable_result?
|
39
|
+
# cached in initialize because we truly look it up a whole bunch of times
|
40
|
+
# and it's easier to cache here then in SimpleCov because there we might
|
41
|
+
# still enable/disable branch coverage criterion
|
42
|
+
@branchable_result
|
43
|
+
end
|
44
|
+
|
45
|
+
def line_status?(source_file, line)
|
46
|
+
if branchable_result? && source_file.line_with_missed_branch?(line.number)
|
47
|
+
"missed-branch"
|
48
|
+
else
|
49
|
+
line.status
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
32
53
|
private
|
33
54
|
|
34
55
|
# Returns the an erb instance for the template of given name
|
@@ -42,6 +63,7 @@ module SimpleCov
|
|
42
63
|
|
43
64
|
def asset_output_path
|
44
65
|
return @asset_output_path if defined?(@asset_output_path) && @asset_output_path
|
66
|
+
|
45
67
|
@asset_output_path = File.join(output_path, "assets", SimpleCov::Formatter::HTMLFormatter::VERSION)
|
46
68
|
FileUtils.mkdir_p(@asset_output_path)
|
47
69
|
@asset_output_path
|
@@ -54,6 +76,8 @@ module SimpleCov
|
|
54
76
|
# Returns the html for the given source_file
|
55
77
|
def formatted_source_file(source_file)
|
56
78
|
template("source_file").result(binding)
|
79
|
+
rescue Encoding::CompatibilityError => e
|
80
|
+
puts "Encoding problems with file #{source_file.filename}. Simplecov/ERB can't handle non ASCII characters in filenames. Error: #{e.message}."
|
57
81
|
end
|
58
82
|
|
59
83
|
# Returns a table containing the given source files
|
@@ -66,6 +90,10 @@ module SimpleCov
|
|
66
90
|
template("file_list").result(binding)
|
67
91
|
end
|
68
92
|
|
93
|
+
def covered_percent(percent)
|
94
|
+
template("covered_percent").result(binding)
|
95
|
+
end
|
96
|
+
|
69
97
|
def coverage_css_class(covered_percent)
|
70
98
|
if covered_percent > 90
|
71
99
|
"green"
|
data/public/application.css
CHANGED
@@ -532,6 +532,7 @@ pre .tex .formula {
|
|
532
532
|
ColorBox Core Style:
|
533
533
|
The following CSS is consistent between example themes and should not be altered.
|
534
534
|
*/
|
535
|
+
|
535
536
|
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
|
536
537
|
#cboxOverlay{position:fixed; width:100%; height:100%;}
|
537
538
|
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
|
@@ -586,19 +587,19 @@ pre .tex .formula {
|
|
586
587
|
top: 50%; }
|
587
588
|
|
588
589
|
a {
|
589
|
-
color: #
|
590
|
+
color: #333;
|
590
591
|
text-decoration: none; }
|
591
592
|
a:hover {
|
592
|
-
color:
|
593
|
+
color: #000;
|
593
594
|
text-decoration: underline; }
|
594
595
|
|
595
596
|
body {
|
596
597
|
font-family: "Lucida Grande", Helvetica, "Helvetica Neue", Arial, sans-serif;
|
597
598
|
padding: 12px;
|
598
|
-
background-color: #
|
599
|
+
background-color: #333; }
|
599
600
|
|
600
601
|
h1, h2, h3, h4 {
|
601
|
-
color: #
|
602
|
+
color: #1C2324;
|
602
603
|
margin: 0;
|
603
604
|
padding: 0;
|
604
605
|
margin-bottom: 12px; }
|
@@ -609,8 +610,8 @@ table {
|
|
609
610
|
#content {
|
610
611
|
clear: left;
|
611
612
|
background-color: white;
|
612
|
-
border: 2px solid #
|
613
|
-
border-top: 8px solid #
|
613
|
+
border: 2px solid #ddd;
|
614
|
+
border-top: 8px solid #ddd;
|
614
615
|
padding: 18px;
|
615
616
|
-webkit-border-bottom-left-radius: 5px;
|
616
617
|
-webkit-border-bottom-right-radius: 5px;
|
@@ -632,7 +633,7 @@ abbr.timeago {
|
|
632
633
|
|
633
634
|
.timestamp {
|
634
635
|
float: right;
|
635
|
-
color: #
|
636
|
+
color: #ddd; }
|
636
637
|
|
637
638
|
.group_tabs {
|
638
639
|
list-style: none;
|
@@ -648,13 +649,13 @@ abbr.timeago {
|
|
648
649
|
float: left;
|
649
650
|
text-decoration: none;
|
650
651
|
padding: 4px 8px;
|
651
|
-
background-color: #
|
652
|
+
background-color: #aaa;
|
652
653
|
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#dddddd), to(#aaaaaa));
|
653
654
|
background: -moz-linear-gradient(#dddddd, #aaaaaa);
|
654
655
|
background: linear-gradient(#dddddd, #aaaaaa);
|
655
656
|
text-shadow: #e5e5e5 1px 1px 0px;
|
656
657
|
border-bottom: none;
|
657
|
-
color: #
|
658
|
+
color: #333;
|
658
659
|
font-weight: bold;
|
659
660
|
margin-right: 8px;
|
660
661
|
border-top: 1px solid #efefef;
|
@@ -665,7 +666,7 @@ abbr.timeago {
|
|
665
666
|
border-top-left-radius: 2px;
|
666
667
|
border-top-right-radius: 2px; }
|
667
668
|
.group_tabs li a:hover {
|
668
|
-
background-color: #
|
669
|
+
background-color: #ccc;
|
669
670
|
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#eeeeee), to(#aaaaaa));
|
670
671
|
background: -moz-linear-gradient(#eeeeee, #aaaaaa);
|
671
672
|
background: linear-gradient(#eeeeee, #aaaaaa); }
|
@@ -674,8 +675,8 @@ abbr.timeago {
|
|
674
675
|
padding-bottom: 3px; }
|
675
676
|
.group_tabs li.active a {
|
676
677
|
color: black;
|
677
|
-
text-shadow:
|
678
|
-
background-color: #
|
678
|
+
text-shadow: #fff 1px 1px 0px;
|
679
|
+
background-color: #ddd;
|
679
680
|
background: -webkit-gradient(linear, 0 0, 0 bottom, from(white), to(#dddddd));
|
680
681
|
background: -moz-linear-gradient(white, #dddddd);
|
681
682
|
background: linear-gradient(white, #dddddd); }
|
@@ -713,13 +714,13 @@ td {
|
|
713
714
|
margin: 0;
|
714
715
|
padding: 0;
|
715
716
|
white-space: normal;
|
716
|
-
color:
|
717
|
+
color: #000;
|
717
718
|
font-family: "Monaco", "Inconsolata", "Consolas", monospace; }
|
718
719
|
.source_table code {
|
719
|
-
color:
|
720
|
+
color: #000;
|
720
721
|
font-family: "Monaco", "Inconsolata", "Consolas", monospace; }
|
721
722
|
.source_table pre {
|
722
|
-
background-color: #
|
723
|
+
background-color: #333; }
|
723
724
|
.source_table pre ol {
|
724
725
|
margin: 0px;
|
725
726
|
padding: 0px;
|
@@ -737,7 +738,7 @@ td {
|
|
737
738
|
float: right;
|
738
739
|
margin-left: 10px;
|
739
740
|
padding: 2px 4px;
|
740
|
-
background-color: #
|
741
|
+
background-color: #444;
|
741
742
|
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#222222), to(#666666));
|
742
743
|
background: -moz-linear-gradient(#222222, #666666);
|
743
744
|
background: linear-gradient(#222222, #666666);
|
@@ -749,51 +750,60 @@ td {
|
|
749
750
|
border-radius: 6px; }
|
750
751
|
|
751
752
|
#footer {
|
752
|
-
color: #
|
753
|
+
color: #ddd;
|
753
754
|
font-size: 12px;
|
754
755
|
font-weight: bold;
|
755
756
|
margin-top: 12px;
|
756
757
|
text-align: right; }
|
757
758
|
#footer a {
|
758
|
-
color: #
|
759
|
+
color: #eee;
|
759
760
|
text-decoration: underline; }
|
760
761
|
#footer a:hover {
|
761
|
-
color:
|
762
|
+
color: #fff;
|
762
763
|
text-decoration: none; }
|
763
764
|
|
764
765
|
.green {
|
765
|
-
color: #
|
766
|
+
color: #090; }
|
766
767
|
|
767
768
|
.red {
|
768
|
-
color: #
|
769
|
+
color: #900; }
|
769
770
|
|
770
771
|
.yellow {
|
771
|
-
color: #
|
772
|
+
color: #da0; }
|
773
|
+
|
774
|
+
.blue {
|
775
|
+
color: blue; }
|
772
776
|
|
773
777
|
.source_table .covered {
|
774
|
-
border-color: #
|
778
|
+
border-color: #090; }
|
775
779
|
.source_table .missed {
|
776
|
-
border-color: #
|
780
|
+
border-color: #900; }
|
777
781
|
.source_table .never {
|
778
782
|
border-color: black; }
|
779
783
|
.source_table .skipped {
|
780
|
-
border-color: #
|
784
|
+
border-color: #fc0; }
|
785
|
+
.source_table .missed-branch {
|
786
|
+
border-color: #bf0000; }
|
781
787
|
.source_table .covered:nth-child(odd) {
|
782
|
-
background-color: #
|
788
|
+
background-color: #CDF2CD; }
|
783
789
|
.source_table .covered:nth-child(even) {
|
784
|
-
background-color: #
|
790
|
+
background-color: #DBF2DB; }
|
785
791
|
.source_table .missed:nth-child(odd) {
|
786
|
-
background-color: #
|
792
|
+
background-color: #F7C0C0; }
|
787
793
|
.source_table .missed:nth-child(even) {
|
788
|
-
background-color: #
|
794
|
+
background-color: #F7CFCF; }
|
789
795
|
.source_table .never:nth-child(odd) {
|
790
796
|
background-color: #efefef; }
|
791
797
|
.source_table .never:nth-child(even) {
|
792
798
|
background-color: #f4f4f4; }
|
793
799
|
.source_table .skipped:nth-child(odd) {
|
794
|
-
background-color: #
|
800
|
+
background-color: #FBF0C0; }
|
795
801
|
.source_table .skipped:nth-child(even) {
|
796
|
-
background-color: #
|
802
|
+
background-color: #FBFfCf; }
|
803
|
+
.source_table .missed-branch:nth-child(odd) {
|
804
|
+
background-color: #cc8e8e; }
|
805
|
+
.source_table .missed-branch:nth-child(even) {
|
806
|
+
background-color: #cc6e6e; }
|
797
807
|
|
798
808
|
|
799
809
|
|
data/public/application.js
CHANGED
@@ -1582,34 +1582,33 @@ jQuery.url = function()
|
|
1582
1582
|
|
1583
1583
|
|
1584
1584
|
|
1585
|
-
$(document).ready(function() {
|
1585
|
+
$(document).ready(function () {
|
1586
|
+
branchCoverageActivated = $("body").data("branch-coverage") == true;
|
1587
|
+
|
1586
1588
|
// Configuration for fancy sortable tables for source file groups
|
1589
|
+
lineColumns = [null, { "sType": "percent" }, null, null, null, null, null];
|
1590
|
+
branchColumns = [{ "sType": "percent" }, null, null, null];
|
1591
|
+
|
1592
|
+
dataColumns = branchCoverageActivated ? lineColumns.concat(branchColumns) : lineColumns;
|
1593
|
+
|
1587
1594
|
$('.file_list').dataTable({
|
1588
|
-
"aaSorting": [[
|
1595
|
+
"aaSorting": [[1, "asc"]],
|
1589
1596
|
"bPaginate": false,
|
1590
1597
|
"bJQueryUI": true,
|
1591
|
-
"aoColumns":
|
1592
|
-
null,
|
1593
|
-
{ "sType": "percent" },
|
1594
|
-
null,
|
1595
|
-
null,
|
1596
|
-
null,
|
1597
|
-
null,
|
1598
|
-
null
|
1599
|
-
]
|
1598
|
+
"aoColumns": dataColumns
|
1600
1599
|
});
|
1601
1600
|
|
1602
1601
|
// Syntax highlight all files up front - deactivated
|
1603
1602
|
// $('.source_table pre code').each(function(i, e) {hljs.highlightBlock(e, ' ')});
|
1604
1603
|
|
1605
1604
|
// Syntax highlight source files on first toggle of the file view popup
|
1606
|
-
$("a.src_link").click(function() {
|
1605
|
+
$("a.src_link").click(function () {
|
1607
1606
|
// Get the source file element that corresponds to the clicked element
|
1608
1607
|
var source_table = $($(this).attr('href'));
|
1609
1608
|
|
1610
1609
|
// If not highlighted yet, do it!
|
1611
1610
|
if (!source_table.hasClass('highlighted')) {
|
1612
|
-
source_table.find('pre code').each(function(i, e) {hljs.highlightBlock(e, ' ')});
|
1611
|
+
source_table.find('pre code').each(function (i, e) { hljs.highlightBlock(e, ' ') });
|
1613
1612
|
source_table.addClass('highlighted');
|
1614
1613
|
};
|
1615
1614
|
});
|
@@ -1624,14 +1623,14 @@ $(document).ready(function() {
|
|
1624
1623
|
opacity: 1,
|
1625
1624
|
width: "95%",
|
1626
1625
|
height: "95%",
|
1627
|
-
onLoad: function() {
|
1626
|
+
onLoad: function () {
|
1628
1627
|
prev_anchor = curr_anchor ? curr_anchor : jQuery.url.attr('anchor');
|
1629
1628
|
curr_anchor = this.href.split('#')[1];
|
1630
1629
|
window.location.hash = curr_anchor;
|
1631
1630
|
},
|
1632
|
-
onCleanup: function() {
|
1631
|
+
onCleanup: function () {
|
1633
1632
|
if (prev_anchor && prev_anchor != curr_anchor) {
|
1634
|
-
$('a[href="#'+prev_anchor+'"]').click();
|
1633
|
+
$('a[href="#' + prev_anchor + '"]').click();
|
1635
1634
|
curr_anchor = prev_anchor;
|
1636
1635
|
} else {
|
1637
1636
|
$('.group_tabs a:first').click();
|
@@ -1642,13 +1641,13 @@ $(document).ready(function() {
|
|
1642
1641
|
}
|
1643
1642
|
});
|
1644
1643
|
|
1645
|
-
window.onpopstate = function(event){
|
1646
|
-
if (location.hash.substring(0,2) == "#_") {
|
1644
|
+
window.onpopstate = function (event) {
|
1645
|
+
if (location.hash.substring(0, 2) == "#_") {
|
1647
1646
|
$.colorbox.close();
|
1648
1647
|
curr_anchor = jQuery.url.attr('anchor');
|
1649
1648
|
} else {
|
1650
1649
|
if ($('#colorbox').is(':hidden')) {
|
1651
|
-
$('a.src_link[href="'+location.hash+'"]').colorbox({ open: true });
|
1650
|
+
$('a.src_link[href="' + location.hash + '"]').colorbox({ open: true });
|
1652
1651
|
}
|
1653
1652
|
}
|
1654
1653
|
};
|
@@ -1658,23 +1657,23 @@ $(document).ready(function() {
|
|
1658
1657
|
$('.file_list_container').hide();
|
1659
1658
|
|
1660
1659
|
// Add tabs based upon existing file_list_containers
|
1661
|
-
$('.file_list_container h2').each(function(){
|
1660
|
+
$('.file_list_container h2').each(function () {
|
1662
1661
|
var container_id = $(this).parent().attr('id');
|
1663
1662
|
var group_name = $(this).find('.group_name').first().html();
|
1664
1663
|
var covered_percent = $(this).find('.covered_percent').first().html();
|
1665
1664
|
|
1666
|
-
$('.group_tabs').append('<li><a href="#' + container_id + '">' + group_name + ' ('+ covered_percent +')</a></li>');
|
1665
|
+
$('.group_tabs').append('<li><a href="#' + container_id + '">' + group_name + ' (' + covered_percent + ')</a></li>');
|
1667
1666
|
});
|
1668
1667
|
|
1669
|
-
$('.group_tabs a').each(
|
1668
|
+
$('.group_tabs a').each(function () {
|
1670
1669
|
$(this).addClass($(this).attr('href').replace('#', ''));
|
1671
1670
|
});
|
1672
1671
|
|
1673
1672
|
// Make sure tabs don't get ugly focus borders when active
|
1674
|
-
$('.group_tabs a').live('focus', function() { $(this).blur(); });
|
1673
|
+
$('.group_tabs a').live('focus', function () { $(this).blur(); });
|
1675
1674
|
|
1676
1675
|
var favicon_path = $('link[rel="shortcut icon"]').attr('href');
|
1677
|
-
$('.group_tabs a').live('click', function(){
|
1676
|
+
$('.group_tabs a').live('click', function () {
|
1678
1677
|
if (!$(this).parent().hasClass('active')) {
|
1679
1678
|
$('.group_tabs a').parent().removeClass('active');
|
1680
1679
|
$(this).parent().addClass('active');
|
@@ -1685,7 +1684,7 @@ $(document).ready(function() {
|
|
1685
1684
|
// Force favicon reload - otherwise the location change containing anchor would drop the favicon...
|
1686
1685
|
// Works only on firefox, but still... - Anyone know a better solution to force favicon on local file?
|
1687
1686
|
$('link[rel="shortcut icon"]').remove();
|
1688
|
-
$('head').append('<link rel="shortcut icon" type="image/png" href="'+ favicon_path +'" />');
|
1687
|
+
$('head').append('<link rel="shortcut icon" type="image/png" href="' + favicon_path + '" />');
|
1689
1688
|
};
|
1690
1689
|
return false;
|
1691
1690
|
});
|
@@ -1695,7 +1694,7 @@ $(document).ready(function() {
|
|
1695
1694
|
if (anchor.length == 40) {
|
1696
1695
|
$('a.src_link[href=#' + anchor + ']').click();
|
1697
1696
|
} else {
|
1698
|
-
$('.group_tabs a.'+anchor.replace('_', '')).click();
|
1697
|
+
$('.group_tabs a.' + anchor.replace('_', '')).click();
|
1699
1698
|
}
|
1700
1699
|
} else {
|
1701
1700
|
$('.group_tabs a:first').click();
|
@@ -1704,4 +1703,5 @@ $(document).ready(function() {
|
|
1704
1703
|
$("abbr.timeago").timeago();
|
1705
1704
|
$('#loading').fadeOut();
|
1706
1705
|
$('#wrapper').show();
|
1706
|
+
$('.dataTables_filter input').focus()
|
1707
1707
|
});
|
data/simplecov-html.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
|
2
4
|
require "simplecov-html/version"
|
3
5
|
|
@@ -8,12 +10,11 @@ Gem::Specification.new do |gem|
|
|
8
10
|
gem.authors = ["Christoph Olszowka"]
|
9
11
|
gem.email = ["christoph at olszowka de"]
|
10
12
|
gem.homepage = "https://github.com/colszowka/simplecov-html"
|
11
|
-
gem.description = %(Default HTML formatter for SimpleCov code coverage tool for ruby
|
13
|
+
gem.description = %(Default HTML formatter for SimpleCov code coverage tool for ruby 2.4+)
|
12
14
|
gem.summary = gem.description
|
13
15
|
gem.license = "MIT"
|
14
16
|
|
15
|
-
gem.required_ruby_version = "
|
16
|
-
gem.add_development_dependency "bundler", "~> 1.9"
|
17
|
+
gem.required_ruby_version = "~> 2.4"
|
17
18
|
|
18
19
|
gem.files = `git ls-files`.split("\n")
|
19
20
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/test/helper.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "helper"
|
2
4
|
|
3
|
-
class TestSimpleCovHtml <
|
5
|
+
class TestSimpleCovHtml < Minitest::Test
|
4
6
|
def test_defined
|
5
7
|
assert defined?(SimpleCov::Formatter::HTMLFormatter)
|
6
8
|
assert defined?(SimpleCov::Formatter::HTMLFormatter::VERSION)
|
data/views/file_list.erb
CHANGED
@@ -1,21 +1,40 @@
|
|
1
1
|
<div class="file_list_container" id="<%= title_id %>">
|
2
2
|
<h2>
|
3
3
|
<span class="group_name"><%= title %></span>
|
4
|
-
(<span class="covered_percent"
|
4
|
+
(<span class="covered_percent">
|
5
|
+
<%= covered_percent(source_files.covered_percent) %>
|
6
|
+
</span>
|
5
7
|
covered at
|
6
8
|
<span class="covered_strength">
|
7
9
|
<span class="<%= strength_css_class(source_files.covered_strength) %>">
|
8
10
|
<%= source_files.covered_strength.round(2) %>
|
9
11
|
</span>
|
10
|
-
</span> hits/line
|
12
|
+
</span> hits/line
|
13
|
+
)
|
11
14
|
</h2>
|
15
|
+
|
12
16
|
<a name="<%= title_id %>"></a>
|
17
|
+
|
13
18
|
<div>
|
14
19
|
<b><%= source_files.length %></b> files in total.
|
15
|
-
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div class="t-line-summary">
|
23
|
+
<b><%= source_files.lines_of_code %></b> relevant lines,
|
16
24
|
<span class="green"><b><%= source_files.covered_lines %></b> lines covered</span> and
|
17
|
-
<span class="red"><b><%= source_files.missed_lines %></b> lines missed </span>
|
25
|
+
<span class="red"><b><%= source_files.missed_lines %></b> lines missed. </span>
|
26
|
+
(<%= covered_percent(source_files.covered_percent) %>)
|
18
27
|
</div>
|
28
|
+
|
29
|
+
<% if branchable_result? %>
|
30
|
+
<div class="t-branch-summary">
|
31
|
+
<span><b><%= source_files.total_branches %></b> total branches, </span>
|
32
|
+
<span class="green"><b><%= source_files.covered_branches %></b> branches covered</span> and
|
33
|
+
<span class="red"><b><%= source_files.missed_branches %></b> branches missed.</span>
|
34
|
+
(<%= covered_percent(source_files.branch_covered_percent) %>)
|
35
|
+
</div>
|
36
|
+
<% end %>
|
37
|
+
|
19
38
|
<table class="file_list">
|
20
39
|
<thead>
|
21
40
|
<tr>
|
@@ -26,19 +45,31 @@
|
|
26
45
|
<th>Lines covered</th>
|
27
46
|
<th>Lines missed</th>
|
28
47
|
<th>Avg. Hits / Line</th>
|
48
|
+
<% if branchable_result? %>
|
49
|
+
<th>Branch Coverage</th>
|
50
|
+
<th>Branches</th>
|
51
|
+
<th>Covered branches</th>
|
52
|
+
<th>Missed branches </th>
|
53
|
+
<% end %>
|
29
54
|
</tr>
|
30
55
|
</thead>
|
31
56
|
<tbody>
|
32
57
|
<% source_files.each do |source_file| %>
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
58
|
+
<tr class="t-file">
|
59
|
+
<td class="strong t-file__name"><%= link_to_source_file(source_file) %></td>
|
60
|
+
<td class="<%= coverage_css_class(source_file.covered_percent) %> strong t-file__coverage"><%= source_file.covered_percent.round(2).to_s %> %</td>
|
61
|
+
<td><%= source_file.lines.count %></td>
|
62
|
+
<td><%= source_file.covered_lines.count + source_file.missed_lines.count %></td>
|
63
|
+
<td><%= source_file.covered_lines.count %></td>
|
64
|
+
<td><%= source_file.missed_lines.count %></td>
|
65
|
+
<td><%= source_file.covered_strength.round(2) %></td>
|
66
|
+
<% if branchable_result? %>
|
67
|
+
<td class="<%= coverage_css_class(source_file.branches_coverage_percent) %> strong t-file__branch-coverage"><%= source_file.branches_coverage_percent.round(2).to_s %> %</td>
|
68
|
+
<td><%= source_file.total_branches.count %></td>
|
69
|
+
<td><%= source_file.covered_branches.count %></td>
|
70
|
+
<td><%= source_file.missed_branches.count %></td>
|
71
|
+
<% end %>
|
72
|
+
</tr>
|
42
73
|
<% end %>
|
43
74
|
</tbody>
|
44
75
|
</table>
|
data/views/layout.erb
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
<head>
|
4
4
|
<title>Code coverage for <%= SimpleCov.project_name %></title>
|
5
5
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
6
|
-
<script src='<%= assets_path('application.js') %>' type='text/javascript'></script>
|
6
|
+
<script src='<%= assets_path('application.js') %>' type='text/javascript'></script>
|
7
7
|
<link href='<%= assets_path('application.css') %>' media='screen, projection, print' rel='stylesheet' type='text/css'>
|
8
8
|
<link rel="shortcut icon" type="image/png" href="<%= assets_path("favicon_#{coverage_css_class(result.source_files.covered_percent)}.png") %>" />
|
9
9
|
<link rel="icon" type="image/png" href="<%= assets_path('favicon.png') %>" />
|
10
10
|
</head>
|
11
|
-
|
12
|
-
<body
|
11
|
+
|
12
|
+
<body<%= ' data-branch-coverage=true' if branchable_result? %>>
|
13
13
|
<div id="loading">
|
14
14
|
<img src="<%= assets_path('loading.gif') %>" alt="loading"/>
|
15
15
|
</div>
|
@@ -24,13 +24,13 @@
|
|
24
24
|
<%= formatted_file_list(name, files) %>
|
25
25
|
<% end %>
|
26
26
|
</div>
|
27
|
-
|
27
|
+
|
28
28
|
<div id="footer">
|
29
|
-
Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v<%= SimpleCov::VERSION %>
|
29
|
+
Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v<%= SimpleCov::VERSION %>
|
30
30
|
and simplecov-html v<%= SimpleCov::Formatter::HTMLFormatter::VERSION %><br/>
|
31
31
|
using <%= result.command_name %>
|
32
32
|
</div>
|
33
|
-
|
33
|
+
|
34
34
|
<div class="source_files">
|
35
35
|
<% result.source_files.each do |source_file| %>
|
36
36
|
<%= formatted_source_file(source_file) %>
|
data/views/source_file.erb
CHANGED
@@ -1,22 +1,53 @@
|
|
1
1
|
<div class="source_table" id="<%= id source_file %>">
|
2
2
|
<div class="header">
|
3
3
|
<h3><%= shortened_filename source_file %></h3>
|
4
|
-
<h4
|
5
|
-
|
6
|
-
|
4
|
+
<h4>
|
5
|
+
<%= covered_percent(source_file.covered_percent) %>
|
6
|
+
lines covered
|
7
|
+
</h4>
|
8
|
+
|
9
|
+
<% if branchable_result? %>
|
10
|
+
<h4>
|
11
|
+
<%= covered_percent(source_file.branches_coverage_percent) %>
|
12
|
+
branches covered
|
13
|
+
</h4>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<div class="t-line-summary">
|
17
|
+
<b><%= source_file.lines_of_code %></b> relevant lines.
|
7
18
|
<span class="green"><b><%= source_file.covered_lines.count %></b> lines covered</span> and
|
8
19
|
<span class="red"><b><%= source_file.missed_lines.count %></b> lines missed.</span>
|
9
20
|
</div>
|
21
|
+
|
22
|
+
<% if branchable_result? %>
|
23
|
+
<div class="t-branch-summary">
|
24
|
+
<span><b><%= source_file.total_branches.count %></b> total branches, </span>
|
25
|
+
<span class="green"><b><%= source_file.covered_branches.count %></b> branches covered</span> and
|
26
|
+
<span class="red"><b><%= source_file.missed_branches.count %></b> branches missed.</span>
|
27
|
+
</div>
|
28
|
+
<% end %>
|
29
|
+
|
10
30
|
</div>
|
11
|
-
|
31
|
+
|
12
32
|
<pre>
|
13
33
|
<ol>
|
14
34
|
<% source_file.lines.each do |line| %>
|
15
|
-
<
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
35
|
+
<div>
|
36
|
+
<li class="<%= line_status?(source_file, line) %>" data-hits="<%= line.coverage ? line.coverage : '' %>" data-linenumber="<%= line.number %>">
|
37
|
+
<% if line.covered? %><span class="hits"><%= line.coverage %></span><% end %>
|
38
|
+
<% if line.skipped? %><span class="hits">skipped</span><% end %>
|
39
|
+
|
40
|
+
<% if branchable_result? %>
|
41
|
+
<% source_file.branches_for_line(line.number).each do |branch_type, hit_count| %>
|
42
|
+
<span class="hits" title="<%= branch_type%> branch hit <%= hit_count %> times">
|
43
|
+
<%= branch_type %>: <%= hit_count %>
|
44
|
+
</span>
|
45
|
+
<% end %>
|
46
|
+
<% end %>
|
47
|
+
|
48
|
+
<code class="ruby"><%= CGI.escapeHTML(line.src.chomp) %></code>
|
49
|
+
</li>
|
50
|
+
</div>
|
20
51
|
<% end %>
|
21
52
|
</ol>
|
22
53
|
</pre>
|
metadata
CHANGED
@@ -1,30 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplecov-html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christoph Olszowka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.9'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.9'
|
27
|
-
description: Default HTML formatter for SimpleCov code coverage tool for ruby 1.9+
|
11
|
+
date: 2020-01-28 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Default HTML formatter for SimpleCov code coverage tool for ruby 2.4+
|
28
14
|
email:
|
29
15
|
- christoph at olszowka de
|
30
16
|
executables: []
|
@@ -34,9 +20,11 @@ files:
|
|
34
20
|
- ".document"
|
35
21
|
- ".gitignore"
|
36
22
|
- ".rubocop.yml"
|
23
|
+
- ".tool-versions"
|
37
24
|
- ".travis.yml"
|
38
25
|
- CHANGELOG.md
|
39
26
|
- Gemfile
|
27
|
+
- Gemfile.lock
|
40
28
|
- Guardfile
|
41
29
|
- LICENSE
|
42
30
|
- README.md
|
@@ -83,6 +71,7 @@ files:
|
|
83
71
|
- simplecov-html.gemspec
|
84
72
|
- test/helper.rb
|
85
73
|
- test/test_simple_cov-html.rb
|
74
|
+
- views/covered_percent.erb
|
86
75
|
- views/file_list.erb
|
87
76
|
- views/layout.erb
|
88
77
|
- views/source_file.erb
|
@@ -96,18 +85,17 @@ require_paths:
|
|
96
85
|
- lib
|
97
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
87
|
requirements:
|
99
|
-
- - "
|
88
|
+
- - "~>"
|
100
89
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
90
|
+
version: '2.4'
|
102
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
92
|
requirements:
|
104
93
|
- - ">="
|
105
94
|
- !ruby/object:Gem::Version
|
106
95
|
version: '0'
|
107
96
|
requirements: []
|
108
|
-
|
109
|
-
rubygems_version: 2.6.10
|
97
|
+
rubygems_version: 3.0.3
|
110
98
|
signing_key:
|
111
99
|
specification_version: 4
|
112
|
-
summary: Default HTML formatter for SimpleCov code coverage tool for ruby
|
100
|
+
summary: Default HTML formatter for SimpleCov code coverage tool for ruby 2.4+
|
113
101
|
test_files: []
|