pronto-rustcov 0.1.4 → 0.1.6

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 +7 -49
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63740536f0a7afad0d8d7072898fb5c90ffe7d73902cb234a6e6058c1733e221
4
- data.tar.gz: acafff7d282c63394f8f4d0424ba14e3999cd23097da1d5443460e5b26d5310d
3
+ metadata.gz: bb33cf0ba6f6437b808ddc35ee00823c3cfbf03d463dc943b4255597dca768b2
4
+ data.tar.gz: 50f0acb9d7d0c3c240ca13e5191d7f871512d4280ad3ba92d25a4f6fd94fec8e
5
5
  SHA512:
6
- metadata.gz: 66878eaab3af2cda55d7c6d74d569e5aaa8f9ddb21e9eca532eabb11248f6e737698f7ecbf872681849941908c450e7233ac704e949fb1578e3b4ae386818c7f
7
- data.tar.gz: 2620f0434925e9b940ccb60fc8bea6ade2ba074980f78c90e45f3f8135bc6c7d3f3dd7eb4a0141e91dfa7ec3c4cd438339cd0ed3c701a8f1416fceefac1a8262
6
+ metadata.gz: 9eae0d6aa9a54c4dd6986fe8423b2a6e805ddc32af24b2321cbb6f1434af8596544eda819248313a45904585cf6bc17759f6f2e81de0f281e457c9bd3eeca0bf
7
+ data.tar.gz: 4d9156c24fe8183937b769a36ed7782384d4e8875794b1014106cc32d6546feddd2de5d9787190d306428810159ebb0b4bc5eefda7d8fbb108f1d566c9de4d3d
@@ -3,58 +3,15 @@ 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 messages_limit
14
- ENV['PRONTO_RUSTCOV_MESSAGES_LIMIT']&.to_i || 10
9
+ def pronto_files_limit
10
+ ENV['PRONTO_RUSTCOV_FILES_LIMIT']&.to_i || 5
15
11
  end
16
12
 
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
13
+ def pronto_messages_per_file_limit
14
+ ENV['PRONTO_RUSTCOV_MESSAGES_PER_FILE_LIMIT']&.to_i || 5
58
15
  end
59
16
 
60
17
  def one_message_per_file(lcov_path)
@@ -64,7 +21,7 @@ module Pronto
64
21
 
65
22
  grouped = Hash.new { |h, k| h[k] = [] }
66
23
 
67
- @patches.sort_by { |patch| -patch.added_lines.count }.take(messages_limit).each do |patch|
24
+ @patches.sort_by { |patch| -patch.added_lines.count }.take(pronto_files_limit).each do |patch|
68
25
  next unless patch.added_lines.any?
69
26
  file_path = patch.new_file_full_path.to_s
70
27
  uncovered = lcov[file_path]
@@ -80,6 +37,7 @@ module Pronto
80
37
  grouped.map do |patch, lines|
81
38
  linenos = lines.map(&:new_lineno).sort
82
39
  ranges = linenos.chunk_while { |i, j| j == i + 1 }
40
+ .take(pronto_messages_per_file_limit)
83
41
  .map { |group| group.size > 1 ? "#{group.first}–#{group.last}" : group.first.to_s }
84
42
 
85
43
  message_text = "⚠️ Test coverage is missing for lines: #{ranges.join(', ')}"
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.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Lazureykis