single_cov 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2cf305464b1da18b681573d4e895ba407a3205665d17b2a6ebb344dfcf53d0c
4
- data.tar.gz: baaf64ed79b78aaea3b4d19a60d4f068f38bee2473dae5ec7ac7a85392e8b05d
3
+ metadata.gz: 827ceb79a067459e6c40e66fc052fd9b922d73656562cc35a35b499b4dbf15c5
4
+ data.tar.gz: 8197618944b46a5e5bf34e095d48a9fbd533f64a2f4dae149d401051fa97b38e
5
5
  SHA512:
6
- metadata.gz: 9c78ebf762c39a959945fba05bea127029d9594dcdf973e146e47ad9a5d1070e1db4196c2deac23e1c8ce44c886547b25e5f092f19f7b2643fe3b8611f67afab
7
- data.tar.gz: 96633f2c63bd2e512a57e45130ce71aacc5d16f4e1636f77be274bfe405be9526728c69ab4d6d14bf9db5a13805cd30ccb6e47690f73db522df52c450d7c7ee2
6
+ metadata.gz: 1789876259d42f38c6a36a085d7043a2beeecda0bc768abc6c6b3ce818a6b82c1f472fbfb2f11c97ced7e1e855022a51da2f808f7a3e5bd39c90762b310f4220
7
+ data.tar.gz: d6a03f95df3616adee7715aa42101dedfc9daa514fa383cdc336fc46fa235a432916d5a4f931a19e765c890058aa26b69905fd48287074935c6600af27460e7a
@@ -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
- uncovered = line_coverage.each_with_index.map { |c, i| i + 1 if c == 0 }.compact
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
- if branch_coverage
32
- uncovered.concat uncovered_branches(branch_coverage, uncovered)
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 necessary
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 ? "#{file}:#{line_start}:#{char_start}-#{line_end}:#{char_end}" : "#{file}:#{line_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
- found = sum.select { |k, v| v.zero? && !uncovered_lines.include?(k[0]) }.
149
- map { |k, _| [k[0], k[1]+1, k[2], k[3]+1] }
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
@@ -1,3 +1,3 @@
1
1
  module SingleCov
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
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.0
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: 2018-12-14 00:00:00.000000000 Z
11
+ date: 2019-04-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: michael@grosser.it