pronto-rustcov 0.1.4 → 0.1.5
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 +2 -49
- 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: 4b90415468e5df17f944a01aaf70d5cfcedf235d6219cb6decfd7444fd5316aa
|
4
|
+
data.tar.gz: 7fa74a181f664b1f2f6790a46a96f5c75ccc23439f23348bcdfb3a5f00d385dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0723c5c9ced93c32082537a66721a769dba75bb9f54a1113213c6ab7a921872f44b219d6cbb7d6856996ea7d6f881d1381f087f8214099aeb6fbe45d7fa6473
|
7
|
+
data.tar.gz: edc3c3699d2c03e1421708159891f8d4011c99e2a0b31951901f02e51bb95905b7f36feb16b03ebfbd5829fdb7f9cb298b835865cfd376b1354bd5323145184f
|
data/lib/pronto/rustcov.rb
CHANGED
@@ -3,58 +3,11 @@ require 'pronto'
|
|
3
3
|
module Pronto
|
4
4
|
class Rustcov < Runner
|
5
5
|
def run
|
6
|
-
|
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
|
6
|
+
one_message_per_file('target/lcov.info')
|
11
7
|
end
|
12
8
|
|
13
9
|
def messages_limit
|
14
|
-
ENV['PRONTO_RUSTCOV_MESSAGES_LIMIT']&.to_i ||
|
15
|
-
end
|
16
|
-
|
17
|
-
def one_message_per_file_markdown(lcov_path, base_url)
|
18
|
-
base_url = base_url.delete_suffix('/')
|
19
|
-
|
20
|
-
return [] unless @patches
|
21
|
-
|
22
|
-
lcov = parse_lcov(lcov_path)
|
23
|
-
|
24
|
-
grouped = Hash.new { |h, k| h[k] = [] }
|
25
|
-
|
26
|
-
@patches.sort_by { |patch| -patch.added_lines.count }.take(messages_limit).each do |patch|
|
27
|
-
next unless patch.added_lines.any?
|
28
|
-
file_path = patch.new_file_full_path.to_s
|
29
|
-
uncovered = lcov[file_path]
|
30
|
-
next unless uncovered
|
31
|
-
|
32
|
-
patch.added_lines.each do |line|
|
33
|
-
if uncovered.include?(line.new_lineno)
|
34
|
-
grouped[patch].push(line)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
grouped.map do |patch, lines|
|
40
|
-
linenos = lines.map(&:new_lineno).sort
|
41
|
-
ranges = linenos.chunk_while { |i, j| j == i + 1 }
|
42
|
-
.map { |group| group.size > 1 ? "#{group.first}–#{group.last}" : group.first.to_s }
|
43
|
-
|
44
|
-
url = "#{base_url}/#{patch.new_file_path}.html#L#{linenos.first}"
|
45
|
-
first_range_link = "[#{ranges.first}](#{url})"
|
46
|
-
message_text = "⚠️ Test coverage is missing for lines: #{first_range_link}, #{ranges[1..].join(', ')}"
|
47
|
-
|
48
|
-
# Attach the message to the first uncovered line
|
49
|
-
Pronto::Message.new(
|
50
|
-
patch.new_file_path,
|
51
|
-
lines.first,
|
52
|
-
:warning,
|
53
|
-
message_text,
|
54
|
-
nil,
|
55
|
-
self.class
|
56
|
-
)
|
57
|
-
end
|
10
|
+
ENV['PRONTO_RUSTCOV_MESSAGES_LIMIT']&.to_i || 5
|
58
11
|
end
|
59
12
|
|
60
13
|
def one_message_per_file(lcov_path)
|