pronto-rustcov 0.1.1 → 0.1.2
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/lib/pronto/rustcov.rb +20 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6215e6c0bfaf4c7115ea27c903505b5ff89b57cbe03557691cfece35e3fa0e74
|
4
|
+
data.tar.gz: 4eb59d1bbb8ef99c8c0906d270eddaf6b834e9f235c3769e738d8ef046382848
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad94c2948cc78ea005437934b97245e0d95d166a48e5a434cba86b7b9c9f92622247f620b83bf56e5346bb1575c4b5fc719c5ae7450c729dd463289fd527848f
|
7
|
+
data.tar.gz: a41ed3908e683e310d4019f7769f7bd14a88225875df16c762a6b530c900069cef802bb13cfbd35da115213182fe0dd44f3b42f2919cd02cf80d5338cf046481
|
data/lib/pronto/rustcov.rb
CHANGED
@@ -6,7 +6,8 @@ module Pronto
|
|
6
6
|
return [] unless @patches
|
7
7
|
|
8
8
|
lcov = parse_lcov('target/lcov.info')
|
9
|
-
|
9
|
+
|
10
|
+
grouped = Hash.new { |h, k| h[k] = [] }
|
10
11
|
|
11
12
|
@patches.each do |patch|
|
12
13
|
next unless patch.added_lines.any?
|
@@ -16,19 +17,28 @@ module Pronto
|
|
16
17
|
|
17
18
|
patch.added_lines.each do |line|
|
18
19
|
if uncovered.include?(line.new_lineno)
|
19
|
-
|
20
|
-
patch.new_file_path,
|
21
|
-
line,
|
22
|
-
:warning,
|
23
|
-
"⚠️ Tests are missing.",
|
24
|
-
nil,
|
25
|
-
self.class
|
26
|
-
)
|
20
|
+
grouped[patch].push(line)
|
27
21
|
end
|
28
22
|
end
|
29
23
|
end
|
30
24
|
|
31
|
-
|
25
|
+
grouped.map do |patch, lines|
|
26
|
+
linenos = lines.map(&:new_lineno).sort
|
27
|
+
ranges = linenos.chunk_while { |i, j| j == i + 1 }
|
28
|
+
.map { |group| group.size > 1 ? "#{group.first}–#{group.last}" : group.first.to_s }
|
29
|
+
|
30
|
+
message_text = "⚠️ Test coverage is missing for lines: #{ranges.join(', ')}"
|
31
|
+
|
32
|
+
# Attach the message to the first uncovered line
|
33
|
+
Pronto::Message.new(
|
34
|
+
patch.new_file_path,
|
35
|
+
lines.first,
|
36
|
+
:warning,
|
37
|
+
message_text,
|
38
|
+
nil,
|
39
|
+
self.class
|
40
|
+
)
|
41
|
+
end
|
32
42
|
end
|
33
43
|
|
34
44
|
private
|