single_cov 1.0.1 → 1.0.2

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: b861880f75aa6369616e69f9913c7f6125d689e3047f8fdbecd3ab12aedffeff
4
- data.tar.gz: 67a8569983f2e9c71d98ef0fe1a9fba52a8b5bde9ebc7b0a97d76c9ce9c17fff
3
+ metadata.gz: 11ef65dfb536bd0a3194ea9668ac96975723fece04a0c4561c61c42a799427a3
4
+ data.tar.gz: 15ac6753da7ff1b3f5a330c25660c1dcb9fb9fec17a8aaed2126e732f68977de
5
5
  SHA512:
6
- metadata.gz: e794fb7a72d24d7885ebafc70efa1c749f3a829b9e6bff9cda733634580fe4e364a6e5afac19eebe5d52bcd1caead8f04af2272a9391ca230b004f461a552aa1
7
- data.tar.gz: ed70b6b216036bbb4b71684210978be0a456be4e8d1130d7c7dd7529c640291c35624c7797ae4e795d9ae26152bed63b1ff64a9e1733d9ac3a6bb57e97d4a93b
6
+ metadata.gz: e0f909a8774964b6d651f95e57aab1fec5fed9462a2e12ab932b9c1d43d249276b5ea5e79770b2ef3ab7eb3143dc067b463f5bfae1a0bdae88a5630b4c19dce6
7
+ data.tar.gz: 6ecfeee0f58db257fd44f25a0606c8ef0d0064a0eadf024aee912836b599ec413d304846d026d84d6a8e97fcedb0db85bfd86b65f36622abc509e69c4d43e9eb
@@ -1,3 +1,3 @@
1
1
  module SingleCov
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
data/lib/single_cov.rb CHANGED
@@ -22,15 +22,22 @@ module SingleCov
22
22
  errors = COVERAGES.map do |file, expected_uncovered|
23
23
  if coverage = result["#{root}/#{file}"]
24
24
  line_coverage = (coverage.is_a?(Hash) ? coverage.fetch(:lines) : coverage)
25
- uncovered_lines = line_coverage.each_with_index.map { |c, i| i + 1 if c == 0 }.compact
25
+ uncovered = line_coverage.each_with_index.map { |c, i| i + 1 if c == 0 }.compact
26
+ branch_coverage = (coverage.is_a?(Hash) && coverage[:branches])
26
27
 
27
- uncovered = uncovered_lines.map { |l| "#{file}:#{l}" }
28
-
29
- if branch_coverage = (coverage.is_a?(Hash) && coverage[:branches])
30
- uncovered += uncovered_branches(file, branch_coverage, uncovered_lines)
28
+ if branch_coverage
29
+ uncovered.concat uncovered_branches(file, branch_coverage, uncovered)
31
30
  end
32
31
 
33
32
  next if uncovered.size == expected_uncovered
33
+
34
+ # branches are unsorted and added to the end, only sort when necessary
35
+ uncovered.sort! if branch_coverage
36
+
37
+ uncovered.map! do |line_start, char_start, line_end, char_end|
38
+ char_start ? "#{file}:#{line_start}:#{char_start}-#{line_end}:#{char_end}" : "#{file}:#{line_start}"
39
+ end
40
+
34
41
  warn_about_bad_coverage(file, expected_uncovered, uncovered)
35
42
  else
36
43
  warn_about_no_coverage(file)
@@ -113,8 +120,7 @@ module SingleCov
113
120
 
114
121
  # show missing coverage
115
122
  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}" }
117
- found.sort!
123
+ map { |k, _| [k[0], k[1]+1, k[2], k[3]+1] }
118
124
  found.uniq!
119
125
  found
120
126
  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.0.1
4
+ version: 1.0.2
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-04-04 00:00:00.000000000 Z
11
+ date: 2018-04-27 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.7.3
42
+ rubygems_version: 2.7.6
43
43
  signing_key:
44
44
  specification_version: 4
45
45
  summary: Actionable code coverage.