mutant 0.9.2 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +26 -0
  3. data/Gemfile +0 -8
  4. data/Gemfile.lock +55 -59
  5. data/LICENSE +1 -1
  6. data/README.md +9 -0
  7. data/config/rubocop.yml +10 -3
  8. data/docs/commercial-support.md +14 -0
  9. data/lib/mutant.rb +5 -4
  10. data/lib/mutant/cli.rb +5 -5
  11. data/lib/mutant/config.rb +1 -0
  12. data/lib/mutant/integration.rb +1 -1
  13. data/lib/mutant/license.rb +33 -6
  14. data/lib/mutant/license/subscription/opensource.rb +1 -1
  15. data/lib/mutant/meta.rb +1 -3
  16. data/lib/mutant/meta/example/verification.rb +1 -1
  17. data/lib/mutant/mutator/node/generic.rb +25 -2
  18. data/lib/mutant/mutator/node/send.rb +1 -1
  19. data/lib/mutant/parallel.rb +1 -1
  20. data/lib/mutant/reporter/cli/format.rb +1 -1
  21. data/lib/mutant/transform.rb +6 -5
  22. data/lib/mutant/version.rb +1 -1
  23. data/lib/mutant/warnings.rb +1 -1
  24. data/lib/mutant/zombifier.rb +2 -0
  25. data/mutant.gemspec +17 -16
  26. data/spec/integrations.yml +3 -1
  27. data/spec/support/corpus.rb +3 -3
  28. data/spec/support/ruby_vm.rb +1 -2
  29. data/spec/support/shared_context.rb +3 -3
  30. data/spec/support/xspec.rb +2 -2
  31. data/spec/unit/mutant/license_spec.rb +43 -7
  32. data/spec/unit/mutant/parallel/driver_spec.rb +4 -4
  33. data/spec/unit/mutant/parallel/worker_spec.rb +5 -5
  34. data/spec/unit/mutant/parallel_spec.rb +7 -7
  35. data/spec/unit/mutant/repository/diff/ranges_spec.rb +2 -2
  36. metadata +31 -24
  37. data/lib/mutant/base.rb +0 -192
  38. data/lib/mutant/variable.rb +0 -282
  39. data/spec/unit/mutant/either_spec.rb +0 -247
  40. data/spec/unit/mutant/maybe_spec.rb +0 -60
  41. data/spec/unit/mutant/variable_spec.rb +0 -618
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b6a747b9980b4450831809ea2a799652f93dbd5be93ffe2a9ad25df314dddff
4
- data.tar.gz: 2b72a0f6af97d24ab2191665e9be7d5975394348cc2b077d2f5efcb27fb38a89
3
+ metadata.gz: 9191d87ebe0bde331ae432c838ec2718f41f89d099952598e98fe6d2ee3b9885
4
+ data.tar.gz: 713134773a289c22d6b43b678c44b483f383aeb2520fd0f95711c47489ad64f0
5
5
  SHA512:
6
- metadata.gz: f104307508a7c296b1b69f245394d0eef7f1991669a35b603aa8e4c21f5d9c205f509de519ae314e450c9cd57a879807d9b1778d84c822902fdafe9c68f8731a
7
- data.tar.gz: a57dd99f21bfc48fa3a40f2fae04c8005f32c5615bc4509d30fafbc6f047c29a27b3eafa5f1de6329b9cb1b822a5fa72ee8ff8c8957b4bb45727204daa4ff56f
6
+ metadata.gz: 00b83021df08f58b84688d6dad27792e0d5aab81288bf5f7afca9a43b2ebdf05fe09133c18dc19e8169727c20e4815caaafabfab9bbc9c7258100b9201ba967a
7
+ data.tar.gz: 79659afba997fc24650398f33bc0de60905845429b01a49d999c24e2004f97b0c0ac3bee987e1cbf73010c213906e79a0e8fb856b5de826049cfc169f8154f24
@@ -1,3 +1,29 @@
1
+ # v0.9.7 2020-07-22
2
+
3
+ * Bump parser dependency to 2.7.1, note this still does not support Ruby 2.7 syntax.
4
+ But it supports running bundling with that parser version.
5
+ * Nail diff-lcs to 1.3 till output difference for 1.4 can be addressed.
6
+
7
+ # v0.9.6 2020-04-20
8
+
9
+ * Dependencies upgrade, should not change user facing semantics.
10
+ * Bump license nudge to 40s
11
+
12
+ # v0.9.5 2020-02-02
13
+
14
+ * Change to 2.7 parser series.
15
+ This does not drop support for < 2.7 but enables to in the future add full Ruby 2.7 support.
16
+
17
+ # v0.9.4 2020-01-03
18
+
19
+ * Bump unparser dependency
20
+
21
+ # v0.9.3 2020-01-03
22
+
23
+ * Change to soft dependency on mutant-license.
24
+ Rationale its fine to bundle mutant if not used.
25
+ This can easily happen on transitive dependencies.
26
+
1
27
  # v0.9.2 2020-01-02
