mutant 0.10.14 → 0.10.15
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 +4 -4
- data/bin/mutant +5 -3
- data/lib/mutant.rb +13 -0
- data/lib/mutant/cli/command.rb +12 -0
- data/lib/mutant/cli/command/environment.rb +1 -11
- data/lib/mutant/cli/command/environment/run.rb +10 -3
- data/lib/mutant/cli/command/environment/show.rb +2 -5
- data/lib/mutant/repository/diff.rb +35 -19
- data/lib/mutant/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbc0ad994f56a3ad82ac1c775f483e698d901344fc53d9ec09d0e921d9a241fb
|
4
|
+
data.tar.gz: fd281190d497ed1c6d3231d170d44d3ec6ccf620cfed3d6f2f215b65d646d9a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9170426e14e26e3fb038fcb5902c9439a5901be11a54e9b78a59daab4baf3bdff8b9cba1f3af49415e9154ee88b500cfb751627f424bd15ed6a9adff317e41c0
|
7
|
+
data.tar.gz: 170b80b8b311c695b1cab0f28cd3cd51369ac0576f9b764660784e6090cc7c73eeb14fd0fd9ef914bab7f0434f7e426caed4afb137228ac9bfcc8519e6e68fb3
|
data/bin/mutant
CHANGED
data/lib/mutant.rb
CHANGED
@@ -245,4 +245,17 @@ module Mutant
|
|
245
245
|
zombie: false
|
246
246
|
)
|
247
247
|
end # Config
|
248
|
+
|
249
|
+
# Traverse values against action
|
250
|
+
#
|
251
|
+
# Specialized to Either. Its *always* traverse.
|
252
|
+
def self.traverse(action, values)
|
253
|
+
Either::Right.new(
|
254
|
+
values.map do |value|
|
255
|
+
action.call(value).from_right do |error|
|
256
|
+
return Either::Left.new(error)
|
257
|
+
end
|
258
|
+
end
|
259
|
+
)
|
260
|
+
end
|
248
261
|
end # Mutant
|
data/lib/mutant/cli/command.rb
CHANGED
@@ -75,6 +75,18 @@ module Mutant
|
|
75
75
|
self.class::SUBCOMMANDS
|
76
76
|
end
|
77
77
|
|
78
|
+
def execute
|
79
|
+
action.either(
|
80
|
+
method(:fail_message),
|
81
|
+
->(_) { true }
|
82
|
+
)
|
83
|
+
end
|
84
|
+
|
85
|
+
def fail_message(message)
|
86
|
+
world.stderr.puts(message)
|
87
|
+
false
|
88
|
+
end
|
89
|
+
|
78
90
|
def parser
|
79
91
|
OptionParser.new do |parser|
|
80
92
|
parser.banner = "usage: #{banner}"
|
@@ -33,23 +33,13 @@ module Mutant
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def parse_remaining_arguments(arguments)
|
36
|
-
traverse(@config.expression_parser.public_method(:apply), arguments)
|
36
|
+
Mutant.traverse(@config.expression_parser.public_method(:apply), arguments)
|
37
37
|
.fmap do |match_expressions|
|
38
38
|
matcher(match_expressions: match_expressions)
|
39
39
|
self
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
def traverse(action, values)
|
44
|
-
Either::Right.new(
|
45
|
-
values.map do |value|
|
46
|
-
action.call(value).from_right do |error|
|
47
|
-
return Either::Left.new(error)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
)
|
51
|
-
end
|
52
|
-
|
53
43
|
def set(**attributes)
|
54
44
|
@config = @config.with(attributes)
|
55
45
|
end
|
@@ -25,12 +25,19 @@ module Mutant
|
|
25
25
|
|
26
26
|
private
|
27
27
|
|
28
|
-
def
|
28
|
+
def action
|
29
29
|
soft_fail(License.apply(world))
|
30
30
|
.bind { bootstrap }
|
31
31
|
.bind(&Runner.public_method(:apply))
|
32
|
-
.
|
33
|
-
|
32
|
+
.bind(&method(:from_result))
|
33
|
+
end
|
34
|
+
|
35
|
+
def from_result(result)
|
36
|
+
if result.success?
|
37
|
+
Either::Right.new(nil)
|
38
|
+
else
|
39
|
+
Either::Left.new('Uncovered mutations detected, exiting nonzero!')
|
40
|
+
end
|
34
41
|
end
|
35
42
|
|
36
43
|
def soft_fail(result)
|
@@ -11,12 +11,9 @@ module Mutant
|
|
11
11
|
|
12
12
|
private
|
13
13
|
|
14
|
-
def
|
15
|
-
|
16
|
-
.fmap(&method(:expand))
|
17
|
-
.bind { Bootstrap.apply(world, @config) }
|
14
|
+
def action
|
15
|
+
bootstrap
|
18
16
|
.fmap(&method(:report_env))
|
19
|
-
.right?
|
20
17
|
end
|
21
18
|
|
22
19
|
def report_env(env)
|
@@ -23,39 +23,55 @@ module Mutant
|
|
23
23
|
# when git command failed
|
24
24
|
def touches?(path, line_range)
|
25
25
|
touched_paths
|
26
|
+
.from_right { |message| fail Error, message }
|
26
27
|
.fetch(path) { return false }
|
27
28
|
.touches?(line_range)
|
28
29
|
end
|
29
30
|
|
30
31
|
private
|
31
32
|
|
32
|
-
|
33
|
+
def repository_root
|
34
|
+
world
|
35
|
+
.capture_stdout(%w[git rev-parse --show-toplevel])
|
36
|
+
.fmap(&:chomp)
|
37
|
+
.fmap(&world.pathname.public_method(:new))
|
38
|
+
end
|
39
|
+
|
33
40
|
def touched_paths
|
34
|
-
|
35
|
-
|
41
|
+
repository_root.bind(&method(:diff_index))
|
42
|
+
end
|
43
|
+
memoize :touched_paths
|
36
44
|
|
45
|
+
def diff_index(root)
|
37
46
|
world
|
38
47
|
.capture_stdout(%W[git diff-index #{to}])
|
39
|
-
.
|
40
|
-
.lines
|
41
|
-
|
42
|
-
|
43
|
-
|
48
|
+
.fmap(&:lines)
|
49
|
+
.bind do |lines|
|
50
|
+
Mutant
|
51
|
+
.traverse(->(line) { parse_line(root, line) }, lines)
|
52
|
+
.fmap do |paths|
|
53
|
+
paths.map { |path| [path.path, path] }.to_h
|
54
|
+
end
|
44
55
|
end
|
45
|
-
.to_h
|
46
56
|
end
|
47
|
-
memoize :touched_paths
|
48
|
-
# rubocop:enable Metrics/MethodLength
|
49
|
-
|
50
|
-
def parse_line(work_dir, line)
|
51
|
-
match = FORMAT.match(line) or fail Error, "Invalid git diff-index line: #{line}"
|
52
57
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
+
# rubocop:disable Metrics/MethodLength
|
59
|
+
def parse_line(root, line)
|
60
|
+
match = FORMAT.match(line)
|
61
|
+
|
62
|
+
if match
|
63
|
+
Either::Right.new(
|
64
|
+
Path.new(
|
65
|
+
path: root.join(match.captures.first),
|
66
|
+
to: to,
|
67
|
+
world: world
|
68
|
+
)
|
69
|
+
)
|
70
|
+
else
|
71
|
+
Either::Left.new("Invalid git diff-index line: #{line}")
|
72
|
+
end
|
58
73
|
end
|
74
|
+
# rubocop:enable Metrics/MethodLength
|
59
75
|
|
60
76
|
# Path touched by a diff
|
61
77
|
class Path
|
data/lib/mutant/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: abstract_type
|