deep-cover-core 0.7.1 → 0.7.6

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: 51497f0cad911b1a78dac991b6b89f800c5cc1b0c7b99e8502816d02842ca239
4
- data.tar.gz: 932a187d2d0669c5e21a82f81b1f7337db27d077d4ab07a9b92596721731862e
3
+ metadata.gz: 1bf24929f7466a5ba34eb280c6ea6b65c12a49a8f17faf72dcc52e4ee2df0b07
4
+ data.tar.gz: dee82a216bd81089e76b607d1da044b3adb58ef5f5941c8d74e0fd65b893f6b1
5
5
  SHA512:
6
- metadata.gz: dbdc66591ef576cd5f3ad7dc0898b1746d3b1f3a5670490ea67a49a7773d200ae717029aa40b5b41359b8c67dff889aa118e7a5ef9e02e224f3c2a31cabc8372
7
- data.tar.gz: e52c1575a8b86dd3ea5c908407a8efcbfa1ab3a0618d0b621384d1cb004143dba4e54a0464ac98030a59a8ba62f27119cbae6ef65e8cd51c07546cbd39970ae7
6
+ metadata.gz: f37f3e8c56ce00fdc4e111157f7d0d1bf4ddf7d16c07974e07252d1aea3b46232ffb391a934b68776573a6a96a845324b9e5addb0e8d3cd40c797a961d686d68
7
+ data.tar.gz: 555bcbbfa58c144d2033dc684f8ce07a5f963424538cf236f10f1a04f9d6c92b1d146d1ac963e346ec5fe1e9245cd4a6e2a35c46922000b39b032dc996687b27
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.required_ruby_version = '>= 2.1.0'
25
25
 
26
26
  # Main dependency
27
- spec.add_runtime_dependency 'parser', '~> 2.5.0'
27
+ spec.add_runtime_dependency 'parser', '>= 2.5', '< 2.7'
28
28
 
29
29
  # Support
30
30
  spec.add_runtime_dependency 'backports', '>= 3.11.0'
@@ -38,11 +38,14 @@ Gem::Specification.new do |spec|
38
38
  spec.add_runtime_dependency 'pry'
39
39
 
40
40
  ### Dev dependencies
41
- spec.add_development_dependency 'bundler', '~> 1.15'
42
- spec.add_development_dependency 'rake', '~> 12.0'
41
+ spec.add_development_dependency 'bundler'
42
+ spec.add_development_dependency 'rake'
43
43
  spec.add_development_dependency 'rspec', '~> 3.0'
44
44
 
45
45
  # About every single release breaks something
46
46
  # Ruby 2.1 is no longer supported
47
- spec.add_development_dependency 'rubocop', '0.61.1' if RUBY_VERSION >= '2.2.0'
47
+ if RUBY_VERSION >= '2.3.0'
48
+ spec.add_development_dependency 'rubocop', '~> 0.74.0'
49
+ spec.add_development_dependency 'rubocop-performance'
50
+ end
48
51
  end
@@ -12,8 +12,8 @@ module DeepCover
12
12
  # same as :branch, but also:
13
13
  # if an empty branch is not executed, the line has to be marked as not executed.
14
14
  # This is only for empty branches because, if they are not empty, there will already
15
- # be some red from the partial node covering. We don't everything to become red,
16
- # just want 100% coverage to be as hard as branch + node coverage.
15
+ # be some red from the partial node covering. We don't want everything to become red,
16
+ # simply for 100% coverage to be as hard as branch + node coverage.
17
17
  def results
18
18
  allow_partial = options.fetch(:allow_partial, true)
19
19
  line_hits = Array.new(covered_code.nb_lines + covered_code.lineno - 1)
@@ -23,7 +23,7 @@ module DeepCover
23
23
  end
24
24
 
25
25
  def +(other)
26
- self.class.new(to_h.merge(other.to_h) { |k, a, b| a + b })
26
+ self.class.new(**to_h.merge(other.to_h) { |k, a, b| a + b })
27
27
  end