2
28
 
3
29
  * Upgrade to parser ~> 2.6.5
data/Gemfile CHANGED
@@ -6,14 +6,6 @@ gemspec name: 'mutant'
6
6
 
7
7
  eval_gemfile File.expand_path('Gemfile.shared', __dir__)
8
8
 
9
- gem 'unparser', git: 'https://github.com/mbj/unparser.git'
10
-
11
- gem(
12
- 'devtools',
13
- git: 'https://github.com/mbj/devtools.git',
14
- ref: '26ba0a1053e6cf7b79fc72d513a73457f9a38ead'
15
- )
16
-
17
9
  # Mutant itself uses an opensource license key.
18
10
  # Scoped to https://github.com/mbj/mutant it'll
19
11
  # not be useful elsewhere.
@@ -1,56 +1,21 @@
1
- GIT
2
- remote: https://github.com/mbj/devtools.git
3
- revision: 26ba0a1053e6cf7b79fc72d513a73457f9a38ead
4
- ref: 26ba0a1053e6cf7b79fc72d513a73457f9a38ead
5
- specs:
6
- devtools (0.1.23)
7
- abstract_type (~> 0.0.7)
8
- adamantium (~> 0.2.0)
9
- anima (~> 0.3.0)
10
- concord (~> 0.1.5)
11
- flay (~> 2.12.0)
12
- flog (~> 4.6.2)
13
- procto (~> 0.0.3)
14
- rake (~> 12.3.0)
15
- reek (~> 5.3.0)
16
- rspec (~> 3.8.0)
17
- rspec-core (~> 3.8.0)
18
- rspec-its (~> 1.2.0)
19
- rubocop (~> 0.61.1)
20
- simplecov (~> 0.16.1)
21
- yard (~> 0.9.16)
22
- yardstick (~> 0.9.9)
23
-
24
- GIT
25
- remote: https://github.com/mbj/unparser.git
26
- revision: 157a5b3b43e9f1d540da74b1751dc2b6f7601c3b
27
- specs:
28
- unparser (0.4.6)
29
- abstract_type (~> 0.0.7)
30
- adamantium (~> 0.2.0)
31
- concord (~> 0.1.5)
32
- diff-lcs (~> 1.3)
33
- equalizer (~> 0.0.9)
34
- parser (~> 2.6.5)
35
- procto (~> 0.0.2)
36
-
37
1
  PATH
38
2
  remote: .
39
3
  specs:
40
- mutant (0.9.1)
4
+ mutant (0.9.6)
41
5
  abstract_type (~> 0.0.7)
42
6
  adamantium (~> 0.2.0)
43
7
  anima (~> 0.3.1)
44
8
  ast (~> 2.2)
45
9
  concord (~> 0.1.5)
46
- diff-lcs (~> 1.3)
10
+ diff-lcs (= 1.3)
47
11
  equalizer (~> 0.0.9)
48
12
  ice_nine (~> 0.11.1)
49
13
  memoizable (~> 0.4.2)
