deep-cover-core 0.7.7 → 0.7.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/deep_cover/analyser/node.rb +3 -2
- data/lib/deep_cover/backports.rb +2 -0
- data/lib/deep_cover/basics.rb +7 -3
- data/lib/deep_cover/config.rb +40 -49
- data/lib/deep_cover/load.rb +1 -1
- data/lib/deep_cover/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 800f64be0c9af77333d7e68f729d8c3cb4bd8b35cb965fac10422da993d6553e
|
4
|
+
data.tar.gz: 8333ccb194250280995ae1078b48097f2516324f9a85beabddcbca1563735a48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bde03af4ab23daf437f6e37d834c0ca1565043f9395955ab9a110b9e54c7f251827d3a05c2145393cfb5cf8d2b519b2ee8fe2a8a349cf3f7ed844c1b450c5b3
|
7
|
+
data.tar.gz: 03e57609062505285c7828d28cad3859d62e4c77a0e5a98f8336743c9d8c21e507f43afbf4c8ee126dad7903a4e71891c6311154fe71cb65f1b53009f78c3627
|
@@ -8,10 +8,11 @@ module DeepCover
|
|
8
8
|
'Nodes'
|
9
9
|
end
|
10
10
|
|
11
|
-
def initialize(source,
|
11
|
+
def initialize(source, **options)
|
12
12
|
@cache = {}.compare_by_identity
|
13
13
|
super
|
14
|
-
@allow_filters =
|
14
|
+
@allow_filters = Config.options_to_ignored(**options)
|
15
|
+
.map { |kind| Node.filter_to_method_name(kind) }
|
15
16
|
@nocov_ranges = FlagCommentAssociator.new(covered_code)
|
16
17
|
end
|
17
18
|
|
data/lib/deep_cover/backports.rb
CHANGED
data/lib/deep_cover/basics.rb
CHANGED
@@ -2,14 +2,20 @@
|
|
2
2
|
|
3
3
|
# Basic constants without any dependencies are here
|
4
4
|
module DeepCover
|
5
|
+
OPTIONALLY_COVERED = %i[case_implicit_else default_argument raise trivial_if warn]
|
6
|
+
|
7
|
+
FILTER_NAME = Hash.new { |h, k| h[k] = :"ignore_#{k}" }
|
8
|
+
|
9
|
+
ignore_defaults = OPTIONALLY_COVERED.to_h { |opt| [FILTER_NAME[opt], false] }
|
10
|
+
|
5
11
|
DEFAULTS = {
|
6
|
-
ignore_uncovered: [].freeze,
|
7
12
|
paths: [:auto_detect].freeze,
|
8
13
|
allow_partial: false,
|
9
14
|
tracker_global: '$_cov',
|
10
15
|
reporter: :html,
|
11
16
|
output: './coverage',
|
12
17
|
cache_directory: './deep_cover',
|
18
|
+
**ignore_defaults,
|
13
19
|
}.freeze
|
14
20
|
|
15
21
|
CLI_DEFAULTS = {
|
@@ -18,8 +24,6 @@ module DeepCover
|
|
18
24
|
open: false,
|
19
25
|
}.freeze
|
20
26
|
|
21
|
-
OPTIONALLY_COVERED = %i[case_implicit_else default_argument raise trivial_if warn]
|
22
|
-
|
23
27
|
REQUIRABLE_EXTENSIONS = {
|
24
28
|
'.rb' => :ruby,
|
25
29
|
".#{RbConfig::CONFIG['DLEXT']}" => :native_extension,
|
data/lib/deep_cover/config.rb
CHANGED
@@ -2,9 +2,11 @@
|
|
2
2
|
|
3
3
|
module DeepCover
|
4
4
|
class Config
|
5
|
+
NOT_SPECIFIED = Object.new
|
6
|
+
|
5
7
|
def initialize(notify = nil)
|
6
8
|
@notify = nil
|
7
|
-
@options = {
|
9
|
+
@options = {}
|
8
10
|
set(**DEFAULTS)
|
9
11
|
@notify = notify
|
10
12
|
end
|
@@ -36,71 +38,48 @@ module DeepCover
|
|
36
38
|
raise ArgumentError, "wrong number of arguments (given #{keywords.size}, expected 0..1)" if keywords.size > 1
|
37
39
|
keywords << Node.unique_filter if keywords.empty?
|
38
40
|
Node.create_filter(keywords.first, &block)
|
41
|
+
AttributeAccessors.define_accessor(FILTER_NAME[keywords.first])
|
39
42
|
end
|
40
|
-
|
41
|
-
@options[:ignore_uncovered]
|
42
|
-
else
|
43
|
+
unless keywords.empty?
|
43
44
|
keywords = check_uncovered(keywords)
|
44
|
-
|
45
|
+
set(keywords.to_h { |kind| [FILTER_NAME[kind], true] })
|
45
46
|
end
|
47
|
+
Config.options_to_ignored(**@options)
|
46
48
|
end
|
47
49
|
|
48
50
|
def detect_uncovered(*keywords)
|
49
51
|
raise ArgumentError, 'No block is accepted' if block_given?
|
50
|
-
|
51
|
-
OPTIONALLY_COVERED - @options[:ignore_uncovered]
|
52
|
-
else
|
52
|
+
unless keywords.empty?
|
53
53
|
keywords = check_uncovered(keywords)
|
54
|
-
|
54
|
+
set(keywords.to_h { |kind| [FILTER_NAME[kind], false] })
|
55
55
|
end
|
56
|
+
OPTIONALLY_COVERED - Config.options_to_ignored(**@options)
|
56
57
|
end
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
@options[:paths]
|
63
|
-
end
|
64
|
-
end
|
59
|
+
module AttributeAccessors
|
60
|
+
def self.define_accessor(attr)
|
61
|
+
define_method(attr) do |arg = NOT_SPECIFIED|
|
62
|
+
return @options[attr] if arg == NOT_SPECIFIED
|
65
63
|
|
66
|
-
|
67
|
-
|
68
|
-
change(:tracker_global, tracker_global)
|
69
|
-
else
|
70
|
-
@options[:tracker_global]
|
64
|
+
change(attr, arg)
|
65
|
+
end
|
71
66
|
end
|
72
|
-
end
|
73
67
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
else
|
78
|
-
@options[:reporter]
|
79
|
-
end
|
68
|
+
%i[paths tracker_global reporter output cache_directory allow_partial]
|
69
|
+
.concat(OPTIONALLY_COVERED.map { |filter| FILTER_NAME[filter] })
|
70
|
+
.each { |attr| define_accessor(attr) }
|
80
71
|
end
|
81
72
|
|
82
|
-
|
83
|
-
if path_or_false != nil
|
84
|
-
change(:output, path_or_false)
|
85
|
-
else
|
86
|
-
@options[:output]
|
87
|
-
end
|
88
|
-
end
|
73
|
+
include AttributeAccessors
|
89
74
|
|
90
|
-
def
|
91
|
-
|
92
|
-
|
93
|
-
else
|
94
|
-
File.expand_path(@options[:cache_directory])
|
95
|
-
end
|
75
|
+
def paths(paths = NOT_SPECIFIED)
|
76
|
+
paths = Array(paths).dup unless paths == NOT_SPECIFIED
|
77
|
+
super
|
96
78
|
end
|
97
79
|
|
98
|
-
def
|
99
|
-
if
|
100
|
-
|
101
|
-
else
|
102
|
-
@options[:allow_partial]
|
103
|
-
end
|
80
|
+
def cache_directory(cache_directory = NOT_SPECIFIED)
|
81
|
+
return File.expand_path(super) if cache_directory == NOT_SPECIFIED
|
82
|
+
super
|
104
83
|
end
|
105
84
|
|
106
85
|
def reset
|
@@ -110,14 +89,26 @@ module DeepCover
|
|
110
89
|
self
|
111
90
|
end
|
112
91
|
|
92
|
+
def [](opt)
|
93
|
+
public_send(opt)
|
94
|
+
end
|
95
|
+
|
96
|
+
def []=(opt, value)
|
97
|
+
public_send(opt, value)
|
98
|
+
end
|
99
|
+
|
113
100
|
def set(**options)
|
114
|
-
@options[:ignore_uncovered] = [] if options.has_key?(:ignore_uncovered)
|
115
101
|
options.each do |key, value|
|
116
|
-
|
102
|
+
self[key] = value
|
117
103
|
end
|
118
104
|
self
|
119
105
|
end
|
120
106
|
|
107
|
+
def self.options_to_ignored(**options)
|
108
|
+
OPTIONALLY_COVERED
|
109
|
+
.select { |filter| options[FILTER_NAME[filter]] }
|
110
|
+
end
|
111
|
+
|
121
112
|
private
|
122
113
|
|
123
114
|
def check_uncovered(keywords)
|
data/lib/deep_cover/load.rb
CHANGED
@@ -9,6 +9,7 @@ module DeepCover
|
|
9
9
|
]
|
10
10
|
|
11
11
|
def load_absolute_basics
|
12
|
+
require_relative 'backports'
|
12
13
|
require_relative 'base'
|
13
14
|
require_relative 'basics'
|
14
15
|
require_relative 'config_setter'
|
@@ -44,7 +45,6 @@ module DeepCover
|
|
44
45
|
def bootstrap
|
45
46
|
@bootstrapped ||= false # Avoid warning
|
46
47
|
return if @bootstrapped
|
47
|
-
require_relative 'backports'
|
48
48
|
require_relative 'tools'
|
49
49
|
@bootstrapped = true
|
50
50
|
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.7.
|
4
|
+
version: 0.7.8
|
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-
|
12
|
+
date: 2020-02-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parser
|