28
28
 
29
29
  def total
@@ -31,7 +31,7 @@ module DeepCover
31
31
  end
32
32
 
33
33
  def with(**values)
34
- self.class.new(to_h.merge(values))
34
+ self.class.new(**to_h.merge(values))
35
35
  end
36
36
 
37
37
  def potentially_executable
@@ -20,3 +20,4 @@ require 'backports/2.4.0/enumerable/sum'
20
20
  require 'backports/2.5.0/hash/slice'
21
21
  require 'backports/2.5.0/hash/transform_keys'
22
22
  require 'backports/2.5.0/kernel/yield_self'
23
+ require 'backports/2.6.0/hash/to_h'
@@ -116,6 +116,9 @@ module DeepCover
116
116
  #
117
117
  # If no "tracked dirs" exist, fallback to everything in current directory except each of test/ spec/ bin/ exe/.
118
118
  def auto_detected_paths
119
+ # When taking over, just go for everything
120
+ return ['.'] if DeepCover.const_defined?('TAKEOVER_IS_ON') && DeepCover::TAKEOVER_IS_ON
121
+
119
122
  require_relative 'tools/looks_like_rails_project'
120
123
 
121
124
  gemspec_paths = Dir['./*.gemspec'] + Dir['./*/*.gemspec']
@@ -5,6 +5,9 @@ require_relative 'coverage'
5
5
  require_relative 'core_ext/coverage_replacement'
6
6
 
7
7
  require 'coverage'
8
+ raise "Ruby's builtin coverage is already running, cannot do a takeover" if Coverage.respond_to?(:running?) && Coverage.running?
9
+
8
10
  BuiltinCoverage = Coverage
9
11
  Object.send(:remove_const, 'Coverage')
10
12
  Coverage = DeepCover::CoverageReplacement.dup
13
+ DeepCover::TAKEOVER_IS_ON = true
@@ -47,13 +47,13 @@ module DeepCover
47
47
  raise 'coverage measurement is not enabled' unless running?
48
48
  if @started_args == OLD_COVERAGE_SENTINEL
49
49
  DeepCover.coverage.covered_codes.map do |covered_code|
50
- [covered_code.path.to_s, covered_code.line_coverage(allow_partial: false)]
50
+ [covered_code.path.to_s, covered_code.line_coverage(**DeepCover.config.to_h)]
51
51
  end.to_h
52
52
  else
53
53
  DeepCover.coverage.covered_codes.map do |covered_code|
54
54
  cov = {}
55
55
  cov[:branches] = DeepCover::Analyser::Ruby25LikeBranch.new(covered_code).results if @started_args[:branches]
56
- cov[:lines] = covered_code.line_coverage(allow_partial: false) if @started_args[:lines]
56
+ cov[:lines] = covered_code.line_coverage(**DeepCover.config.to_h) if @started_args[:lines]
57
57
  cov[:methods] = {} if @started_args[:methods]
58
58
  [covered_code.path.to_s, cov]
59
59
  end.to_h
@@ -30,4 +30,5 @@ module top_level_module::DeepCover # rubocop:disable Naming/ClassAndModuleCamelC
30
30
  end
31
31
  end
32
32
  ::Kernel.send :private, original_exec_name
33
+ ::Kernel.send :private, :exec
33
34
  end
@@ -56,7 +56,7 @@ module DeepCover
56
56
  self
57
57
  end
58
58
 
59
- # If a file wasn't required, it won't be in the trackers. This adds those mossing files
59
+ # If a file wasn't required, it won't be in the trackers. This adds those missing files
60
60
  def add_missing_covered_codes
61
61
  top_level_path = DeepCover.config.paths.detect do |path|
62
62
  next unless path.is_a?(String)
@@ -77,9 +77,16 @@ module DeepCover
77
77
  return
78
78
  end
79
79
 