50
- mutant-license (~> 0.1.0)
51
- parser (~> 2.6.5)
14
+ mprelude (~> 0.1.0)
15
+ parser (~> 2.7.1)
52
16
  procto (~> 0.0.2)
53
- unparser (~> 0.4.5)
17
+ unparser (~> 0.4.6)
18
+ variable (~> 0.0.1)
54
19
 
55
20
  GEM
56
21
  remote: https://rubygems.org/
@@ -64,7 +29,7 @@ GEM
64
29
  abstract_type (~> 0.0.7)
65
30
  adamantium (~> 0.2)
66
31
  equalizer (~> 0.0.11)
67
- ast (2.4.0)
32
+ ast (2.4.1)
68
33
  axiom-types (0.1.1)
69
34
  descendants_tracker (~> 0.0.4)
70
35
  ice_nine (~> 0.11.0)
@@ -78,6 +43,23 @@ GEM
78
43
  equalizer (~> 0.0.9)
79
44
  descendants_tracker (0.0.4)
80
45
  thread_safe (~> 0.3, >= 0.3.1)
46
+ devtools (0.1.26)
47
+ abstract_type (~> 0.0.7)
48
+ adamantium (~> 0.2.0)
49
+ anima (~> 0.3.0)
50
+ concord (~> 0.1.5)
51
+ flay (~> 2.12.0)
52
+ flog (~> 4.6.2)
53
+ procto (~> 0.0.3)
54
+ rake (~> 12.3.0)
55
+ reek (~> 5.6.0)
56
+ rspec (~> 3.8.0)
57
+ rspec-core (~> 3.8.0)
58
+ rspec-its (~> 1.2.0)
59
+ rubocop (~> 0.79.0)
60
+ simplecov (~> 0.16.1)
61
+ yard (~> 0.9.16)
62
+ yardstick (~> 0.9.9)
81
63
  diff-lcs (1.3)
82
64
  docile (1.3.2)
83
65
  equalizer (0.0.11)
@@ -93,24 +75,30 @@ GEM
93
75
  sexp_processor (~> 4.8)
94
76
  ice_nine (0.11.2)
95
77
  jaro_winkler (1.5.4)
96
- json (2.3.0)
78
+ json (2.3.1)
97
79
  kwalify (0.7.2)
98
80
  memoizable (0.4.2)
99
81
  thread_safe (~> 0.3, >= 0.3.1)
82
+ mprelude (0.1.0)
83
+ abstract_type (~> 0.0.7)
84
+ adamantium (~> 0.2.0)
85
+ concord (~> 0.1.5)
86
+ equalizer (~> 0.0.9)
87
+ ice_nine (~> 0.11.1)
88
+ procto (~> 0.0.2)
100
89
  mutant-license (0.1.0)
101
- parallel (1.19.1)
102
- parser (2.6.5.0)
103
- ast (~> 2.4.0)
90
+ parallel (1.19.2)
91
+ parser (2.7.1.4)
92
+ ast (~> 2.4.1)
104
93
  path_expander (1.1.0)
105
- powerpack (0.1.2)
106
94
  procto (0.0.3)
107
95
  psych (3.1.0)
108
96
  rainbow (3.0.0)
109
97
  rake (12.3.3)
110
- reek (5.3.2)
98
+ reek (5.6.0)
111
99
  codeclimate-engine-rb (~> 0.4.0)
112
100
  kwalify (~> 0.7.0)
113
- parser (>= 2.5.0.0, < 2.7, != 2.5.1.1)
101
+ parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
114
102
  psych (~> 3.1.0)
115
103
  rainbow (>= 2.0, < 4.0)
116
104
  rspec (3.8.0)
@@ -129,31 +117,40 @@ GEM
129
117
  diff-lcs (>= 1.2.0, < 2.0)
130
118
  rspec-support (~> 3.8.0)
131
119
  rspec-support (3.8.3)
132
- rubocop (0.61.1)
120
+ rubocop (0.79.0)
133
121
  jaro_winkler (~> 1.5.1)
134
122
  parallel (~> 1.10)
