deep-cover-core 0.7.10 → 0.8.0
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/deep_cover/backports.rb +1 -0
- data/lib/deep_cover/base.rb +13 -1
- data/lib/deep_cover/basics.rb +1 -0
- data/lib/deep_cover/config.rb +8 -3
- data/lib/deep_cover/tools/to_regexp.rb +16 -0
- data/lib/deep_cover/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0c5b9a12436fc45584c37140a696c593464e060308642cd377714628e4171711
|
|
4
|
+
data.tar.gz: 39844dab92a3c623c837a9aa2d7efe442053c0d9e2416646ec6af92b9f32b8c0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cfc8cf262c0560bb163599e02f40e04395ada31da9fcf5938e4aad2867cbaed88bd0985907a9a3304e5ac5de863f68ea21abae31e0262aba9bddc717f72ec842
|
|
7
|
+
data.tar.gz: 42568873920903fd21e626b36530edf3a78ef03f0eb045807588fd2cf0954b3a9fc7ff4456ae621508fa788bcd2975e5ba808f6ef81dabd2228f30ab45f6c80b
|
data/lib/deep_cover/backports.rb
CHANGED
|
@@ -17,6 +17,7 @@ require 'backports/2.4.0/false_class/dup'
|
|
|
17
17
|
require 'backports/2.4.0/true_class/dup'
|
|
18
18
|
require 'backports/2.4.0/hash/transform_values'
|
|
19
19
|
require 'backports/2.4.0/enumerable/sum'
|
|
20
|
+
require 'backports/2.4.0/regexp/match'
|
|
20
21
|
require 'backports/2.5.0/hash/slice'
|
|
21
22
|
require 'backports/2.5.0/hash/transform_keys'
|
|
22
23
|
require 'backports/2.5.0/kernel/yield_self'
|
data/lib/deep_cover/base.rb
CHANGED
|
@@ -38,7 +38,9 @@ module DeepCover
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def line_coverage(filename)
|
|
41
|
-
|
|
41
|
+
filename = handle_relative_filename(filename)
|
|
42
|
+
return unless coverage.covered_code?(filename)
|
|
43
|
+
coverage.line_coverage(filename, **config.to_h)
|
|
42
44
|
end
|
|
43
45
|
|
|
44
46
|
def covered_code(filename)
|
|
@@ -62,6 +64,9 @@ module DeepCover
|
|
|
62
64
|
when :paths
|
|
63
65
|
warn "Changing DeepCover's paths after starting coverage is highly discouraged" if running?
|
|
64
66
|
@lookup_globs = @all_tracked_file_paths = nil
|
|
67
|
+
when :excluded_paths
|
|
68
|
+
warn "Changing DeepCover's excluded_paths after starting coverage is highly discouraged" if running?
|
|
69
|
+
@all_tracked_file_paths = nil
|
|
65
70
|
when :tracker_global
|
|
66
71
|
raise NotImplementedError, "Changing DeepCover's tracker global after starting coverage is not supported" if running?
|
|
67
72
|
@coverage = nil
|
|
@@ -79,6 +84,11 @@ module DeepCover
|
|
|
79
84
|
@coverage ||= Coverage.new
|
|
80
85
|
end
|
|
81
86
|
|
|
87
|
+
def lookup_exclusion
|
|
88
|
+
@lookup_exclusion ||= Regexp.union(*
|
|
89
|
+
config.exclude_paths.map { |x| Tools.to_regexp(x) })
|
|
90
|
+
end
|
|
91
|
+
|
|
82
92
|
def lookup_globs
|
|
83
93
|
return @lookup_globs if @lookup_globs
|
|
84
94
|
paths = Array(config.paths || :auto_detect).dup
|
|
@@ -143,6 +153,7 @@ module DeepCover
|
|
|
143
153
|
end
|
|
144
154
|
|
|
145
155
|
def tracked_file_path?(path)
|
|
156
|
+
return false if lookup_exclusion.match?(path)
|
|
146
157
|
# The flags are to make fnmatch match the same things as Dir.glob... This doesn't seem to be documented anywhere
|
|
147
158
|
# EXTGLOB: allow matching {lib,app} as either lib or app
|
|
148
159
|
# PATHNAME: Makes wildcard match not match /, and make /**/ (and pattern starting with **/) be any number of nested directory
|
|
@@ -155,6 +166,7 @@ module DeepCover
|
|
|
155
166
|
paths_found.select! { |path| path.end_with?('.rb') }
|
|
156
167
|
paths_found.select! { |path| File.file?(path) }
|
|
157
168
|
paths_found.uniq!
|
|
169
|
+
paths_found.reject! { |path| lookup_exclusion.match?(path) }
|
|
158
170
|
@all_tracked_file_paths = paths_found
|
|
159
171
|
@all_tracked_file_paths.dup
|
|
160
172
|
end
|
data/lib/deep_cover/basics.rb
CHANGED
data/lib/deep_cover/config.rb
CHANGED
|
@@ -20,7 +20,7 @@ module DeepCover
|
|
|
20
20
|
hash = to_hash
|
|
21
21
|
# TODO: (Max) I don't like mixup of configs being partly on DeepCover and Config like that...
|
|
22
22
|
hash[:paths] = DeepCover.lookup_globs
|
|
23
|
-
hash[:output]
|
|
23
|
+
hash[:output] &&= File.expand_path(hash[:output])
|
|
24
24
|
hash[:cache_directory] = File.expand_path(hash[:cache_directory])
|
|
25
25
|
hash
|
|
26
26
|
end
|
|
@@ -42,7 +42,7 @@ module DeepCover
|
|
|
42
42
|
end
|
|
43
43
|
unless keywords.empty?
|
|
44
44
|
keywords = check_uncovered(keywords)
|
|
45
|
-
set(keywords.to_h { |kind| [FILTER_NAME[kind], true] })
|
|
45
|
+
set(**keywords.to_h { |kind| [FILTER_NAME[kind], true] })
|
|
46
46
|
end
|
|
47
47
|
Config.options_to_ignored(**@options)
|
|
48
48
|
end
|
|
@@ -65,13 +65,18 @@ module DeepCover
|
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
%i[paths tracker_global reporter output cache_directory allow_partial]
|
|
68
|
+
%i[paths exclude_paths tracker_global reporter output cache_directory allow_partial]
|
|
69
69
|
.concat(OPTIONALLY_COVERED.map { |filter| FILTER_NAME[filter] })
|
|
70
70
|
.each { |attr| define_accessor(attr) }
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
include AttributeAccessors
|
|
74
74
|
|
|
75
|
+
def exclude_paths(paths = NOT_SPECIFIED)
|
|
76
|
+
paths = Array(paths).dup unless paths == NOT_SPECIFIED
|
|
77
|
+
super
|
|
78
|
+
end
|
|
79
|
+
|
|
75
80
|
def paths(paths = NOT_SPECIFIED)
|
|
76
81
|
paths = Array(paths).dup unless paths == NOT_SPECIFIED
|
|
77
82
|
super
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DeepCover
|
|
4
|
+
module Tools::ToRegexp
|
|
5
|
+
def to_regexp(regexp_or_str)
|
|
6
|
+
case regexp_or_str
|
|
7
|
+
when Regexp
|
|
8
|
+
regexp_or_str
|
|
9
|
+
when String
|
|
10
|
+
Regexp.new(Regexp.quote(regexp_or_str))
|
|
11
|
+
else
|
|
12
|
+
raise TypeError
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/deep_cover/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: deep-cover-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marc-André Lafortune
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2020-04-
|
|
12
|
+
date: 2020-04-23 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: parser
|
|
@@ -303,6 +303,7 @@ files:
|
|
|
303
303
|
- lib/deep_cover/tools/silence_warnings.rb
|
|
304
304
|
- lib/deep_cover/tools/slice.rb
|
|
305
305
|
- lib/deep_cover/tools/strip_heredoc.rb
|
|
306
|
+
- lib/deep_cover/tools/to_regexp.rb
|
|
306
307
|
- lib/deep_cover/tools/truncate_backtrace.rb
|
|
307
308
|
- lib/deep_cover/tools/with_unbundled_env.rb
|
|
308
309
|
- lib/deep_cover/version.rb
|
|
@@ -325,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
325
326
|
- !ruby/object:Gem::Version
|
|
326
327
|
version: '0'
|
|
327
328
|
requirements: []
|
|
328
|
-
rubygems_version: 3.
|
|
329
|
+
rubygems_version: 3.0.3
|
|
329
330
|
signing_key:
|
|
330
331
|
specification_version: 4
|
|
331
332
|
summary: In depth coverage of your Ruby code.
|