single_cov 0.8.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/single_cov/version.rb +1 -1
- data/lib/single_cov.rb +16 -11
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 93bc47f24f33d85ed88bc31457af86b4279569239a10ca58a7c68559f50c03bb
|
4
|
+
data.tar.gz: 4ff3f11d836b2204eb9273418529fec04d4f6442cfc066cd7ea42f22fc892615
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd2d503a59f3ee64cd5dca10901f99e53d4b57a0e2700b4ada42187c6924f1a1f56473b297fc7e86648ba858901f89d6fd4fe899dae0726faf0429ca57baf32d
|
7
|
+
data.tar.gz: 74dce791fd81148ecd84d2b247a0daa6db34a40870f3378f58dce4ab8d03f1fc7f1bd6a838a8610760cfc2b426cb7515a348d24bb8cddef94937cdd23d7243a6
|
data/lib/single_cov/version.rb
CHANGED
data/lib/single_cov.rb
CHANGED
@@ -2,6 +2,7 @@ module SingleCov
|
|
2
2
|
COVERAGES = []
|
3
3
|
MAX_OUTPUT = 40
|
4
4
|
APP_FOLDERS = ["models", "serializers", "helpers", "controllers", "mailers", "views", "jobs"]
|
5
|
+
BRANCH_COVERAGE_SUPPORTED = (RUBY_VERSION >= "2.5.0")
|
5
6
|
|
6
7
|
class << self
|
7
8
|
# optionally rewrite the file we guessed with a lambda
|
@@ -66,18 +67,16 @@ module SingleCov
|
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
69
|
-
def setup(framework, root: nil, branches:
|
70
|
+
def setup(framework, root: nil, branches: BRANCH_COVERAGE_SUPPORTED)
|
70
71
|
if defined?(SimpleCov)
|
71
72
|
raise "Load SimpleCov after SingleCov"
|
72
73
|
end
|
73
|
-
if branches &&
|
74
|
-
|
75
|
-
@branches = false
|
76
|
-
else
|
77
|
-
@branches = branches
|
74
|
+
if branches && !BRANCH_COVERAGE_SUPPORTED
|
75
|
+
raise "Branch coverage needs ruby >= 2.5.0"
|
78
76
|
end
|
79
77
|
|
80
|
-
@
|
78
|
+
@branches = branches
|
79
|
+
@root = root
|
81
80
|
|
82
81
|
case framework
|
83
82
|
when :minitest
|
@@ -104,11 +103,17 @@ module SingleCov
|
|
104
103
|
private
|
105
104
|
|
106
105
|
def uncovered_branches(file, coverage, uncovered_lines)
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
106
|
+
# {[branch_id] => {[branch_part] => coverage}} --> {branch_part -> sum-of-coverage}
|
107
|
+
sum = Hash.new(0)
|
108
|
+
coverage.each_value do |branch|
|
109
|
+
branch.each do |k, v|
|
110
|
+
sum[k.slice(2, 4)] += v
|
111
|
+
end
|
111
112
|
end
|
113
|
+
|
114
|
+
# show missing coverage
|
115
|
+
found = sum.select { |k, v| v.zero? && !uncovered_lines.include?(k[0]) }.
|
116
|
+
map { |k, _| "#{file}:#{k[0]}:#{k[1]+1}-#{k[2]}:#{k[3]+1}" }
|
112
117
|
found.sort!
|
113
118
|
found.uniq!
|
114
119
|
found
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: single_cov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: michael@grosser.it
|
@@ -39,7 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
39
39
|
version: '0'
|
40
40
|
requirements: []
|
41
41
|
rubyforge_project:
|
42
|
-
rubygems_version: 2.
|
42
|
+
rubygems_version: 2.7.3
|
43
43
|
signing_key:
|
44
44
|
specification_version: 4
|
45
45
|
summary: Actionable code coverage.
|