80
+ skipped = []
80
81
  DeepCover.all_tracked_file_paths.each do |path|
81
- covered_code(path, tracker_hits: :zeroes)
82
+ begin
83
+ covered_code(path, tracker_hits: :zeroes)
84
+ rescue Parser::SyntaxError
85
+ skipped << path
86
+ end
82
87
  end
88
+ warn "The following files could not be parsed:\n" + skipped.join("\n") unless skipped.empty?
89
+
83
90
  nil
84
91
  end
85
92
 
@@ -46,7 +46,7 @@ module DeepCover
46
46
  next unless File.exist?(path_with_ext)
47
47
 
48
48
  # https://github.com/jruby/jruby/issues/5465
49
- path_with_ext = File.realpath(path_with_ext) if RUBY_PLATFORM == 'java' && JRUBY_VERSION >= '9.2.5'
49
+ path_with_ext = File.realpath(path_with_ext) if RUBY_PLATFORM == 'java' && Gem::Version.new(JRUBY_VERSION) >= Gem::Version.new('9.2.5')
50
50
  return path_with_ext
51
51
  end
52
52
  else
@@ -11,8 +11,8 @@ module DeepCover
11
11
  # @param [Array(Parser::Source::Comment)] comments
12
12
  def initialize(covered_code, lookup = 'nocov')
13
13
  @covered_code = covered_code
14
- @lookup = /^#[\s#*-]*#{lookup}[\s#*-]*$/
15
- @ranges = nil
14
+ @lookup = /^#[\s#*-]*#{lookup}[\s#*-]*$/
15
+ @ranges = nil
16
16
  end
17
17
 
18
18
  def include?(range)
@@ -49,10 +49,9 @@ module DeepCover
49
49
 
50
50
  # {per_char: Stat, ...} => {per_char: {ignored: ...}, per_char_percent: 55.55, ...}
51
51
  def transform_data(data)
52
- Tools.merge(
53
- data.transform_values(&:to_h),
54
- *data.map { |type, stat| {:"#{type}_percent" => stat.percent_covered} }
55
- )
52
+ numbers = data.transform_values(&:to_h)
53
+ percent = data.to_h { |type, stat| [:"#{type}_percent", stat.percent_covered] }
54
+ numbers.merge(percent)
56
55
  end
57
56
  end
58
57
  end
@@ -167,7 +167,7 @@ module DeepCover
167
167
  msg = "\nHTML coverage written to: '#{output}/index.html'"
168
168
  end
169
169
  end
170
- `cd #{dir} && #{Istanbul.bin_path} report --reporter=text #{html}` + msg.to_s
170
+ `cd #{dir} && #{Istanbul.bin_path} report --exclude-after-remap=false --reporter=text #{html}` + msg.to_s
171
171
  end
172
172
 
173
173
  class << self
@@ -4,7 +4,7 @@ module DeepCover
4
4
  module Tools::StripHeredoc
5
5
  # In-place implementation copied from active-support.
6
6
  IMPLEMENTATION = -> do
