Hello community,
here is the log from the commit of package rubygem-simplecov-html for
openSUSE:Factory checked in at 2020-03-07 21:40:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-simplecov-html (Old)
and /work/SRC/openSUSE:Factory/.rubygem-simplecov-html.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-simplecov-html"
Sat Mar 7 21:40:06 2020 rev:14 rq:773851 version:0.11.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-simplecov-html/rubygem-simplecov-html.changes
2017-08-16 16:18:55.869441475 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-simplecov-html.new.26092/rubygem-simplecov-html.changes
2020-03-07 21:40:10.688350728 +0100
@@ -1,0 +2,6 @@
+Mon Feb 10 15:50:02 UTC 2020 - Stephan Kulow <[email protected]>
+
+- updated to version 0.11.0
+ see installed CHANGELOG.md
+
+-------------------------------------------------------------------
Old:
----
simplecov-html-0.10.2.gem
New:
----
simplecov-html-0.11.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-simplecov-html.spec ++++++
--- /var/tmp/diff_new_pack.rDwgVe/_old 2020-03-07 21:40:11.840351506 +0100
+++ /var/tmp/diff_new_pack.rDwgVe/_new 2020-03-07 21:40:11.840351506 +0100
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-simplecov-html
#
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@@ -24,23 +24,24 @@
#
Name: rubygem-simplecov-html
-Version: 0.10.2
+Version: 0.11.0
Release: 0
%define mod_name simplecov-html
%define mod_full_name %{mod_name}-%{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-BuildRequires: %{ruby >= 1.8.7}
+BuildRequires: %{ruby < 3}
+BuildRequires: %{ruby => 2.4}
BuildRequires: %{rubygem gem2rpm}
BuildRequires: ruby-macros >= 5
-Url: https://github.com/colszowka/simplecov-html
+URL: https://github.com/colszowka/simplecov-html
Source: https://rubygems.org/gems/%{mod_full_name}.gem
Source1: gem2rpm.yml
-Summary: Default HTML formatter for SimpleCov code coverage tool for
ruby 1.9+
+Summary: Default HTML formatter for SimpleCov code coverage tool for
ruby 2.4+
License: MIT
Group: Development/Languages/Ruby
%description
-Default HTML formatter for SimpleCov code coverage tool for ruby 1.9+.
+Default HTML formatter for SimpleCov code coverage tool for ruby 2.4+.
%prep
++++++ simplecov-html-0.10.2.gem -> simplecov-html-0.11.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/.gitignore new/.gitignore
--- old/.gitignore 2017-08-14 07:37:10.000000000 +0200
+++ new/.gitignore 2020-01-28 13:40:39.000000000 +0100
@@ -1,6 +1,5 @@
.rvmrc
.bundle
-Gemfile.lock
## MAC OS
.DS_Store
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/.rubocop.yml new/.rubocop.yml
--- old/.rubocop.yml 2017-08-14 07:37:10.000000000 +0200
+++ new/.rubocop.yml 2020-01-28 13:40:39.000000000 +0100
@@ -1,7 +1,23 @@
+AllCops:
+ TargetRubyVersion: 2.6
+ DisplayCopNames: true
+
+Bundler/DuplicatedGem:
+ Enabled: false
+
+Gemspec/RequiredRubyVersion:
+ Enabled: false
+
+Layout/AccessModifierIndentation:
+ EnforcedStyle: outdent
+
+Layout/SpaceInsideHashLiteralBraces:
+ EnforcedStyle: no_space
+
Metrics/BlockNesting:
Max: 2
-Metrics/LineLength:
+Layout/LineLength:
AllowURI: true
Enabled: false
@@ -13,15 +29,17 @@
Max: 4
CountKeywordArgs: true
-Style/AccessModifierIndentation:
- EnforcedStyle: outdent
+Naming/FileName:
+ Exclude:
+ - "lib/simplecov-html.rb"
+ - "test/test_simple_cov-html.rb"
Style/CollectionMethods:
PreferredMethods:
- map: 'collect'
- reduce: 'inject'
- find: 'detect'
- find_all: 'select'
+ map: "collect"
+ reduce: "inject"
+ find: "detect"
+ find_all: "select"
Style/Documentation:
Enabled: false
@@ -29,26 +47,33 @@
Style/DoubleNegation:
Enabled: false
-Style/FileName:
- Exclude:
- - 'lib/simplecov-html.rb'
- - 'test/test_simple_cov-html.rb'
+Style/ExpandPathArguments:
+ Enabled: false
+
+Style/FrozenStringLiteralComment:
+ Enabled: true
Style/HashSyntax:
EnforcedStyle: hash_rockets
Style/MutableConstant:
Exclude:
- - 'lib/simplecov-html/version.rb'
+ - "lib/simplecov-html/version.rb"
-Style/RegexpLiteral:
+Style/NumericPredicate:
Enabled: false
-Style/SpaceInsideHashLiteralBraces:
- EnforcedStyle: no_space
+Style/RegexpLiteral:
+ Enabled: false
Style/StringLiterals:
EnforcedStyle: double_quotes
-Style/TrailingCommaInLiteral:
- EnforcedStyleForMultiline: 'comma'
+Style/SymbolArray:
+ Enabled: false
+
+Style/TrailingCommaInHashLiteral:
+ EnforcedStyleForMultiline: "comma"
+
+Style/TrailingCommaInArrayLiteral:
+ EnforcedStyleForMultiline: "comma"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/.tool-versions new/.tool-versions
--- old/.tool-versions 1970-01-01 01:00:00.000000000 +0100
+++ new/.tool-versions 2020-01-28 13:40:39.000000000 +0100
@@ -0,0 +1 @@
+ruby 2.6.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/.travis.yml new/.travis.yml
--- old/.travis.yml 2017-08-14 07:37:10.000000000 +0200
+++ new/.travis.yml 2020-01-28 13:40:39.000000000 +0100
@@ -1,29 +1,25 @@
language: ruby
before_install:
- - gem install bundler
+ - gem i bundler
-bundler_args: --without development --jobs=3 --retry=3
-
-cache: bundler
-
-sudo: false
-
-rvm:
- - 1.8.7
- - 1.9.3
- - 2.0.0
- - 2.1
- - 2.2
- - 2.3.1
- - ruby-head
- - jruby
- - rbx-2
- - jruby-9.1.12.0
+bundler_args: --without benchmark --jobs=3 --retry=3
matrix:
+ include:
+ - rvm: 2.4.9
+ - rvm: 2.5.7
+ - rvm: 2.6.5
+ - rvm: 2.7.0
+ - rvm: jruby-9.2.9.0
+ env: JRUBY_OPTS=--debug
+ jdk: openjdk8
+ - rvm: ruby-head
+ - rvm: jruby-head
+ env: JRUBY_OPTS=--debug
+ jdk: openjdk8
allow_failures:
- rvm: ruby-head
- - rvm: jruby
- - rvm: rbx-2
+ - rvm: jruby-head
+ env: JRUBY_OPTS=--debug
fast_finish: true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md 2017-08-14 07:37:10.000000000 +0200
+++ new/CHANGELOG.md 2020-01-28 13:40:39.000000000 +0100
@@ -1,11 +1,41 @@
-0.10.2 2017-08-14
+0.11.0 (2020-01-28)
+=======
+
+This release goes together with simplecov 0.18 to bring branch coverage
support to you. Please also check the notes of the beta releases.
+
+## Enhancements
+* Display total branch coverage percentage in the overview (if branch coverage
enabled)
+
+0.11.0.beta2 (2020-01-19)
+=======
+
+## Enhancements
+* changed display of branch coverage to be `branch_type: hit_count` which
should be more expressive and more intuitive
+* Cached lookup of whether we're doing branch coverage or not (should be
faster)
+
+## Bugfixes
+* Fixed sorting of percent column (regression in previous release)
+
+0.11.0.beta1 (2020-01-05)
+========
+
+Changes ruby support to 2.4+, adds branch coverage support. Meant to be used
with simplecov 0.18
+
+## Breaking Changes
+* Drops support for EOL'ed ruby versions, new support is ~> 2.4
+
+## Enhancements
+* 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
+* Encoding compatibility errors are now caught and printed out
+
+0.10.2 (2017-08-14)
========
## Bugfixes
* Allow usage with frozen-string-literal-enabled. See
[#56](https://github.com/colszowka/simplecov-html/pull/56) (thanks @pat)
-0.10.1 2017-05-17
+0.10.1 (2017-05-17)
========
## Bugfixes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Gemfile new/Gemfile
--- old/Gemfile 2017-08-14 07:37:10.000000000 +0200
+++ new/Gemfile 2020-01-28 13:40:39.000000000 +0100
@@ -1,26 +1,16 @@
+# frozen_string_literal: true
+
source "https://rubygems.org"
gemspec
-if RUBY_VERSION == "1.8.7"
- gem "rake", "~> 10.5"
-else
- gem "rake", ">= 11"
-end
+gem "rake", ">= 11"
# Use local copy of simplecov in development when checked out, fetch from git
otherwise
if File.directory?(File.dirname(__FILE__) + "/../simplecov")
gem "simplecov", :path => File.dirname(__FILE__) + "/../simplecov"
else
- gem "simplecov", :git => "https://github.com/colszowka/simplecov"
-end
-
-platforms :ruby_18, :ruby_19 do
- gem "json", "~> 1.8"
-end
-
-platforms :ruby_18, :ruby_19, :ruby_20, :ruby_21 do
- gem "rack", "~> 1.6"
+ gem "simplecov", :github => "colszowka/simplecov"
end
group :test do
@@ -30,5 +20,6 @@
group :development do
gem "rubocop"
gem "sass"
- gem "sprockets"
+ # sprockets 4.0 requires ruby 2.5+
+ gem "sprockets", "~> 3.7"
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Gemfile.lock new/Gemfile.lock
--- old/Gemfile.lock 1970-01-01 01:00:00.000000000 +0100
+++ new/Gemfile.lock 2020-01-28 13:40:39.000000000 +0100
@@ -0,0 +1,62 @@
+PATH
+ remote: .
+ specs:
+ simplecov-html (0.11.0)
+
+PATH
+ remote: /home/tobi/github/simplecov
+ specs:
+ simplecov (0.18.0)
+ docile (~> 1.1)
+ simplecov-html (~> 0.11.0)
+
+GEM
+ remote: https://rubygems.org/
+ specs:
+ ast (2.4.0)
+ concurrent-ruby (1.1.5)
+ docile (1.3.2)
+ ffi (1.11.3)
+ jaro_winkler (1.5.4)
+ minitest (5.13.0)
+ parallel (1.19.1)
+ parser (2.7.0.1)
+ ast (~> 2.4.0)
+ rack (2.0.7)
+ rainbow (3.0.0)
+ rake (13.0.1)
+ rb-fsevent (0.10.3)
+ rb-inotify (0.10.0)
+ ffi (~> 1.0)
+ rubocop (0.78.0)
+ jaro_winkler (~> 1.5.1)
+ parallel (~> 1.10)
+ parser (>= 2.6)
+ rainbow (>= 2.2.2, < 4.0)
+ ruby-progressbar (~> 1.7)
+ unicode-display_width (>= 1.4.0, < 1.7)
+ ruby-progressbar (1.10.1)
+ sass (3.7.4)
+ sass-listen (~> 4.0.0)
+ sass-listen (4.0.0)
+ rb-fsevent (~> 0.9, >= 0.9.4)
+ rb-inotify (~> 0.9, >= 0.9.7)
+ sprockets (3.7.2)
+ concurrent-ruby (~> 1.0)
+ rack (> 1, < 3)
+ unicode-display_width (1.6.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ minitest
+ rake (>= 11)
+ rubocop
+ sass
+ simplecov!
+ simplecov-html!
+ sprockets (~> 3.7)
+
+BUNDLED WITH
+ 2.0.2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Guardfile new/Guardfile
--- old/Guardfile 2017-08-14 07:37:10.000000000 +0200
+++ new/Guardfile 2020-01-28 13:40:39.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 2017-08-14 07:37:10.000000000 +0200
+++ new/README.md 2020-01-28 13:40:39.000000000 +0100
@@ -3,7 +3,7 @@
***Note: To learn more about SimpleCov, check out the main repo at
https://github.com/colszowka/simplecov***
-Generates a nice HTML report of your SimpleCov ruby code coverage results on
Ruby 1.9 using client-side Javascript
+Generates a nice HTML report of your SimpleCov ruby code coverage results on
Ruby 2.4+ using client-side Javascript
quite extensively.
@@ -17,7 +17,7 @@
* `cd` there, run `bundle`
* You should end up with all dev dependencies installed and simplecov-html
being used from your disk
* Run the tests (units and features)
-
+
Please remember to add tests if you add functionality.
**Important:** If you modify the JS/CSS assets, you'll have to precompile them
using `rake assets:compile` - otherwise,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Rakefile new/Rakefile
--- old/Rakefile 2017-08-14 07:37:10.000000000 +0200
+++ new/Rakefile 2020-01-28 13:40:39.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "bundler"
Bundler::GemHelper.install_tasks
@@ -21,7 +23,7 @@
RuboCop::RakeTask.new
rescue LoadError
task :rubocop do
- $stderr.puts "Rubocop is disabled"
+ warn "Rubocop is disabled"
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/assets/javascripts/application.js
new/assets/javascripts/application.js
--- old/assets/javascripts/application.js 2017-08-14 07:37:10.000000000
+0200
+++ new/assets/javascripts/application.js 2020-01-28 13:40:39.000000000
+0100
@@ -2,34 +2,36 @@
//= require_directory ./plugins/
//= require_self
-$(document).ready(function() {
+$(document).ready(function () {
+ branchCoverageActivated = $("body").data("branch-coverage") == true;
+
// Configuration for fancy sortable tables for source file groups
+ // For what these columns are, cecl out file_list.erb - null basically
+ // does normal/number style sorting which fine for hit/missed lines only
+ // percentages like "covered percent" need special sorting arguments.
+ lineColumns = [null, { "sType": "percent" }, null, null, null, null, null];
+ branchColumns = [{ "sType": "percent" }, null, null, null];
+
+ dataColumns = branchCoverageActivated ? lineColumns.concat(branchColumns) :
lineColumns;
+
$('.file_list').dataTable({
- "aaSorting": [[ 1, "asc" ]],
+ "aaSorting": [[1, "asc"]],
"bPaginate": false,
"bJQueryUI": true,
- "aoColumns": [
- null,
- { "sType": "percent" },
- null,
- null,
- null,
- null,
- null
- ]
+ "aoColumns": dataColumns
});
// Syntax highlight all files up front - deactivated
// $('.source_table pre code').each(function(i, e) {hljs.highlightBlock(e, '
')});
// Syntax highlight source files on first toggle of the file view popup
- $("a.src_link").click(function() {
+ $("a.src_link").click(function () {
// Get the source file element that corresponds to the clicked element
var source_table = $($(this).attr('href'));
// If not highlighted yet, do it!
if (!source_table.hasClass('highlighted')) {
- source_table.find('pre code').each(function(i, e)
{hljs.highlightBlock(e, ' ')});
+ source_table.find('pre code').each(function (i, e) {
hljs.highlightBlock(e, ' ') });
source_table.addClass('highlighted');
};
});
@@ -44,14 +46,14 @@
opacity: 1,
width: "95%",
height: "95%",
- onLoad: function() {
+ onLoad: function () {
prev_anchor = curr_anchor ? curr_anchor : jQuery.url.attr('anchor');
curr_anchor = this.href.split('#')[1];
window.location.hash = curr_anchor;
},
- onCleanup: function() {
+ onCleanup: function () {
if (prev_anchor && prev_anchor != curr_anchor) {
- $('a[href="#'+prev_anchor+'"]').click();
+ $('a[href="#' + prev_anchor + '"]').click();
curr_anchor = prev_anchor;
} else {
$('.group_tabs a:first').click();
@@ -62,13 +64,13 @@
}
});
- window.onpopstate = function(event){
- if (location.hash.substring(0,2) == "#_") {
+ window.onpopstate = function (event) {
+ if (location.hash.substring(0, 2) == "#_") {
$.colorbox.close();
curr_anchor = jQuery.url.attr('anchor');
} else {
if ($('#colorbox').is(':hidden')) {
- $('a.src_link[href="'+location.hash+'"]').colorbox({ open: true });
+ $('a.src_link[href="' + location.hash + '"]').colorbox({ open: true });
}
}
};
@@ -78,23 +80,23 @@
$('.file_list_container').hide();
// Add tabs based upon existing file_list_containers
- $('.file_list_container h2').each(function(){
+ $('.file_list_container h2').each(function () {
var container_id = $(this).parent().attr('id');
var group_name = $(this).find('.group_name').first().html();
var covered_percent = $(this).find('.covered_percent').first().html();
- $('.group_tabs').append('<li><a href="#' + container_id + '">' +
group_name + ' ('+ covered_percent +')</a></li>');
+ $('.group_tabs').append('<li><a href="#' + container_id + '">' +
group_name + ' (' + covered_percent + ')</a></li>');
});
- $('.group_tabs a').each( function() {
+ $('.group_tabs a').each(function () {
$(this).addClass($(this).attr('href').replace('#', ''));
});
// Make sure tabs don't get ugly focus borders when active
- $('.group_tabs a').live('focus', function() { $(this).blur(); });
+ $('.group_tabs a').live('focus', function () { $(this).blur(); });
var favicon_path = $('link[rel="shortcut icon"]').attr('href');
- $('.group_tabs a').live('click', function(){
+ $('.group_tabs a').live('click', function () {
if (!$(this).parent().hasClass('active')) {
$('.group_tabs a').parent().removeClass('active');
$(this).parent().addClass('active');
@@ -105,7 +107,7 @@
// Force favicon reload - otherwise the location change containing
anchor would drop the favicon...
// Works only on firefox, but still... - Anyone know a better solution
to force favicon on local file?
$('link[rel="shortcut icon"]').remove();
- $('head').append('<link rel="shortcut icon" type="image/png" href="'+
favicon_path +'" />');
+ $('head').append('<link rel="shortcut icon" type="image/png" href="' +
favicon_path + '" />');
};
return false;
});
@@ -115,7 +117,7 @@
if (anchor.length == 40) {
$('a.src_link[href=#' + anchor + ']').click();
} else {
- $('.group_tabs a.'+anchor.replace('_', '')).click();
+ $('.group_tabs a.' + anchor.replace('_', '')).click();
}
} else {
$('.group_tabs a:first').click();
@@ -124,4 +126,5 @@
$("abbr.timeago").timeago();
$('#loading').fadeOut();
$('#wrapper').show();
+ $('.dataTables_filter input').focus()
});
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/assets/stylesheets/screen.css.sass
new/assets/stylesheets/screen.css.sass
--- old/assets/stylesheets/screen.css.sass 2017-08-14 07:37:10.000000000
+0200
+++ new/assets/stylesheets/screen.css.sass 2020-01-28 13:40:39.000000000
+0100
@@ -188,6 +188,8 @@
.yellow
color: #da0
+.blue
+ color: blue
.source_table
.covered
@@ -198,6 +200,8 @@
border-color: black
.skipped
border-color: #fc0
+ .missed-branch
+ border-color: #bf0000
.covered
&:nth-child(odd)
background-color: #CDF2CD
@@ -217,4 +221,9 @@
&:nth-child(odd)
background-color: #FBF0C0
&:nth-child(even)
- background-color: #FBFfCf
\ No newline at end of file
+ background-color: #FBFfCf
+ .missed-branch
+ &:nth-child(odd)
+ background-color: #cc8e8e
+ &:nth-child(even)
+ background-color: #cc6e6e
\ No newline at end of file
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/simplecov-html/version.rb
new/lib/simplecov-html/version.rb
--- old/lib/simplecov-html/version.rb 2017-08-14 07:37:10.000000000 +0200
+++ new/lib/simplecov-html/version.rb 2020-01-28 13:40:39.000000000 +0100
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
module SimpleCov
module Formatter
class HTMLFormatter
- VERSION = "0.10.2".freeze
+ VERSION = "0.11.0"
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/simplecov-html.rb new/lib/simplecov-html.rb
--- old/lib/simplecov-html.rb 2017-08-14 07:37:10.000000000 +0200
+++ new/lib/simplecov-html.rb 2020-01-28 13:40:39.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "erb"
require "cgi"
require "fileutils"
@@ -14,6 +16,10 @@
module SimpleCov
module Formatter
class HTMLFormatter
+ def initialize
+ @branchable_result = SimpleCov.branch_coverage?
+ end
+
def format(result)
Dir[File.join(File.dirname(__FILE__), "../public/*")].each do |path|
FileUtils.cp_r(path, asset_output_path)
@@ -29,6 +35,21 @@
"Coverage report generated for #{result.command_name} to
#{output_path}. #{result.covered_lines} / #{result.total_lines} LOC
(#{result.covered_percent.round(2)}%) covered."
end
+ def branchable_result?
+ # cached in initialize because we truly look it up a whole bunch of
times
+ # and it's easier to cache here then in SimpleCov because there we
might
+ # still enable/disable branch coverage criterion
+ @branchable_result
+ end
+
+ def line_status?(source_file, line)
+ if branchable_result? &&
source_file.line_with_missed_branch?(line.number)
+ "missed-branch"
+ else
+ line.status
+ end
+ end
+
private
# Returns the an erb instance for the template of given name
@@ -42,6 +63,7 @@
def asset_output_path
return @asset_output_path if defined?(@asset_output_path) &&
@asset_output_path
+
@asset_output_path = File.join(output_path, "assets",
SimpleCov::Formatter::HTMLFormatter::VERSION)
FileUtils.mkdir_p(@asset_output_path)
@asset_output_path
@@ -54,6 +76,8 @@
# Returns the html for the given source_file
def formatted_source_file(source_file)
template("source_file").result(binding)
+ rescue Encoding::CompatibilityError => e
+ puts "Encoding problems with file #{source_file.filename}.
Simplecov/ERB can't handle non ASCII characters in filenames. Error:
#{e.message}."
end
# Returns a table containing the given source files
@@ -66,6 +90,10 @@
template("file_list").result(binding)
end
+ def covered_percent(percent)
+ template("covered_percent").result(binding)
+ end
+
def coverage_css_class(covered_percent)
if covered_percent > 90
"green"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2017-08-14 07:37:10.000000000 +0200
+++ new/metadata 2020-01-28 13:40:39.000000000 +0100
@@ -1,30 +1,16 @@
--- !ruby/object:Gem::Specification
name: simplecov-html
version: !ruby/object:Gem::Version
- version: 0.10.2
+ version: 0.11.0
platform: ruby
authors:
- Christoph Olszowka
autorequire:
bindir: bin
cert_chain: []
-date: 2017-08-14 00:00:00.000000000 Z
-dependencies:
-- !ruby/object:Gem::Dependency
- name: bundler
- requirement: !ruby/object:Gem::Requirement
- requirements:
- - - "~>"
- - !ruby/object:Gem::Version
- version: '1.9'
- type: :development
- prerelease: false
- version_requirements: !ruby/object:Gem::Requirement
- requirements:
- - - "~>"
- - !ruby/object:Gem::Version
- version: '1.9'
-description: Default HTML formatter for SimpleCov code coverage tool for ruby
1.9+
+date: 2020-01-28 00:00:00.000000000 Z
+dependencies: []
+description: Default HTML formatter for SimpleCov code coverage tool for ruby
2.4+
email:
- christoph at olszowka de
executables: []
@@ -34,9 +20,11 @@
- ".document"
- ".gitignore"
- ".rubocop.yml"
+- ".tool-versions"
- ".travis.yml"
- CHANGELOG.md
- Gemfile
+- Gemfile.lock
- Guardfile
- LICENSE
- README.md
@@ -83,6 +71,7 @@
- simplecov-html.gemspec
- test/helper.rb
- test/test_simple_cov-html.rb
+- views/covered_percent.erb
- views/file_list.erb
- views/layout.erb
- views/source_file.erb
@@ -96,18 +85,17 @@
- lib
required_ruby_version: !ruby/object:Gem::Requirement
requirements:
- - - ">="
+ - - "~>"
- !ruby/object:Gem::Version
- version: 1.8.7
+ version: '2.4'
required_rubygems_version: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
version: '0'
requirements: []
-rubyforge_project:
-rubygems_version: 2.6.10
+rubygems_version: 3.0.3
signing_key:
specification_version: 4
-summary: Default HTML formatter for SimpleCov code coverage tool for ruby 1.9+
+summary: Default HTML formatter for SimpleCov code coverage tool for ruby 2.4+
test_files: []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/public/application.css new/public/application.css
--- old/public/application.css 2017-08-14 07:37:10.000000000 +0200
+++ new/public/application.css 2020-01-28 13:40:39.000000000 +0100
@@ -532,6 +532,7 @@
ColorBox Core Style:
The following CSS is consistent between example themes and should not be
altered.
*/
+
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0;
z-index:9999; overflow:hidden;}
#cboxOverlay{position:fixed; width:100%; height:100%;}
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
@@ -586,19 +587,19 @@
top: 50%; }
a {
- color: #333333;
+ color: #333;
text-decoration: none; }
a:hover {
- color: black;
+ color: #000;
text-decoration: underline; }
body {
font-family: "Lucida Grande", Helvetica, "Helvetica Neue", Arial, sans-serif;
padding: 12px;
- background-color: #333333; }
+ background-color: #333; }
h1, h2, h3, h4 {
- color: #1c2324;
+ color: #1C2324;
margin: 0;
padding: 0;
margin-bottom: 12px; }
@@ -609,8 +610,8 @@
#content {
clear: left;
background-color: white;
- border: 2px solid #dddddd;
- border-top: 8px solid #dddddd;
+ border: 2px solid #ddd;
+ border-top: 8px solid #ddd;
padding: 18px;
-webkit-border-bottom-left-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
@@ -632,7 +633,7 @@
.timestamp {
float: right;
- color: #dddddd; }
+ color: #ddd; }
.group_tabs {
list-style: none;
@@ -648,13 +649,13 @@
float: left;
text-decoration: none;
padding: 4px 8px;
- background-color: #aaaaaa;
+ background-color: #aaa;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#dddddd),
to(#aaaaaa));
background: -moz-linear-gradient(#dddddd, #aaaaaa);
background: linear-gradient(#dddddd, #aaaaaa);
text-shadow: #e5e5e5 1px 1px 0px;
border-bottom: none;
- color: #333333;
+ color: #333;
font-weight: bold;
margin-right: 8px;
border-top: 1px solid #efefef;
@@ -665,7 +666,7 @@
border-top-left-radius: 2px;
border-top-right-radius: 2px; }
.group_tabs li a:hover {
- background-color: #cccccc;
+ background-color: #ccc;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#eeeeee),
to(#aaaaaa));
background: -moz-linear-gradient(#eeeeee, #aaaaaa);
background: linear-gradient(#eeeeee, #aaaaaa); }
@@ -674,8 +675,8 @@
padding-bottom: 3px; }
.group_tabs li.active a {
color: black;
- text-shadow: white 1px 1px 0px;
- background-color: #dddddd;
+ text-shadow: #fff 1px 1px 0px;
+ background-color: #ddd;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(white),
to(#dddddd));
background: -moz-linear-gradient(white, #dddddd);
background: linear-gradient(white, #dddddd); }
@@ -713,13 +714,13 @@
margin: 0;
padding: 0;
white-space: normal;
- color: black;
+ color: #000;
font-family: "Monaco", "Inconsolata", "Consolas", monospace; }
.source_table code {
- color: black;
+ color: #000;
font-family: "Monaco", "Inconsolata", "Consolas", monospace; }
.source_table pre {
- background-color: #333333; }
+ background-color: #333; }
.source_table pre ol {
margin: 0px;
padding: 0px;
@@ -737,7 +738,7 @@
float: right;
margin-left: 10px;
padding: 2px 4px;
- background-color: #444444;
+ background-color: #444;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#222222),
to(#666666));
background: -moz-linear-gradient(#222222, #666666);
background: linear-gradient(#222222, #666666);
@@ -749,51 +750,60 @@
border-radius: 6px; }
#footer {
- color: #dddddd;
+ color: #ddd;
font-size: 12px;
font-weight: bold;
margin-top: 12px;
text-align: right; }
#footer a {
- color: #eeeeee;
+ color: #eee;
text-decoration: underline; }
#footer a:hover {
- color: white;
+ color: #fff;
text-decoration: none; }
.green {
- color: #009900; }
+ color: #090; }
.red {
- color: #990000; }
+ color: #900; }
.yellow {
- color: #ddaa00; }
+ color: #da0; }
+
+.blue {
+ color: blue; }
.source_table .covered {
- border-color: #009900; }
+ border-color: #090; }
.source_table .missed {
- border-color: #990000; }
+ border-color: #900; }
.source_table .never {
border-color: black; }
.source_table .skipped {
- border-color: #ffcc00; }
+ border-color: #fc0; }
+.source_table .missed-branch {
+ border-color: #bf0000; }
.source_table .covered:nth-child(odd) {
- background-color: #cdf2cd; }
+ background-color: #CDF2CD; }
.source_table .covered:nth-child(even) {
- background-color: #dbf2db; }
+ background-color: #DBF2DB; }
.source_table .missed:nth-child(odd) {
- background-color: #f7c0c0; }
+ background-color: #F7C0C0; }
.source_table .missed:nth-child(even) {
- background-color: #f7cfcf; }
+ background-color: #F7CFCF; }
.source_table .never:nth-child(odd) {
background-color: #efefef; }
.source_table .never:nth-child(even) {
background-color: #f4f4f4; }
.source_table .skipped:nth-child(odd) {
- background-color: #fbf0c0; }
+ background-color: #FBF0C0; }
.source_table .skipped:nth-child(even) {
- background-color: #fbffcf; }
+ background-color: #FBFfCf; }
+.source_table .missed-branch:nth-child(odd) {
+ background-color: #cc8e8e; }
+.source_table .missed-branch:nth-child(even) {
+ background-color: #cc6e6e; }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/public/application.js new/public/application.js
--- old/public/application.js 2017-08-14 07:37:10.000000000 +0200
+++ new/public/application.js 2020-01-28 13:40:39.000000000 +0100
@@ -1582,34 +1582,33 @@
-$(document).ready(function() {
+$(document).ready(function () {
+ branchCoverageActivated = $("body").data("branch-coverage") == true;
+
// Configuration for fancy sortable tables for source file groups
+ lineColumns = [null, { "sType": "percent" }, null, null, null, null, null];
+ branchColumns = [{ "sType": "percent" }, null, null, null];
+
+ dataColumns = branchCoverageActivated ? lineColumns.concat(branchColumns) :
lineColumns;
+
$('.file_list').dataTable({
- "aaSorting": [[ 1, "asc" ]],
+ "aaSorting": [[1, "asc"]],
"bPaginate": false,
"bJQueryUI": true,
- "aoColumns": [
- null,
- { "sType": "percent" },
- null,
- null,
- null,
- null,
- null
- ]
+ "aoColumns": dataColumns
});
// Syntax highlight all files up front - deactivated
// $('.source_table pre code').each(function(i, e) {hljs.highlightBlock(e, '
')});
// Syntax highlight source files on first toggle of the file view popup
- $("a.src_link").click(function() {
+ $("a.src_link").click(function () {
// Get the source file element that corresponds to the clicked element
var source_table = $($(this).attr('href'));
// If not highlighted yet, do it!
if (!source_table.hasClass('highlighted')) {
- source_table.find('pre code').each(function(i, e)
{hljs.highlightBlock(e, ' ')});
+ source_table.find('pre code').each(function (i, e) {
hljs.highlightBlock(e, ' ') });
source_table.addClass('highlighted');
};
});
@@ -1624,14 +1623,14 @@
opacity: 1,
width: "95%",
height: "95%",
- onLoad: function() {
+ onLoad: function () {
prev_anchor = curr_anchor ? curr_anchor : jQuery.url.attr('anchor');
curr_anchor = this.href.split('#')[1];
window.location.hash = curr_anchor;
},
- onCleanup: function() {
+ onCleanup: function () {
if (prev_anchor && prev_anchor != curr_anchor) {
- $('a[href="#'+prev_anchor+'"]').click();
+ $('a[href="#' + prev_anchor + '"]').click();
curr_anchor = prev_anchor;
} else {
$('.group_tabs a:first').click();
@@ -1642,13 +1641,13 @@
}
});
- window.onpopstate = function(event){
- if (location.hash.substring(0,2) == "#_") {
+ window.onpopstate = function (event) {
+ if (location.hash.substring(0, 2) == "#_") {
$.colorbox.close();
curr_anchor = jQuery.url.attr('anchor');
} else {
if ($('#colorbox').is(':hidden')) {
- $('a.src_link[href="'+location.hash+'"]').colorbox({ open: true });
+ $('a.src_link[href="' + location.hash + '"]').colorbox({ open: true });
}
}
};
@@ -1658,23 +1657,23 @@
$('.file_list_container').hide();
// Add tabs based upon existing file_list_containers
- $('.file_list_container h2').each(function(){
+ $('.file_list_container h2').each(function () {
var container_id = $(this).parent().attr('id');
var group_name = $(this).find('.group_name').first().html();
var covered_percent = $(this).find('.covered_percent').first().html();
- $('.group_tabs').append('<li><a href="#' + container_id + '">' +
group_name + ' ('+ covered_percent +')</a></li>');
+ $('.group_tabs').append('<li><a href="#' + container_id + '">' +
group_name + ' (' + covered_percent + ')</a></li>');
});
- $('.group_tabs a').each( function() {
+ $('.group_tabs a').each(function () {
$(this).addClass($(this).attr('href').replace('#', ''));
});
// Make sure tabs don't get ugly focus borders when active
- $('.group_tabs a').live('focus', function() { $(this).blur(); });
+ $('.group_tabs a').live('focus', function () { $(this).blur(); });
var favicon_path = $('link[rel="shortcut icon"]').attr('href');
- $('.group_tabs a').live('click', function(){
+ $('.group_tabs a').live('click', function () {
if (!$(this).parent().hasClass('active')) {
$('.group_tabs a').parent().removeClass('active');
$(this).parent().addClass('active');
@@ -1685,7 +1684,7 @@
// Force favicon reload - otherwise the location change containing
anchor would drop the favicon...
// Works only on firefox, but still... - Anyone know a better solution
to force favicon on local file?
$('link[rel="shortcut icon"]').remove();
- $('head').append('<link rel="shortcut icon" type="image/png" href="'+
favicon_path +'" />');
+ $('head').append('<link rel="shortcut icon" type="image/png" href="' +
favicon_path + '" />');
};
return false;
});
@@ -1695,7 +1694,7 @@
if (anchor.length == 40) {
$('a.src_link[href=#' + anchor + ']').click();
} else {
- $('.group_tabs a.'+anchor.replace('_', '')).click();
+ $('.group_tabs a.' + anchor.replace('_', '')).click();
}
} else {
$('.group_tabs a:first').click();
@@ -1704,4 +1703,5 @@
$("abbr.timeago").timeago();
$('#loading').fadeOut();
$('#wrapper').show();
+ $('.dataTables_filter input').focus()
});
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/simplecov-html.gemspec new/simplecov-html.gemspec
--- old/simplecov-html.gemspec 2017-08-14 07:37:10.000000000 +0200
+++ new/simplecov-html.gemspec 2020-01-28 13:40:39.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
require "simplecov-html/version"
@@ -8,12 +10,11 @@
gem.authors = ["Christoph Olszowka"]
gem.email = ["christoph at olszowka de"]
gem.homepage = "https://github.com/colszowka/simplecov-html"
- gem.description = %(Default HTML formatter for SimpleCov code coverage tool
for ruby 1.9+)
+ gem.description = %(Default HTML formatter for SimpleCov code coverage tool
for ruby 2.4+)
gem.summary = gem.description
gem.license = "MIT"
- gem.required_ruby_version = ">= 1.8.7"
- gem.add_development_dependency "bundler", "~> 1.9"
+ gem.required_ruby_version = "~> 2.4"
gem.files = `git ls-files`.split("\n")
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/helper.rb new/test/helper.rb
--- old/test/helper.rb 2017-08-14 07:37:10.000000000 +0200
+++ new/test/helper.rb 2020-01-28 13:40:39.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "bundler/setup"
require "simplecov"
require "simplecov-html"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/test_simple_cov-html.rb
new/test/test_simple_cov-html.rb
--- old/test/test_simple_cov-html.rb 2017-08-14 07:37:10.000000000 +0200
+++ new/test/test_simple_cov-html.rb 2020-01-28 13:40:39.000000000 +0100
@@ -1,6 +1,8 @@
+# frozen_string_literal: true
+
require "helper"
-class TestSimpleCovHtml < MiniTest::Unit::TestCase
+class TestSimpleCovHtml < Minitest::Test
def test_defined
assert defined?(SimpleCov::Formatter::HTMLFormatter)
assert defined?(SimpleCov::Formatter::HTMLFormatter::VERSION)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/views/covered_percent.erb
new/views/covered_percent.erb
--- old/views/covered_percent.erb 1970-01-01 01:00:00.000000000 +0100
+++ new/views/covered_percent.erb 2020-01-28 13:40:39.000000000 +0100
@@ -0,0 +1,3 @@
+<span class="<%= coverage_css_class(percent) %>">
+ <%= percent.round(2) %>%
+</span>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/views/file_list.erb new/views/file_list.erb
--- old/views/file_list.erb 2017-08-14 07:37:10.000000000 +0200
+++ new/views/file_list.erb 2020-01-28 13:40:39.000000000 +0100
@@ -1,21 +1,40 @@
<div class="file_list_container" id="<%= title_id %>">
<h2>
<span class="group_name"><%= title %></span>
- (<span class="covered_percent"><span class="<%=
coverage_css_class(source_files.covered_percent) %>"><%=
source_files.covered_percent.round(2) %>%</span></span>
+ (<span class="covered_percent">
+ <%= covered_percent(source_files.covered_percent) %>
+ </span>
covered at
<span class="covered_strength">
<span class="<%= strength_css_class(source_files.covered_strength) %>">
<%= source_files.covered_strength.round(2) %>
</span>
- </span> hits/line)
+ </span> hits/line
+ )
</h2>
+
<a name="<%= title_id %>"></a>
+
<div>
<b><%= source_files.length %></b> files in total.
- <b><%= source_files.lines_of_code %></b> relevant lines.
+ </div>
+
+ <div class="t-line-summary">
+ <b><%= source_files.lines_of_code %></b> relevant lines,
<span class="green"><b><%= source_files.covered_lines %></b> lines
covered</span> and
- <span class="red"><b><%= source_files.missed_lines %></b> lines missed
</span>
+ <span class="red"><b><%= source_files.missed_lines %></b> lines missed.
</span>
+ (<%= covered_percent(source_files.covered_percent) %>)
</div>
+
+ <% if branchable_result? %>
+ <div class="t-branch-summary">
+ <span><b><%= source_files.total_branches %></b> total branches, </span>
+ <span class="green"><b><%= source_files.covered_branches %></b> branches
covered</span> and
+ <span class="red"><b><%= source_files.missed_branches %></b> branches
missed.</span>
+ (<%= covered_percent(source_files.branch_covered_percent) %>)
+ </div>
+ <% end %>
+
<table class="file_list">
<thead>
<tr>
@@ -26,19 +45,31 @@
<th>Lines covered</th>
<th>Lines missed</th>
<th>Avg. Hits / Line</th>
+ <% if branchable_result? %>
+ <th>Branch Coverage</th>
+ <th>Branches</th>
+ <th>Covered branches</th>
+ <th>Missed branches </th>
+ <% end %>
</tr>
</thead>
<tbody>
<% source_files.each do |source_file| %>
- <tr>
- <td class="strong"><%= link_to_source_file(source_file) %></td>
- <td class="<%= coverage_css_class(source_file.covered_percent) %>
strong"><%= source_file.covered_percent.round(2).to_s %> %</td>
- <td><%= source_file.lines.count %></td>
- <td><%= source_file.covered_lines.count +
source_file.missed_lines.count %></td>
- <td><%= source_file.covered_lines.count %></td>
- <td><%= source_file.missed_lines.count %></td>
- <td><%= source_file.covered_strength %></td>
- </tr>
+ <tr class="t-file">
+ <td class="strong t-file__name"><%= link_to_source_file(source_file)
%></td>
+ <td class="<%= coverage_css_class(source_file.covered_percent) %>
strong t-file__coverage"><%= source_file.covered_percent.round(2).to_s %> %</td>
+ <td><%= source_file.lines.count %></td>
+ <td><%= source_file.covered_lines.count +
source_file.missed_lines.count %></td>
+ <td><%= source_file.covered_lines.count %></td>
+ <td><%= source_file.missed_lines.count %></td>
+ <td><%= source_file.covered_strength.round(2) %></td>
+ <% if branchable_result? %>
+ <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>
+ <td><%= source_file.total_branches.count %></td>
+ <td><%= source_file.covered_branches.count %></td>
+ <td><%= source_file.missed_branches.count %></td>
+ <% end %>
+ </tr>
<% end %>
</tbody>
</table>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/views/layout.erb new/views/layout.erb
--- old/views/layout.erb 2017-08-14 07:37:10.000000000 +0200
+++ new/views/layout.erb 2020-01-28 13:40:39.000000000 +0100
@@ -3,13 +3,13 @@
<head>
<title>Code coverage for <%= SimpleCov.project_name %></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <script src='<%= assets_path('application.js') %>'
type='text/javascript'></script>
+ <script src='<%= assets_path('application.js') %>'
type='text/javascript'></script>
<link href='<%= assets_path('application.css') %>' media='screen,
projection, print' rel='stylesheet' type='text/css'>
<link rel="shortcut icon" type="image/png" href="<%=
assets_path("favicon_#{coverage_css_class(result.source_files.covered_percent)}.png")
%>" />
<link rel="icon" type="image/png" href="<%= assets_path('favicon.png') %>"
/>
</head>
-
- <body>
+
+ <body<%= ' data-branch-coverage=true' if branchable_result? %>>
<div id="loading">
<img src="<%= assets_path('loading.gif') %>" alt="loading"/>
</div>
@@ -24,13 +24,13 @@
<%= formatted_file_list(name, files) %>
<% end %>
</div>
-
+
<div id="footer">
- Generated by <a
href="http://github.com/colszowka/simplecov">simplecov</a> v<%=
SimpleCov::VERSION %>
+ Generated by <a
href="http://github.com/colszowka/simplecov">simplecov</a> v<%=
SimpleCov::VERSION %>
and simplecov-html v<%= SimpleCov::Formatter::HTMLFormatter::VERSION
%><br/>
using <%= result.command_name %>
</div>
-
+
<div class="source_files">
<% result.source_files.each do |source_file| %>
<%= formatted_source_file(source_file) %>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/views/source_file.erb new/views/source_file.erb
--- old/views/source_file.erb 2017-08-14 07:37:10.000000000 +0200
+++ new/views/source_file.erb 2020-01-28 13:40:39.000000000 +0100
@@ -1,22 +1,53 @@
<div class="source_table" id="<%= id source_file %>">
<div class="header">
<h3><%= shortened_filename source_file %></h3>
- <h4><span class="<%= coverage_css_class(source_file.covered_percent)
%>"><%= source_file.covered_percent.round(2).to_s %> %</span> covered</h4>
- <div>
- <b><%= source_file.lines_of_code %></b> relevant lines.
+ <h4>
+ <%= covered_percent(source_file.covered_percent) %>
+ lines covered
+ </h4>
+
+ <% if branchable_result? %>
+ <h4>
+ <%= covered_percent(source_file.branches_coverage_percent) %>
+ branches covered
+ </h4>
+ <% end %>
+
+ <div class="t-line-summary">
+ <b><%= source_file.lines_of_code %></b> relevant lines.
<span class="green"><b><%= source_file.covered_lines.count %></b> lines
covered</span> and
<span class="red"><b><%= source_file.missed_lines.count %></b> lines
missed.</span>
</div>
+
+ <% if branchable_result? %>
+ <div class="t-branch-summary">
+ <span><b><%= source_file.total_branches.count %></b> total branches,
</span>
+ <span class="green"><b><%= source_file.covered_branches.count %></b>
branches covered</span> and
+ <span class="red"><b><%= source_file.missed_branches.count %></b>
branches missed.</span>
+ </div>
+ <% end %>
+
</div>
-
+
<pre>
<ol>
<% source_file.lines.each do |line| %>
- <li class="<%= line.status %>" data-hits="<%= line.coverage ?
line.coverage : '' %>" data-linenumber="<%= line.number %>">
- <% if line.covered? %><span class="hits"><%= line.coverage
%></span><% end %>
- <% if line.skipped? %><span class="hits">skipped</span><% end %>
- <code class="ruby"><%= CGI.escapeHTML(line.src.chomp) %></code>
- </li>
+ <div>
+ <li class="<%= line_status?(source_file, line) %>" data-hits="<%=
line.coverage ? line.coverage : '' %>" data-linenumber="<%= line.number %>">
+ <% if line.covered? %><span class="hits"><%= line.coverage
%></span><% end %>
+ <% if line.skipped? %><span class="hits">skipped</span><% end %>
+
+ <% if branchable_result? %>
+ <% source_file.branches_for_line(line.number).each do
|branch_type, hit_count| %>
+ <span class="hits" title="<%= branch_type%> branch hit <%=
hit_count %> times">
+ <%= branch_type %>: <%= hit_count %>
+ </span>
+ <% end %>
+ <% end %>
+
+ <code class="ruby"><%= CGI.escapeHTML(line.src.chomp) %></code>
+ </li>
+ </div>
<% end %>
</ol>
</pre>