mutant 0.10.12 → 0.10.13

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: 4c573735f4e77ea0dd9313412e82bbca47771e8fd379c5d53393e855248b7792
4
- data.tar.gz: 7c59c273789c9fb3d85dd858a7ed7d6bec85b8440ad05736f70541325d214947
3
+ metadata.gz: 561ad5a2483b3678f3bbcd3ab1ddbef3259f589548b59f3f42e993b76e50e120
4
+ data.tar.gz: dd3b79cbeb3bca13e502b9c43cbb59d2d3656e0f37905d5cbb33ac1e1ac98fb1
5
5
  SHA512:
6
- metadata.gz: ff3a349908f6f3f83ace0ce4de9555b981f6a82515954e635a7539b2d8852d9bfa740a2c33afd2b3b49a34e0358920be9d0c22b8c05c2903356d75b9c4a4ccc6
7
- data.tar.gz: 2b3cc3f947b50bc407c8c5a3239ad5bbddf2ff2adc773e661f8279d650297accaad05cdcdbce5e64ae04e419dd63740e0de493542f44464bb5d7d7ee60ab37c1
6
+ metadata.gz: 8d314dfd39fba6e6becf5d3410df2b6c95f94a5861df6446cb804b058edcad4d8b4a6ed98a6a21f4cfed3af48a450a17a3579b9b39e6814a60c4f10d746f77f9
7
+ data.tar.gz: 1ef113b288fca26803593efe136e2c8e49002eb6f33722373eaacf0276078ac6ac4624139c10636498cf2e9c5eec8c64512b08796833380f457e5f1497bcab61
@@ -226,7 +226,7 @@ module Mutant
226
226
  # Reopen class to initialize constant to avoid dep circle
227
227
  class Config
228
228
  DEFAULT = new(
229
- coverage_criteria: Config::CoverageCriteria::DEFAULT,
229
+ coverage_criteria: Config::CoverageCriteria::EMPTY,
230
230
  expression_parser: Expression::Parser.new([
231
231
  Expression::Method,
232
232
  Expression::Methods,
@@ -29,7 +29,7 @@ module Mutant
29
29
  end
30
30
 
31
31
  def expand(file_config)
32
- @config = Config.env.merge(file_config).merge(@config)
32
+ @config = Config.env.merge(file_config).merge(@config).expand_defaults
33
33
  end
34
34
 
35
35
  def parse_remaining_arguments(arguments)
@@ -40,6 +40,12 @@ module Mutant
40
40
  class CoverageCriteria
41
41
  include Anima.new(:process_abort, :test_result, :timeout)
42
42
 
43
+ EMPTY = new(
44
+ process_abort: nil,
45
+ test_result: nil,
46
+ timeout: nil
47
+ )
48
+
43
49
  DEFAULT = new(
44
50
  process_abort: false,
45
51
  test_result: true,
@@ -61,6 +67,22 @@ module Mutant
61
67
  ->(value) { Either::Right.new(DEFAULT.with(**value)) }
62
68
  ]
63
69
  )
70
+
71
+ def merge(other)
72
+ self.class.new(
73
+ process_abort: overwrite(other, :process_abort),
74
+ test_result: overwrite(other, :test_result),
75
+ timeout: overwrite(other, :timeout)
76
+ )
77
+ end
78
+
79
+ private
80
+
81
+ def overwrite(other, attribute_name)
82
+ other_value = other.public_send(attribute_name)
83
+
84
+ other_value.nil? ? public_send(attribute_name) : other_value
85
+ end
64
86
  end # CoverageCriteria
65
87
 
66
88
  # Merge with other config
@@ -68,18 +90,24 @@ module Mutant
68
90
  # @param [Config] other
69
91
  #
70
92
  # @return [Config]
93
+ #
94
+ # rubocop:disable Metrics/AbcSize
95
+ # rubocop:disable Metrics/MethodLength
71
96
  def merge(other)
72
97
  other.with(
73
- fail_fast: fail_fast || other.fail_fast,
74
- includes: includes + other.includes,
75
- jobs: other.jobs || jobs,
76
- integration: other.integration || integration,
77
- mutation_timeout: other.mutation_timeout || mutation_timeout,
78
- matcher: matcher.merge(other.matcher),
79
- requires: requires + other.requires,
80
- zombie: zombie || other.zombie
98
+ coverage_criteria: coverage_criteria.merge(other.coverage_criteria),
99
+ fail_fast: fail_fast || other.fail_fast,
100
+ includes: includes + other.includes,
101
+ jobs: other.jobs || jobs,
102
+ integration: other.integration || integration,
103
+ mutation_timeout: other.mutation_timeout || mutation_timeout,
104
+ matcher: matcher.merge(other.matcher),
105
+ requires: requires + other.requires,
106
+ zombie: zombie || other.zombie
81
107
  )
82
108
  end
109
+ # rubocop:enable Metrics/AbcSize
110
+ # rubocop:enable Metrics/MethodLength
83
111
 
84
112
  # Load config file
85
113
  #
@@ -100,6 +128,16 @@ module Mutant
100
128
  end
101
129
  end
102
130
 
131
+ # Expand config with defaults
132
+ #
133
+ # @return [Config]
134
+ def expand_defaults
135
+ with(
136
+ coverage_criteria: CoverageCriteria::DEFAULT.merge(coverage_criteria),
137
+ jobs: jobs || 1
138
+ )
139
+ end
140
+
103
141
  def self.load_contents(path)
104
142
  Transform::Named
105
143
  .new(path.to_s, TRANSFORM)
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Mutant
4
4
  # Current mutant version
5
- VERSION = '0.10.12'
5
+ VERSION = '0.10.13'
6
6
  end # Mutant
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.12
4
+ version: 0.10.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp