active_mutator 0.4.0 → 0.4.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35694bf66189f60b88d9761217beb3cd025e74998e0ed1a2eed69a4a002f4b04
|
|
4
|
+
data.tar.gz: e4dc5eb475d915653cf317379fa565aefacbcbe0d0f5115bd750dbb8860c74c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e8d6d31ef9767b5ae869b753090e8237f94442a82271fcec9aaa126ea02a2392f8c884bb978339c2cdf30210fde64948040cd226d2d0491eca3617db783e5bd
|
|
7
|
+
data.tar.gz: d4ac2c77866af4cfb2369ff7a1a8be527d2dddacbd494d28310710ba92936d2321f6b6993168e7e1aaf8dd7059a2ae91818f90c8815b2cfb95447a11ae67f800
|
|
@@ -5,11 +5,22 @@ module ActiveMutator
|
|
|
5
5
|
return [] unless node.is_a?(Prism::StatementsNode)
|
|
6
6
|
return [] if node.body.size < 2
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
# A heredoc's body lives on the lines after the statement, outside the
|
|
9
|
+
# node's byte range, so deleting the range leaves the body behind as
|
|
10
|
+
# unparseable text. Skip those statements.
|
|
11
|
+
node.body.reject { |stmt| contains_heredoc?(stmt) }.map do |stmt|
|
|
9
12
|
edit(loc_range(stmt.location), "",
|
|
10
13
|
"delete `#{stmt.slice.lines.first.strip}`")
|
|
11
14
|
end
|
|
12
15
|
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def contains_heredoc?(node)
|
|
20
|
+
return true if node.respond_to?(:heredoc?) && node.heredoc?
|
|
21
|
+
|
|
22
|
+
node.compact_child_nodes.any? { |child| contains_heredoc?(child) }
|
|
23
|
+
end
|
|
13
24
|
end
|
|
14
25
|
end
|
|
15
26
|
end
|
|
@@ -22,7 +22,14 @@ module ActiveMutator
|
|
|
22
22
|
def annotate(result)
|
|
23
23
|
m = result.mutation
|
|
24
24
|
file = m.subject.file.delete_prefix(@root.chomp("/") + "/")
|
|
25
|
-
|
|
25
|
+
# Newlines survive percent-encoding, so the annotation renders as a
|
|
26
|
+
# small diff instead of a pipe-separated one-liner.
|
|
27
|
+
message = <<~MSG.chomp
|
|
28
|
+
#{m.subject.name}: #{m.description}
|
|
29
|
+
- #{m.original_snippet}
|
|
30
|
+
+ #{m.edit.replacement}
|
|
31
|
+
Every test still passed after this change. Add or strengthen a test that fails when it's applied.
|
|
32
|
+
MSG
|
|
26
33
|
@out.puts "::warning file=#{file},line=#{m.line},title=Surviving mutant::#{encode(message)}"
|
|
27
34
|
end
|
|
28
35
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_mutator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel John
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: prism
|