pronto-rustcov 0.1.2 → 0.1.3
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 +52 -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: 31c83359d361edd1185db805da8bbfe856af2d563ce47d8fa0f009da032d726a
|
4
|
+
data.tar.gz: 897fb95b58ee8bd7fbdd9bdf26ee130711a09ba90f65980586a75e320ef8c9c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edaf62c63f70f2f1e13e160c3e5edd611b61691a0e5fdf1330d325e424a7dd6c172fdd3620eb4ec68eba0a653163f5286e5a3f4a96b674c1308ccef9286d2735
|
7
|
+
data.tar.gz: b938b775288fe0c731bc1e990768b822d3d30f4a5d547fc9c203af4670a407079b366d25b97571d5990f31b8caa69c0a707d92007502501f12a8661af8c5d884
|
data/lib/pronto/rustcov.rb
CHANGED
@@ -3,9 +3,60 @@ require 'pronto'
|
|
3
3
|
module Pronto
|
4
4
|
class Rustcov < Runner
|
5
5
|
def run
|
6
|
+
if ENV['PRONTO_RUSTCOV_URL']
|
7
|
+
one_message_per_file_markdown('target/lcov.info', ENV['PRONTO_RUSTCOV_URL'])
|
8
|
+
else
|
9
|
+
one_message_per_file('target/lcov.info')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def one_message_per_file_markdown(lcov_path, base_url)
|
14
|
+
base_url = base_url.delete_suffix('/')
|
15
|
+
|
16
|
+
return [] unless @patches
|
17
|
+
|
18
|
+
lcov = parse_lcov(lcov_path)
|
19
|
+
|
20
|
+
grouped = Hash.new { |h, k| h[k] = [] }
|
21
|
+
|
22
|
+
@patches.each do |patch|
|
23
|
+
next unless patch.added_lines.any?
|
24
|
+
file_path = patch.new_file_full_path.to_s
|
25
|
+
uncovered = lcov[file_path]
|
26
|
+
next unless uncovered
|
27
|
+
|
28
|
+
patch.added_lines.each do |line|
|
29
|
+
if uncovered.include?(line.new_lineno)
|
30
|
+
grouped[patch].push(line)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
grouped.map do |patch, lines|
|
36
|
+
linenos = lines.map(&:new_lineno).sort
|
37
|
+
ranges = linenos.chunk_while { |i, j| j == i + 1 }
|
38
|
+
.map { |group| group.size > 1 ? "#{group.first}–#{group.last}" : group.first.to_s }
|
39
|
+
|
40
|
+
url = "#{base_url}/#{patch.new_file_path}.html#L#{linenos.first}"
|
41
|
+
first_range_link = "[#{ranges.first}](#{url})"
|
42
|
+
message_text = "⚠️ Test coverage is missing for lines: #{first_range_link}, #{ranges[1..].join(', ')}"
|
43
|
+
|
44
|
+
# Attach the message to the first uncovered line
|
45
|
+
Pronto::Message.new(
|
46
|
+
patch.new_file_path,
|
47
|
+
lines.first,
|
48
|
+
:warning,
|
49
|
+
message_text,
|
50
|
+
nil,
|
51
|
+
self.class
|
52
|
+
)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def one_message_per_file(lcov_path)
|
6
57
|
return [] unless @patches
|
7
58
|
|
8
|
-
lcov = parse_lcov(
|
59
|
+
lcov = parse_lcov(lcov_path)
|
9
60
|
|
10
61
|
grouped = Hash.new { |h, k| h[k] = [] }
|
11
62
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pronto-rustcov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Lazureykis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pronto
|