single_cov 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/single_cov/version.rb +1 -1
- data/lib/single_cov.rb +12 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0559494539f0d0ca9209b84bde674198d89a56e
|
4
|
+
data.tar.gz: 2ce03aecd293040fea661925982345c06a11fa4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37e9d7ad51bf85e3e405fb6f0f8f614eeb917a3f5a9a23b5a202bba56d70792853dd9571747327d29a1c841aae80a2da38768f6959da593965281971d0ac9988
|
7
|
+
data.tar.gz: ff595bc8c38abc1562624b63ba413dbf60041c52f5c76fedae08d5b17f3bdf721503461a33ccb128c3fc219406989681b8de0dc640e6fbd71b88b6496004dd15
|
data/lib/single_cov/version.rb
CHANGED
data/lib/single_cov.rb
CHANGED
@@ -20,15 +20,17 @@ module SingleCov
|
|
20
20
|
def all_covered?(result)
|
21
21
|
errors = COVERAGES.map do |file, expected_uncovered|
|
22
22
|
if coverage = result["#{root}/#{file}"]
|
23
|
-
|
24
|
-
uncovered_lines = line_coverage
|
23
|
+
line_coverage = (coverage.is_a?(Hash) ? coverage.fetch(:lines) : coverage)
|
24
|
+
uncovered_lines = line_coverage.each_with_index.map { |c, i| i + 1 if c == 0 }.compact
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
uncovered = uncovered_lines.map { |l| "#{file}:#{l}" }
|
27
|
+
|
28
|
+
if branch_coverage = (coverage.is_a?(Hash) && coverage[:branches])
|
29
|
+
uncovered += uncovered_branches(file, branch_coverage, uncovered_lines)
|
28
30
|
end
|
29
31
|
|
30
|
-
next if
|
31
|
-
warn_about_bad_coverage(file, expected_uncovered,
|
32
|
+
next if uncovered.size == expected_uncovered
|
33
|
+
warn_about_bad_coverage(file, expected_uncovered, uncovered)
|
32
34
|
else
|
33
35
|
warn_about_no_coverage(file)
|
34
36
|
end
|
@@ -101,13 +103,11 @@ module SingleCov
|
|
101
103
|
|
102
104
|
private
|
103
105
|
|
104
|
-
def
|
105
|
-
coverage.each_with_index.map { |c, i| "#{file}:#{i + 1}" if c == 0 }.compact
|
106
|
-
end
|
107
|
-
|
108
|
-
def branch_coverage(file, coverage)
|
106
|
+
def uncovered_branches(file, coverage, uncovered_lines)
|
109
107
|
coverage.each_value.flat_map do |branch_part|
|
110
|
-
branch_part.
|
108
|
+
branch_part.
|
109
|
+
select { |k, v| v.zero? && !uncovered_lines.include?(k[2]) }.
|
110
|
+
map { |k, _| "#{file}:#{k[2]}:#{k[3]+1}-#{k[4]}:#{k[5]+1}" }
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|