deep-cover 0.6.2 → 0.6.3.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/.rspec +2 -1
- data/.rspec_all +2 -1
- data/.rubocop.yml +8 -9
- data/Gemfile +2 -0
- data/Rakefile +32 -6
- data/bin/cov +3 -3
- data/deep_cover.gemspec +3 -16
- data/exe/deep-cover +5 -0
- data/lib/deep_cover/cli/debugger.rb +1 -1
- data/lib/deep_cover/cli/exec.rb +1 -1
- data/lib/deep_cover/cli/instrumented_clone_reporter.rb +5 -3
- data/lib/deep_cover/cli/runner.rb +2 -2
- data/lib/deep_cover/{tools/dump_covered_code.rb → dump_covered_code.rb} +2 -0
- metadata +10 -203
- data/lib/deep-cover.rb +0 -3
- data/lib/deep_cover.rb +0 -22
- data/lib/deep_cover/analyser.rb +0 -23
- data/lib/deep_cover/analyser/base.rb +0 -104
- data/lib/deep_cover/analyser/branch.rb +0 -41
- data/lib/deep_cover/analyser/covered_code_source.rb +0 -21
- data/lib/deep_cover/analyser/function.rb +0 -14
- data/lib/deep_cover/analyser/node.rb +0 -54
- data/lib/deep_cover/analyser/per_char.rb +0 -38
- data/lib/deep_cover/analyser/per_line.rb +0 -41
- data/lib/deep_cover/analyser/ruby25_like_branch.rb +0 -211
- data/lib/deep_cover/analyser/statement.rb +0 -33
- data/lib/deep_cover/analyser/stats.rb +0 -54
- data/lib/deep_cover/analyser/subset.rb +0 -27
- data/lib/deep_cover/auto_run.rb +0 -71
- data/lib/deep_cover/autoload_tracker.rb +0 -215
- data/lib/deep_cover/backports.rb +0 -22
- data/lib/deep_cover/base.rb +0 -117
- data/lib/deep_cover/basics.rb +0 -22
- data/lib/deep_cover/builtin_takeover.rb +0 -10
- data/lib/deep_cover/config.rb +0 -104
- data/lib/deep_cover/config_setter.rb +0 -33
- data/lib/deep_cover/core_ext/autoload_overrides.rb +0 -112
- data/lib/deep_cover/core_ext/coverage_replacement.rb +0 -61
- data/lib/deep_cover/core_ext/exec_callbacks.rb +0 -27
- data/lib/deep_cover/core_ext/instruction_sequence_load_iseq.rb +0 -32
- data/lib/deep_cover/core_ext/load_overrides.rb +0 -19
- data/lib/deep_cover/core_ext/require_overrides.rb +0 -28
- data/lib/deep_cover/coverage.rb +0 -125
- data/lib/deep_cover/coverage/analysis.rb +0 -42
- data/lib/deep_cover/coverage/persistence.rb +0 -84
- data/lib/deep_cover/covered_code.rb +0 -145
- data/lib/deep_cover/custom_requirer.rb +0 -187
- data/lib/deep_cover/flag_comment_associator.rb +0 -68
- data/lib/deep_cover/load.rb +0 -66
- data/lib/deep_cover/memoize.rb +0 -48
- data/lib/deep_cover/module_override.rb +0 -39
- data/lib/deep_cover/node.rb +0 -23
- data/lib/deep_cover/node/arguments.rb +0 -51
- data/lib/deep_cover/node/assignments.rb +0 -273
- data/lib/deep_cover/node/base.rb +0 -155
- data/lib/deep_cover/node/begin.rb +0 -27
- data/lib/deep_cover/node/block.rb +0 -61
- data/lib/deep_cover/node/branch.rb +0 -32
- data/lib/deep_cover/node/case.rb +0 -113
- data/lib/deep_cover/node/collections.rb +0 -31
- data/lib/deep_cover/node/const.rb +0 -12
- data/lib/deep_cover/node/def.rb +0 -40
- data/lib/deep_cover/node/empty_body.rb +0 -32
- data/lib/deep_cover/node/exceptions.rb +0 -79
- data/lib/deep_cover/node/if.rb +0 -73
- data/lib/deep_cover/node/keywords.rb +0 -86
- data/lib/deep_cover/node/literals.rb +0 -100
- data/lib/deep_cover/node/loops.rb +0 -74
- data/lib/deep_cover/node/mixin/can_augment_children.rb +0 -65
- data/lib/deep_cover/node/mixin/check_completion.rb +0 -18
- data/lib/deep_cover/node/mixin/child_can_be_empty.rb +0 -27
- data/lib/deep_cover/node/mixin/executed_after_children.rb +0 -15
- data/lib/deep_cover/node/mixin/execution_location.rb +0 -66
- data/lib/deep_cover/node/mixin/filters.rb +0 -47
- data/lib/deep_cover/node/mixin/flow_accounting.rb +0 -71
- data/lib/deep_cover/node/mixin/has_child.rb +0 -145
- data/lib/deep_cover/node/mixin/has_child_handler.rb +0 -75
- data/lib/deep_cover/node/mixin/has_tracker.rb +0 -46
- data/lib/deep_cover/node/mixin/is_statement.rb +0 -20
- data/lib/deep_cover/node/mixin/rewriting.rb +0 -35
- data/lib/deep_cover/node/mixin/wrapper.rb +0 -15
- data/lib/deep_cover/node/module.rb +0 -66
- data/lib/deep_cover/node/root.rb +0 -20
- data/lib/deep_cover/node/send.rb +0 -161
- data/lib/deep_cover/node/short_circuit.rb +0 -42
- data/lib/deep_cover/node/splat.rb +0 -15
- data/lib/deep_cover/node/variables.rb +0 -16
- data/lib/deep_cover/parser_ext/range.rb +0 -21
- data/lib/deep_cover/problem_with_diagnostic.rb +0 -63
- data/lib/deep_cover/reporter.rb +0 -10
- data/lib/deep_cover/reporter/base.rb +0 -68
- data/lib/deep_cover/reporter/html.rb +0 -15
- data/lib/deep_cover/reporter/html/base.rb +0 -14
- data/lib/deep_cover/reporter/html/index.rb +0 -59
- data/lib/deep_cover/reporter/html/site.rb +0 -70
- data/lib/deep_cover/reporter/html/source.rb +0 -136
- data/lib/deep_cover/reporter/html/template/assets/32px.png +0 -0
- data/lib/deep_cover/reporter/html/template/assets/40px.png +0 -0
- data/lib/deep_cover/reporter/html/template/assets/deep_cover.css.sass +0 -336
- data/lib/deep_cover/reporter/html/template/assets/jquery-3.2.1.min.js +0 -4
- data/lib/deep_cover/reporter/html/template/assets/jquery-3.2.1.min.map +0 -1
- data/lib/deep_cover/reporter/html/template/assets/jstree.css +0 -1108
- data/lib/deep_cover/reporter/html/template/assets/jstree.js +0 -8424
- data/lib/deep_cover/reporter/html/template/assets/jstreetable.js +0 -1069
- data/lib/deep_cover/reporter/html/template/assets/throbber.gif +0 -0
- data/lib/deep_cover/reporter/html/template/index.html.erb +0 -75
- data/lib/deep_cover/reporter/html/template/source.html.erb +0 -35
- data/lib/deep_cover/reporter/istanbul.rb +0 -184
- data/lib/deep_cover/reporter/text.rb +0 -58
- data/lib/deep_cover/reporter/tree/util.rb +0 -86
- data/lib/deep_cover/tools.rb +0 -22
- data/lib/deep_cover/tools/blank.rb +0 -25
- data/lib/deep_cover/tools/builtin_coverage.rb +0 -55
- data/lib/deep_cover/tools/camelize.rb +0 -13
- data/lib/deep_cover/tools/content_tag.rb +0 -11
- data/lib/deep_cover/tools/covered.rb +0 -9
- data/lib/deep_cover/tools/execute_sample.rb +0 -34
- data/lib/deep_cover/tools/format.rb +0 -18
- data/lib/deep_cover/tools/format_char_cover.rb +0 -19
- data/lib/deep_cover/tools/format_generated_code.rb +0 -27
- data/lib/deep_cover/tools/indent_string.rb +0 -26
- data/lib/deep_cover/tools/merge.rb +0 -16
- data/lib/deep_cover/tools/number_lines.rb +0 -22
- data/lib/deep_cover/tools/our_coverage.rb +0 -11
- data/lib/deep_cover/tools/profiling.rb +0 -68
- data/lib/deep_cover/tools/render_template.rb +0 -13
- data/lib/deep_cover/tools/require_relative_dir.rb +0 -12
- data/lib/deep_cover/tools/scan_match_datas.rb +0 -10
- data/lib/deep_cover/tools/silence_warnings.rb +0 -18
- data/lib/deep_cover/tools/slice.rb +0 -9
- data/lib/deep_cover/tools/strip_heredoc.rb +0 -18
- data/lib/deep_cover/tools/truncate_backtrace.rb +0 -32
- data/lib/deep_cover/tracker_bucket.rb +0 -50
- data/lib/deep_cover/tracker_hits_per_path.rb +0 -35
- data/lib/deep_cover/tracker_storage.rb +0 -76
- data/lib/deep_cover/tracker_storage_per_path.rb +0 -34
- data/lib/deep_cover/version.rb +0 -5
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module DeepCover
|
4
|
-
module Tools::StripHeredoc
|
5
|
-
# In-place implementation copied from active-support.
|
6
|
-
IMPLEMENTATION = -> do
|
7
|
-
gsub(/^#{scan(/^[ \t]*(?=\S)/).min}/, ''.freeze).tap do |stripped|
|
8
|
-
stripped.freeze if frozen?
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
# Same as #strip_heredoc from active-support
|
13
|
-
# https://github.com/rails/rails/blob/16574409f813e2197f88e4a06b527618d64d9ff0/activesupport/lib/active_support/core_ext/string/strip.rb#L22
|
14
|
-
def strip_heredoc(string)
|
15
|
-
string.instance_exec(&IMPLEMENTATION)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module DeepCover
|
4
|
-
module Tools::TruncateBacktrace
|
5
|
-
def truncate_backtrace(backtrace, extra_context: 10)
|
6
|
-
backtrace = backtrace.backtrace if backtrace.is_a?(Exception)
|
7
|
-
trace_lines = backtrace.uniq
|
8
|
-
|
9
|
-
keep_from_begin = 0
|
10
|
-
keep_from_end = backtrace.size - 1
|
11
|
-
|
12
|
-
trace_lines.each do |line|
|
13
|
-
from_begin = backtrace.index(line)
|
14
|
-
from_end = backtrace.rindex(line)
|
15
|
-
if from_begin <= backtrace.size - 1 - from_end
|
16
|
-
keep_from_begin = [keep_from_begin, from_begin].max
|
17
|
-
else
|
18
|
-
keep_from_end = [keep_from_end, from_end].min
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
keep_from_begin += extra_context
|
23
|
-
keep_from_end -= extra_context
|
24
|
-
|
25
|
-
return backtrace if keep_from_begin + 5 >= keep_from_end
|
26
|
-
|
27
|
-
result = backtrace[0..keep_from_begin]
|
28
|
-
result << "... #{keep_from_end - keep_from_begin - 1} levels..."
|
29
|
-
result.concat backtrace[keep_from_end..-1]
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module DeepCover
|
4
|
-
bootstrap
|
5
|
-
|
6
|
-
require_relative 'tracker_storage'
|
7
|
-
|
8
|
-
# A holder for TrackerStorages, using some `global_name`.
|
9
|
-
class TrackerBucket
|
10
|
-
@@index = {}
|
11
|
-
|
12
|
-
def self.[](global_name)
|
13
|
-
raise ArgumentError, "'#{global_name}' is not a valid global name" unless global_name.start_with? '$'
|
14
|
-
@@index[global_name] ||= new(global_name)
|
15
|
-
end
|
16
|
-
|
17
|
-
def setup_source
|
18
|
-
"#{source} ||= {}"
|
19
|
-
end
|
20
|
-
|
21
|
-
def source
|
22
|
-
@global_name
|
23
|
-
end
|
24
|
-
|
25
|
-
class << self
|
26
|
-
alias_method :_load, :[]
|
27
|
-
private :_load, :new
|
28
|
-
end
|
29
|
-
|
30
|
-
def inspect
|
31
|
-
%{#<DeepCover::TrackerBucket "#{@global_name}">}
|
32
|
-
end
|
33
|
-
|
34
|
-
def create_storage(index = nil)
|
35
|
-
index ||= @global.size
|
36
|
-
TrackerStorage.new(bucket: self, array: @global[index] ||= [], index: index)
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
def initialize(global_name)
|
42
|
-
@global_name = global_name
|
43
|
-
@global = eval(setup_source) # rubocop:disable Security/Eval
|
44
|
-
end
|
45
|
-
|
46
|
-
def _dump(_level)
|
47
|
-
@global_name
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module DeepCover
|
4
|
-
bootstrap
|
5
|
-
|
6
|
-
# Should be seen as a hash like {path => tracker_hits, ...},
|
7
|
-
# where tracker_hits is simply an array of integers returned from
|
8
|
-
# TrackerStorage#tracker_hits.
|
9
|
-
# Make it easier to separate some concerns, as well as marshalling.
|
10
|
-
#
|
11
|
-
class TrackerHitsPerPath
|
12
|
-
extend Forwardable
|
13
|
-
def_delegators :@index, :each, :each_key, :map, :transform_values, :to_h, :to_hash
|
14
|
-
|
15
|
-
def initialize(index = {})
|
16
|
-
@index = index
|
17
|
-
end
|
18
|
-
|
19
|
-
def [](val)
|
20
|
-
@index[val] ||= []
|
21
|
-
end
|
22
|
-
|
23
|
-
def merge!(tracker_hits_per_path)
|
24
|
-
@index.merge!(tracker_hits_per_path) { |_h, actual, to_merge| merge_tracker_hits(actual, to_merge) }
|
25
|
-
self
|
26
|
-
end
|
27
|
-
|
28
|
-
private def merge_tracker_hits(hits, to_merge)
|
29
|
-
unless hits.size == to_merge.size
|
30
|
-
raise "Attempting to merge trackers of different sizes: #{hits.size} vs #{to_merge.size}"
|
31
|
-
end
|
32
|
-
hits.map!.with_index { |val, i| val + to_merge[i] }
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module DeepCover
|
4
|
-
bootstrap
|
5
|
-
|
6
|
-
# List of allocated trackers from a bucket.
|
7
|
-
# Should be thought of as a simple array of integers with
|
8
|
-
# a limited interface.
|
9
|
-
class TrackerBucket
|
10
|
-
class TrackerStorage
|
11
|
-
extend Forwardable
|
12
|
-
def_delegators :@array, :[], :size, :each, :map, :fetch
|
13
|
-
|
14
|
-
attr_reader :bucket
|
15
|
-
|
16
|
-
def initialize(bucket:, array:, index:)
|
17
|
-
@bucket = bucket
|
18
|
-
@array = array
|
19
|
-
@index = index
|
20
|
-
@allocated = 0
|
21
|
-
end
|
22
|
-
|
23
|
-
# Returns a range of tracker ids
|
24
|
-
def allocate_trackers(nb_needed)
|
25
|
-
prev = @allocated
|
26
|
-
@allocated += nb_needed
|
27
|
-
missing = @allocated - @array.size
|
28
|
-
@array.concat(Array.new(missing, 0)) if missing > 0
|
29
|
-
prev...@allocated
|
30
|
-
end
|
31
|
-
|
32
|
-
def setup_source
|
33
|
-
"(#{bucket.setup_source})[#{@index}]||=Array.new(#{size},0)"
|
34
|
-
end
|
35
|
-
|
36
|
-
def tracker_source(tracker_id)
|
37
|
-
"#{bucket.source}[#{@index}][#{tracker_id}]+=1"
|
38
|
-
end
|
39
|
-
|
40
|
-
def tracker_hits
|
41
|
-
@array.dup.freeze
|
42
|
-
end
|
43
|
-
|
44
|
-
def tracker_hits=(new_hits)
|
45
|
-
if new_hits.size != @array.size
|
46
|
-
warn 'Replacing tracker hits with array of different size'
|
47
|
-
end
|
48
|
-
@array.replace(new_hits)
|
49
|
-
end
|
50
|
-
|
51
|
-
private
|
52
|
-
|
53
|
-
def dump
|
54
|
-
{bucket: @bucket, index: @index, size: @array.size}
|
55
|
-
end
|
56
|
-
|
57
|
-
def _dump(_level)
|
58
|
-
Marshal.dump(dump)
|
59
|
-
end
|
60
|
-
|
61
|
-
class << self
|
62
|
-
private def load(bucket:, index:, size:)
|
63
|
-
storage = bucket.create_storage(index)
|
64
|
-
storage.allocate_trackers(size - storage.size)
|
65
|
-
storage
|
66
|
-
end
|
67
|
-
|
68
|
-
private def _load(data)
|
69
|
-
load(Marshal.load(data)) # rubocop:disable Security/MarshalLoad
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
private_constant :TrackerStorage
|
75
|
-
end
|
76
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module DeepCover
|
4
|
-
bootstrap
|
5
|
-
|
6
|
-
# Should be seen as a hash like {path => tracker_storage, ...}
|
7
|
-
# Make it easier to separate some concerns, as well as marshalling
|
8
|
-
#
|
9
|
-
class TrackerStoragePerPath
|
10
|
-
extend Forwardable
|
11
|
-
def_delegators :@index, :each, :each_key, :map, :transform_values
|
12
|
-
|
13
|
-
attr_reader :bucket
|
14
|
-
|
15
|
-
def initialize(bucket)
|
16
|
-
@bucket = bucket
|
17
|
-
@index = {}
|
18
|
-
end
|
19
|
-
|
20
|
-
def [](path)
|
21
|
-
@index[path] ||= @bucket.create_storage
|
22
|
-
end
|
23
|
-
|
24
|
-
def tracker_hits_per_path
|
25
|
-
TrackerHitsPerPath.new(@index.transform_values(&:tracker_hits))
|
26
|
-
end
|
27
|
-
|
28
|
-
def tracker_hits_per_path=(tracker_hits_per_path)
|
29
|
-
tracker_hits_per_path.each do |path, tracker_hits|
|
30
|
-
self[path].tracker_hits = tracker_hits
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|