single_cov 1.1.0 → 1.2.0

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: fc46724cb995c3bf97cfb5e59f0ffb96ab508522e56269386769f9a40bbf35b3
4
- data.tar.gz: e7a93ad442bc9145900505b8d8c76e510aa2e9e4b7cf3ce9e4a03368fcbdeb8e
3
+ metadata.gz: 310e80976c5b117b3cfa36b082ca4c2b3fdbaf55733891cb450c33bc9b28636e
4
+ data.tar.gz: f50cc1ddb095a99ff9d0b2f9aba410ec02dddf499895dae228b252a728eb2d55
5
5
  SHA512:
6
- metadata.gz: 88acb179ed998ce309df2e5bcf80814591c0187c98093827e767f5ada0335f2a5db726b13d1ae56aa0f6a4134e17b69b9ca86d37033fe530c859f8637798ce4c
7
- data.tar.gz: 1a2e84b437f57143087cfcba3249c871d9039331b45be8b1c7b5f3ecea046c1dec09d5c3cddcfa0687de9d32a872b0c8c77a26e42e6898d27fa3b8f1a5e6b63b
6
+ metadata.gz: 0d1741d4b3823b2c3d703ab400a4a11f6738321a73c0463aa5590cdd1a2bd1fe97e31c561e1d8745f75908f4bef62bcc4916242ff76c18b633b64de8fa29b1e6
7
+ data.tar.gz: 8566b0b3f4a36ba63849bbbb0ca51f13c3e4e23820ff155213563fded10915441d5be66137b5c4e44fa7c01a33fe7209a2c39cc8d0c1a900f186cc24b1d9696e
@@ -3,6 +3,7 @@ module SingleCov
3
3
  MAX_OUTPUT = 40
4
4
  APP_FOLDERS = ["models", "serializers", "helpers", "controllers", "mailers", "views", "jobs", "channels"]
5
5
  BRANCH_COVERAGE_SUPPORTED = (RUBY_VERSION >= "2.5.0")
6
+ UNCOVERED_COMMENT_MARKER = "uncovered"
6
7
 
7
8
  class << self
8
9
  # optionally rewrite the file we guessed with a lambda
@@ -31,9 +32,18 @@ module SingleCov
31
32
 
32
33
  next if uncovered.size == expected_uncovered
33
34
 
35
+ # ignore lines that are marked as uncovered via comments
36
+ # NOTE: ideally we should also warn when using uncovered but the section is indeed covered
37
+ content = File.readlines(file)
38
+ uncovered.reject! do |line_start, _, _, _|
39
+ content[line_start - 1].include?(UNCOVERED_COMMENT_MARKER)
40
+ end
41
+
42
+ next if uncovered.size == expected_uncovered
43
+
34
44
  # branches are unsorted and added to the end, only sort when necessary
35
45
  if branch_coverage
36
- uncovered.sort_by! { |line_start, char_start, line_end, char_end| [line_start, char_start || 0] }
46
+ uncovered.sort_by! { |line_start, char_start, _, _| [line_start, char_start || 0] }
37
47
  end
38
48
 
39
49
  uncovered.map! do |line_start, char_start, line_end, char_end|
@@ -1,3 +1,3 @@
1
1
  module SingleCov
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
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.1.0
4
+ version: 1.2.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-07-05 00:00:00.000000000 Z
11
+ date: 2018-10-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: michael@grosser.it