135
- parser (>= 2.5, != 2.5.1.1)
136
- powerpack (~> 0.1)
123
+ parser (>= 2.7.0.1)
137
124
  rainbow (>= 2.2.2, < 4.0)
138
125
  ruby-progressbar (~> 1.7)
139
- unicode-display_width (~> 1.4.0)
126
+ unicode-display_width (>= 1.4.0, < 1.7)
140
127
  ruby-progressbar (1.10.1)
141
- ruby_parser (3.14.1)
128
+ ruby_parser (3.14.2)
142
129
  sexp_processor (~> 4.9)
143
- sexp_processor (4.13.0)
130
+ sexp_processor (4.15.0)
144
131
  simplecov (0.16.1)
145
132
  docile (~> 1.1)
146
133
  json (>= 1.8, < 3)
147
134
  simplecov-html (~> 0.10.0)
148
135
  simplecov-html (0.10.2)
149
136
  thread_safe (0.3.6)
150
- unicode-display_width (1.4.1)
137
+ unicode-display_width (1.6.1)
138
+ unparser (0.4.7)
139
+ abstract_type (~> 0.0.7)
140
+ adamantium (~> 0.2.0)
141
+ concord (~> 0.1.5)
142
+ diff-lcs (~> 1.3)
143
+ equalizer (~> 0.0.9)
144
+ parser (>= 2.6.5)
145
+ procto (~> 0.0.2)
146
+ variable (0.0.1)
147
+ equalizer (~> 0.0.11)
151
148
  virtus (1.0.5)
152
149
  axiom-types (~> 0.1)
153
150
  coercible (~> 1.0)
154
151
  descendants_tracker (~> 0.0, >= 0.0.3)
155
152
  equalizer (~> 0.0, >= 0.0.9)
156
- yard (0.9.22)
153
+ yard (0.9.25)
157
154
  yardstick (0.9.9)
158
155
  yard (~> 0.8, >= 0.8.7.2)
159
156
 
@@ -161,11 +158,10 @@ PLATFORMS
161
158
  ruby
162
159
 
163
160
  DEPENDENCIES
164
- devtools!
161
+ devtools (~> 0.1.25)
165
162
  mutant!
166
163
  mutant-license!
167
164
  parallel (~> 1.3)
168
- unparser!
169
165
 
170
166
  BUNDLED WITH
171
167
  1.17.3
data/LICENSE CHANGED
@@ -116,7 +116,7 @@ the net income of Schirp DSO LTD).
116
116
 
117
117
  6. Support, Maintenance and Services. Subject to the terms and conditions of
118
118
  this Agreement, as set forth in your invoice, and as set forth on the Mutant
