deep-cover 0.6.1 → 0.6.2
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 +5 -5
- data/CHANGELOG.md +12 -0
- data/lib/deep_cover/analyser/branch.rb +6 -2
- data/lib/deep_cover/custom_requirer.rb +42 -9
- data/lib/deep_cover/node/short_circuit.rb +1 -1
- data/lib/deep_cover/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a766315723e0e4a70d85a1bd0d36c75302c014f4
|
4
|
+
data.tar.gz: 9f65074c91b5926f6b47cbc2b5e6f7f07cd307ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 702c3d7340ad6184f37f840568979e5c174ebcbb0c6b217238dd36ad0d246d512918e237b0fa8f5f6507c3330be554631752ea6edc81feb82bc79af40bd03e3f
|
7
|
+
data.tar.gz: bcc64581373f355253fc8a86fb8b74d5c830daddf36ec5c6d2c496077e03b8b3f026960972cc54c2dd6cc56c599347261ea62b0325946e867c3daeb5d79fa479
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
* `#require` is much faster in MRI Ruby 2.1 and 2.2, resulting in much faster boot time for most applications when deep-cover is enabled.
|
4
|
+
|
5
|
+
## 0.6.1
|
6
|
+
|
7
|
+
* Takeover now also considers branch coverage to generate the per-line output.
|
8
|
+
In order to reach 100% coverage with takeover, you need 100% node coverage and 100% branch coverage.
|
9
|
+
* Support for covering of `#load` in MRI Ruby 2.1 and 2.2
|
10
|
+
|
11
|
+
## 0.6
|
12
|
+
|
13
|
+
* Support for covering of `#load` in MRI Ruby 2.3+
|
14
|
+
|
3
15
|
## 0.5
|
4
16
|
|
5
17
|
* Added custom filters
|
@@ -21,7 +21,7 @@ module DeepCover
|
|
21
21
|
|
22
22
|
def results
|
23
23
|
each_node.map do |node|
|
24
|
-
branches_runs = node.branches.map { |jump| [jump,
|
24
|
+
branches_runs = node.branches.map { |jump| [jump, branch_runs(jump)] }.to_h
|
25
25
|
[node, branches_runs]
|
26
26
|
end.to_h
|
27
27
|
end
|
@@ -29,9 +29,13 @@ module DeepCover
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def worst_branch_runs(fork)
|
32
|
-
fork.branches.map { |jump|
|
32
|
+
fork.branches.map { |jump| branch_runs(jump) }
|
33
33
|
.sort_by { |runs| runs == 0 ? -2 : runs || -1 }
|
34
34
|
.first
|
35
35
|
end
|
36
|
+
|
37
|
+
def branch_runs(branch)
|
38
|
+
branch.flow_entry_count.nonzero? || source.node_runs(branch)
|
39
|
+
end
|
36
40
|
end
|
37
41
|
end
|
@@ -8,6 +8,12 @@ module DeepCover
|
|
8
8
|
@loaded_features = loaded_features
|
9
9
|
@filter = filter
|
10
10
|
@paths_being_required = Set.new
|
11
|
+
|
12
|
+
# A Set of the loaded_features for faster access
|
13
|
+
@loaded_features_set = Set.new
|
14
|
+
# A dup of the loaded_features as they are expected to be for the Set to be valid
|
15
|
+
# If this is different from loaded_features, the set should be refreshed
|
16
|
+
@duped_loaded_features_used_for_set = []
|
11
17
|
end
|
12
18
|
|
13
19
|
# Returns a path to an existing file or nil if none can be found.
|
@@ -28,11 +34,12 @@ module DeepCover
|
|
28
34
|
|
29
35
|
paths_with_ext = extensions_to_try.map { |ext| path + ext }
|
30
36
|
|
37
|
+
refresh_loaded_features_set
|
38
|
+
|
31
39
|
# Doing this check in every case instead of only for absolute_path because ruby has some
|
32
40
|
# built-in $LOADED_FEATURES which aren't an absolute path. Ex: enumerator.so, thread.rb
|
33
|
-
|
34
|
-
|
35
|
-
end
|
41
|
+
path_from_loaded_features = first_path_from_loaded_features_set(paths_with_ext)
|
42
|
+
return path_from_loaded_features if path_from_loaded_features
|
36
43
|
|
37
44
|
if path == abs_path
|
38
45
|
paths_with_ext.each do |path_with_ext|
|
@@ -40,9 +47,8 @@ module DeepCover
|
|
40
47
|
end
|
41
48
|
else
|
42
49
|
possible_paths = paths_with_load_paths(paths_with_ext)
|
43
|
-
|
44
|
-
|
45
|
-
end
|
50
|
+
path_from_loaded_features = first_path_from_loaded_features_set(possible_paths)
|
51
|
+
return path_from_loaded_features if path_from_loaded_features
|
46
52
|
|
47
53
|
possible_paths.each do |possible_path|
|
48
54
|
next unless File.exist?(possible_path)
|
@@ -78,10 +84,10 @@ module DeepCover
|
|
78
84
|
end
|
79
85
|
|
80
86
|
DeepCover.autoload_tracker.wrap_require(path, found_path) do
|
81
|
-
# Either a problem with resolve_path, or a gem that will be added to the load_path by RubyGems
|
82
|
-
return yield(:not_found) unless found_path
|
83
|
-
|
84
87
|
begin
|
88
|
+
# Either a problem with resolve_path, or a gem that will be added to the load_path by RubyGems
|
89
|
+
return yield(:not_found) unless found_path
|
90
|
+
|
85
91
|
@paths_being_required.add(found_path)
|
86
92
|
return yield(:not_in_covered_paths) unless DeepCover.within_lookup_paths?(found_path)
|
87
93
|
return yield(:not_supported) if found_path.end_with?('.so')
|
@@ -92,6 +98,7 @@ module DeepCover
|
|
92
98
|
@loaded_features << found_path
|
93
99
|
ensure
|
94
100
|
@paths_being_required.delete(found_path)
|
101
|
+
add_last_loaded_feature_to_set
|
95
102
|
end
|
96
103
|
end
|
97
104
|
true
|
@@ -127,6 +134,32 @@ module DeepCover
|
|
127
134
|
|
128
135
|
protected
|
129
136
|
|
137
|
+
# updates the loaded_features_set if it needs it
|
138
|
+
def refresh_loaded_features_set
|
139
|
+
return if @duped_loaded_features_used_for_set == @loaded_features
|
140
|
+
|
141
|
+
@duped_loaded_features_used_for_set = @loaded_features.dup
|
142
|
+
@loaded_features_set = Set.new(@duped_loaded_features_used_for_set)
|
143
|
+
end
|
144
|
+
|
145
|
+
# Returns the first path found in the loaded_features_set
|
146
|
+
# Should be called after doing a #refresh_loaded_features_set
|
147
|
+
def first_path_from_loaded_features_set(paths)
|
148
|
+
paths.detect { |path| @loaded_features_set.include?(path) }
|
149
|
+
end
|
150
|
+
|
151
|
+
# Called after a require, adds the last entry of loaded_features to the
|
152
|
+
# loaded_features_set and the clone used to check for a need to refresh
|
153
|
+
# the loaded_features_set. Doing this allows us to never need to update
|
154
|
+
# the loaded_feature_set from scratch (almost? this is a safety precaution)
|
155
|
+
def add_last_loaded_feature_to_set
|
156
|
+
loaded_feature = @loaded_features.last
|
157
|
+
unless @loaded_features_set.include?(loaded_feature)
|
158
|
+
@duped_loaded_features_used_for_set << loaded_feature
|
159
|
+
@loaded_features_set << loaded_feature
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
130
163
|
def paths_with_load_paths(paths)
|
131
164
|
paths.flat_map do |path|
|
132
165
|
@load_paths.map do |load_path|
|
data/lib/deep_cover/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deep-cover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
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: 2018-06-
|
12
|
+
date: 2018-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parser
|
@@ -414,7 +414,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
414
414
|
version: '0'
|
415
415
|
requirements: []
|
416
416
|
rubyforge_project:
|
417
|
-
rubygems_version: 2.
|
417
|
+
rubygems_version: 2.6.14
|
418
418
|
signing_key:
|
419
419
|
specification_version: 4
|
420
420
|
summary: In depth coverage of your Ruby code.
|