pronto-rustcov 0.1.3 → 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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pronto/rustcov.rb +4 -47
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31c83359d361edd1185db805da8bbfe856af2d563ce47d8fa0f009da032d726a
4
- data.tar.gz: 897fb95b58ee8bd7fbdd9bdf26ee130711a09ba90f65980586a75e320ef8c9c8
3
+ metadata.gz: 4b90415468e5df17f944a01aaf70d5cfcedf235d6219cb6decfd7444fd5316aa
4
+ data.tar.gz: 7fa74a181f664b1f2f6790a46a96f5c75ccc23439f23348bcdfb3a5f00d385dc
5
5
  SHA512:
6
- metadata.gz: edaf62c63f70f2f1e13e160c3e5edd611b61691a0e5fdf1330d325e424a7dd6c172fdd3620eb4ec68eba0a653163f5286e5a3f4a96b674c1308ccef9286d2735
7
- data.tar.gz: b938b775288fe0c731bc1e990768b822d3d30f4a5d547fc9c203af4670a407079b366d25b97571d5990f31b8caa69c0a707d92007502501f12a8661af8c5d884
6
+ metadata.gz: b0723c5c9ced93c32082537a66721a769dba75bb9f54a1113213c6ab7a921872f44b219d6cbb7d6856996ea7d6f881d1381f087f8214099aeb6fbe45d7fa6473
7
+ data.tar.gz: edc3c3699d2c03e1421708159891f8d4011c99e2a0b31951901f02e51bb95905b7f36feb16b03ebfbd5829fdb7f9cb298b835865cfd376b1354bd5323145184f
@@ -3,54 +3,11 @@ 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
6
+ one_message_per_file('target/lcov.info')
11
7
  end
12
8
 
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
9
+ def messages_limit
10
+ ENV['PRONTO_RUSTCOV_MESSAGES_LIMIT']&.to_i || 5
54
11
  end
55
12
 
56
13
  def one_message_per_file(lcov_path)
@@ -60,7 +17,7 @@ module Pronto
60
17
 
61
18
  grouped = Hash.new { |h, k| h[k] = [] }
62
19
 
63
- @patches.each do |patch|
20
+ @patches.sort_by { |patch| -patch.added_lines.count }.take(messages_limit).each do |patch|
64
21
  next unless patch.added_lines.any?
65
22
  file_path = patch.new_file_full_path.to_s
66
23
  uncovered = lcov[file_path]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pronto-rustcov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Lazureykis