119
- support page (https://github.com/mbj/mutant/wiki/Commercial-Support),
119
+ support page (https://github.com/mbj/mutant/blob/master/docs/commercial-support.md)
120
120
  support and maintenance services may be included with the purchase of your
121
121
  license subscription.
122
122
 
data/README.md CHANGED
@@ -29,6 +29,15 @@ On each detection of uncovered semantics you have the opportunity to:
29
29
  to test only the code you had been touching. See the [incremental](#only-mutating-changed-code)
30
30
  mutation testing documentation.
31
31
 
32
+ ## Ruby Versions
33
+
34
+ Mutant currently only works on cRuby/MRI. Starting with version 2.5.x. It supports all syntax features upto and
35
+ including Ruby 2.6.
36
+
37
+ Support for 2.7 syntax features is pending, see unparser issue: https://github.com/mbj/unparser/issues/129.
38
+
39
+ Mutant will work under Ruby 2.7 just fine, unless a 2.7 syntax feature is used. This will be resolved shortly.
40
+
32
41
  ## Licensing
33
42
 
34
43
  Mutant was recently transitioned commercial software, with a free usage plan for opensource projects.
@@ -99,7 +99,7 @@ ClassCheck:
99
99
  EnforcedStyle: kind_of?
100
100
 
101
101
  # Do not prefer double quotes to be used when %q or %Q is more appropriate
102
- UnneededPercentQ:
102
+ Style/RedundantPercentQ:
103
103
  Enabled: false
104
104
 
105
105
  # Allow a maximum ABC score
@@ -145,7 +145,7 @@ Alias:
145
145
  EnforcedStyle: prefer_alias_method
146
146
 
147
147
  # Do not waste my horizontal or vertical space
148
- IndentArray:
148
+ Layout/FirstArrayElementIndentation:
149
149
  Enabled: false
150
150
 
151
151
  # Prefer
@@ -167,7 +167,7 @@ MultilineMethodCallIndentation:
167
167
  Send:
168
168
  Enabled: true
169
169
 
170
- Layout/AlignHash:
170
+ Layout/HashAlignment:
171
171
  EnforcedColonStyle: table
172
172
  EnforcedHashRocketStyle: table
173
173
  Layout/EmptyLineAfterGuardClause:
@@ -196,3 +196,10 @@ Style/RescueStandardError:
196
196
  Enabled: false
197
197
  Style/StderrPuts:
198
198
  Enabled: false
199
+ # suggesting single letter variablesl bah
200
+ Naming/RescuedExceptionsVariableName:
201
+ Enabled: false
202
+ # false positive on private keywords
203
+ Layout/IndentationWidth:
204
+ Enabled: false
205
+
@@ -0,0 +1,14 @@
1
+ # Commercial Support
2
+
3
+ Mutant offers only community support.
4
+
5
+ Commercial license customers are entited to priority support via email.
6
+
7
+ ## Priority Support
8
+
9
+ Covers 1 incident per quarter, with a max response time of 7 days.
10
+ Scope is limited to mutant not the application or infrastructure.
11
+
12
+ For support email [Markus Schirp](mailto:mbj@schirp-dso.com?subject=Mutant%20Support).
13
+ Please email using the same domain as the roiginal license email or explain
14
+ your connection to the license.
@@ -10,6 +10,7 @@ require 'digest/sha1'
10
10
  require 'equalizer'
11
11
  require 'etc'
12
12
  require 'ice_nine'
13
+ require 'mprelude'
13
14
  require 'json'
14
15
  require 'open3'
15
16
  require 'optparse'
@@ -20,10 +21,9 @@ require 'set'
20
21
  require 'singleton'
21
22
  require 'stringio'
22
23
  require 'unparser'
24
+ require 'variable'
23
25
  require 'yaml'
24
26
 
25
- gem 'mutant-license'
26
-
27
27
  # This setting is done to make errors within the parallel
28
28
  # reporter / execution visible in the main thread.
29
29
  Thread.abort_on_exception = true
@@ -32,13 +32,14 @@ Thread.abort_on_exception = true
32
32
  #
33
33
  # @api private
34
34
  module Mutant
35
+ Either = MPrelude::Either
36
+
35
37
  EMPTY_STRING = ''
36
38
  EMPTY_ARRAY = [].freeze
37
39
  EMPTY_HASH = {}.freeze
38
40
  SCOPE_OPERATOR = '::'
39
41
  end # Mutant
40
42
 
41
- require 'mutant/base'
42
43
  require 'mutant/bootstrap'
43
44
  require 'mutant/version'
44
45
  require 'mutant/env'
@@ -185,7 +186,6 @@ require 'mutant/reporter/cli/format'
185
186
  require 'mutant/repository'
186
187
  require 'mutant/repository/diff'
187
188
  require 'mutant/repository/diff/ranges'
188
- require 'mutant/variable'
189
189
  require 'mutant/warnings'
190
190
  require 'mutant/zombifier'
191
191
  require 'mutant/range'
@@ -198,6 +198,7 @@ module Mutant
198
198
  WORLD = World.new(
199
199
  condition_variable: ConditionVariable,
200
200
  gem: Gem,
201
+ gem_method: method(:gem),
201
202
  io: IO,
202
203
  json: JSON,
203
204
  kernel: Kernel,
@@ -36,10 +36,10 @@ module Mutant
36
36
  def self.run(world, default_config, arguments)
37
37
  License
38
38
  .apply(world)
39
- .apply { Config.load_config_file(world, default_config) }
40
- .apply { |file_config| apply(world, file_config, arguments) }
41
- .apply { |cli_config| Bootstrap.apply(world, cli_config) }
42
- .apply(&Runner.method(:apply))
39
+ .bind { Config.load_config_file(world, default_config) }
40
+ .bind { |file_config| apply(world, file_config, arguments) }
41
+ .bind { |cli_config| Bootstrap.apply(world, cli_config) }
42
+ .bind(&Runner.method(:apply))
43
43
  .from_right { |error| world.stderr.puts(error); return false }
44
44
  .success?
45
45
  end
@@ -105,7 +105,7 @@ module Mutant
105
105
  #
106
106
  # @return [undefined]
107
107
  #
108
- # rubocop:disable MethodLength
108
+ # rubocop:disable Metrics/MethodLength
109
109
  def add_environment_options(opts)
110
110
  opts.separator('Environment:')
111
111
  opts.on('--zombie', 'Run mutant zombified') do
@@ -6,6 +6,7 @@ module Mutant
6
6
  include Adamantium::Flat, Anima.new(
7
7
  :condition_variable,
8
8
  :gem,
9
+ :gem_method,
9
10
  :io,
10
11
  :json,
11
12
  :kernel,
@@ -28,7 +28,7 @@ module Mutant
28
28
  # @return [Either<String, Integration>]
29
29
  def self.setup(env)
30
30
  attempt_require(env)
31
- .apply { attempt_const_get(env) }
31
+ .bind { attempt_const_get(env) }
32
32
  .fmap { |klass| klass.new(env.config).setup }
33
33
  end
34
34
 
@@ -2,31 +2,58 @@
2
2
 
3
3
  module Mutant
4
4
  module License
5
+ NAME = 'mutant-license'
6
+ VERSION = '~> 0.1.0'
7
+ SLEEP = 40
8
+
9
+ UNLICENSED =
10
+ IceNine.deep_freeze(
11
+ [
12
+ "Soft fail, continuing in #{SLEEP} seconds",
13
+ 'Next major version will enforce the license',
14
+ 'See https://github.com/mbj/mutant#licensing'
15
+ ]
16
+ )
17
+
5
18
  def self.apply(world)
6
19
  soft_fail(world, license_result(world))
7
20
  end
8
21
 
9
22
  def self.license_result(world)
10
- Subscription.from_json(world.json.load(license_path(world))).apply(world)
23
+ load_mutant_license(world)
24
+ .fmap { license_path(world) }
25
+ .fmap { |path| Subscription.from_json(world.json.load(path)) }
26
+ .bind { |sub| sub.apply(world) }
11
27
  end
12
28
  private_class_method :license_result
13
29
 
14
- def self.soft_fail(world, license_result)
15
- license_result.lmap do |message|
30
+ # ignore :reek:NestedIterators
31
+ def self.soft_fail(world, result)
32
+ result.lmap do |message|
16
33
  stderr = world.stderr
17
34
  stderr.puts(message)
18
- stderr.puts('Soft fail, continuing in 10 seconds')
19
- world.kernel.sleep(10)
35
+ UNLICENSED.each { |line| stderr.puts(unlicensed(line)) }
36
+ world.kernel.sleep(SLEEP)
20
37
  end
21
38
 
22
39
  Either::Right.new(true)
23
40
  end
24
41
  private_class_method :soft_fail
25
42
 
43
+ def self.load_mutant_license(world)
44
+ Either
45
+ .wrap_error(LoadError) { world.gem_method.call(NAME, VERSION) }
46
+ .lmap(&method(:unlicensed))
47
+ end
48
+
49
+ def self.unlicensed(message)
50
+ "[Mutant-License-Error]: #{message}"
51
+ end
52
+
26
53
  def self.license_path(world)
27
54
  world
28
55
  .pathname
29
- .new(world.gem.loaded_specs.fetch('mutant-license').full_gem_path)
56
+ .new(world.gem.loaded_specs.fetch(NAME).full_gem_path)
30
57
  .join('license.json')
31
58
  end
32
59
  private_class_method :license_path