single_cov 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/single_cov.rb +16 -10
- data/lib/single_cov/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 827ceb79a067459e6c40e66fc052fd9b922d73656562cc35a35b499b4dbf15c5
|
4
|
+
data.tar.gz: 8197618944b46a5e5bf34e095d48a9fbd533f64a2f4dae149d401051fa97b38e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1789876259d42f38c6a36a085d7043a2beeecda0bc768abc6c6b3ce818a6b82c1f472fbfb2f11c97ced7e1e855022a51da2f808f7a3e5bd39c90762b310f4220
|
7
|
+
data.tar.gz: d6a03f95df3616adee7715aa42101dedfc9daa514fa383cdc336fc46fa235a432916d5a4f931a19e765c890058aa26b69905fd48287074935c6600af27460e7a
|
data/lib/single_cov.rb
CHANGED
@@ -25,13 +25,12 @@ module SingleCov
|
|
25
25
|
errors = COVERAGES.map do |file, expected_uncovered|
|
26
26
|
if coverage = result["#{root}/#{file}"]
|
27
27
|
line_coverage = (coverage.is_a?(Hash) ? coverage.fetch(:lines) : coverage)
|
28
|
-
|
29
|
-
branch_coverage = (coverage.is_a?(Hash) && coverage[:branches])
|
28
|
+
uncovered_lines = line_coverage.each_with_index.map { |c, i| i + 1 if c == 0 }.compact
|
30
29
|
|
31
|
-
|
32
|
-
|
33
|
-
end
|
30
|
+
branch_coverage = (coverage.is_a?(Hash) && coverage[:branches])
|
31
|
+
uncovered_branches = (branch_coverage ? uncovered_branches(branch_coverage, uncovered_lines) : [])
|
34
32
|
|
33
|
+
uncovered = uncovered_lines.concat uncovered_branches
|
35
34
|
next if uncovered.size == expected_uncovered
|
36
35
|
|
37
36
|
# ignore lines that are marked as uncovered via comments
|
@@ -40,16 +39,23 @@ module SingleCov
|
|
40
39
|
uncovered.reject! do |line_start, _, _, _|
|
41
40
|
content[line_start - 1].include?(UNCOVERED_COMMENT_MARKER)
|
42
41
|
end
|
43
|
-
|
44
42
|
next if uncovered.size == expected_uncovered
|
45
43
|
|
46
|
-
# branches are unsorted and added to the end, only sort when
|
44
|
+
# branches are unsorted and added to the end, only sort when displayed
|
47
45
|
if branch_coverage
|
48
46
|
uncovered.sort_by! { |line_start, char_start, _, _| [line_start, char_start || 0] }
|
49
47
|
end
|
50
48
|
|
51
49
|
uncovered.map! do |line_start, char_start, line_end, char_end|
|
52
|
-
char_start
|
50
|
+
if char_start # branch coverage
|
51
|
+
if line_start == line_end
|
52
|
+
"#{file}:#{line_start}:#{char_start}-#{char_end}"
|
53
|
+
else # possibly unreachable since branches always seem to be on the same line
|
54
|
+
"#{file}:#{line_start}:#{char_start}-#{line_end}:#{char_end}"
|
55
|
+
end
|
56
|
+
else
|
57
|
+
"#{file}:#{line_start}"
|
58
|
+
end
|
53
59
|
end
|
54
60
|
|
55
61
|
warn_about_bad_coverage(file, expected_uncovered, uncovered)
|
@@ -145,8 +151,8 @@ module SingleCov
|
|
145
151
|
end
|
146
152
|
|
147
153
|
# show missing coverage
|
148
|
-
|
149
|
-
|
154
|
+
sum.select! { |k, v| v.zero? && !uncovered_lines.include?(k[0]) }
|
155
|
+
found = sum.map { |k, _| [k[0], k[1]+1, k[2], k[3]+1] }
|
150
156
|
found.uniq!
|
151
157
|
found
|
152
158
|
end
|
data/lib/single_cov/version.rb
CHANGED
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: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: michael@grosser.it
|