7
- gsub(/^#{scan(/^[ \t]*(?=\S)/).min}/, ''.freeze).tap do |stripped|
7
+ gsub(/^#{scan(/^[ \t]*(?=\S)/).min}/, '').tap do |stripped|
8
8
  stripped.freeze if frozen?
9
9
  end
10
10
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeepCover
4
+ module Tools
5
+ module WithUnbundledEnv
6
+ extend self
7
+ # Bundler is changing from with_clean_env to with_unbundled_env in 2.0
8
+ def with_unbundled_env
9
+ if Bundler.respond_to?(:with_unbundled_env)
10
+ Bundler.with_unbundled_env { yield }
11
+ else
12
+ Bundler.with_clean_env { yield }
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -3,5 +3,5 @@
3
3
  top_level_module = Thread.current['_deep_cover_top_level_module'] || Object
4
4
 
5
5
  module top_level_module::DeepCover # rubocop:disable Naming/ClassAndModuleCamelCase
6
- VERSION = '0.7.1'
6
+ VERSION = '0.7.6'
7
7
  end
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.1
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc-André Lafortune
@@ -9,22 +9,28 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-12-25 00:00:00.000000000 Z
12
+ date: 2019-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: parser
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '2.5'
21
+ - - "<"
19
22
  - !ruby/object:Gem::Version
20
- version: 2.5.0
23
+ version: '2.7'
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
- - - "~>"
28
+ - - ">="
26
29
  - !ruby/object:Gem::Version
27
- version: 2.5.0
30
+ version: '2.5'
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.7'
28
34
  - !ruby/object:Gem::Dependency
29
35
  name: backports
30
36
  requirement: !ruby/object:Gem::Requirement
@@ -99,30 +105,30 @@ dependencies:
99
105
  name: bundler
100
106
  requirement: !ruby/object:Gem::Requirement
101
107
  requirements:
102
- - - "~>"
108
+ - - ">="
103
109
  - !ruby/object:Gem::Version
104
- version: '1.15'
110
+ version: '0'
105
111
  type: :development
106
112
  prerelease: false
107
113
  version_requirements: !ruby/object:Gem::Requirement
108
114
  requirements:
109
- - - "~>"
115
+ - - ">="
110
116
  - !ruby/object:Gem::Version
111
- version: '1.15'
117
+ version: '0'
112
118
  - !ruby/object:Gem::Dependency
113
119
  name: rake
114
120
  requirement: !ruby/object:Gem::Requirement
115
121
  requirements:
116
- - - "~>"
122
+ - - ">="
117
123
  - !ruby/object:Gem::Version
118
- version: '12.0'
124
+ version: '0'
119
125
  type: :development
120
126
  prerelease: false
121
127
  version_requirements: !ruby/object:Gem::Requirement
122
128
  requirements:
123
- - - "~>"
129
+ - - ">="
124
130
  - !ruby/object:Gem::Version
125
- version: '12.0'
131
+ version: '0'
126
132
  - !ruby/object:Gem::Dependency
127
133
  name: rspec
128
134
  requirement: !ruby/object:Gem::Requirement
@@ -141,16 +147,30 @@ dependencies:
141
147
  name: rubocop
142
148
  requirement: !ruby/object:Gem::Requirement
143
149
  requirements:
144
- - - '='
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.74.0
153
+ type: :development
154
+ prerelease: false
155
+ version_requirements: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 0.74.0
160
+ - !ruby/object:Gem::Dependency
161
+ name: rubocop-performance
162
+ requirement: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
145
165
  - !ruby/object:Gem::Version
146
- version: 0.61.1
166
+ version: '0'
147
167
  type: :development
148
168
  prerelease: false
149
169
  version_requirements: !ruby/object:Gem::Requirement
150
170
  requirements:
151
- - - '='
171
+ - - ">="
152
172
  - !ruby/object:Gem::Version
153
- version: 0.61.1
173
+ version: '0'
154
174
  description: Core functionality for the DeepCover gem.
155
175
  email:
156
176
  - github@marc-andre.ca
@@ -290,6 +310,7 @@ files:
290
310
  - lib/deep_cover/tools/slice.rb
291
311
  - lib/deep_cover/tools/strip_heredoc.rb
292
312
  - lib/deep_cover/tools/truncate_backtrace.rb
313
+ - lib/deep_cover/tools/with_unbundled_env.rb
293
314
  - lib/deep_cover/version.rb
294
315
  homepage: https://github.com/deep-cover/deep-cover
295
316
  licenses:
@@ -311,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
311
332
  version: '0'
312
333
  requirements: []
313
334
  rubyforge_project:
314
- rubygems_version: 2.7.6
335
+ rubygems_version: 2.7.7
315
336
  signing_key:
316
337
  specification_version: 4
317
338
  summary: In depth coverage of your Ruby code.