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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pronto/rustcov.rb +20 -10
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef51646f7724b9d3acad2b27ad0171cae96d6966dc3a15f9997b61ba9909ece0
4
- data.tar.gz: 454ae62f61cd707f34874d3698bf3196522aecb7fc1453a8ac2496a56d264b53
3
+ metadata.gz: 6215e6c0bfaf4c7115ea27c903505b5ff89b57cbe03557691cfece35e3fa0e74
4
+ data.tar.gz: 4eb59d1bbb8ef99c8c0906d270eddaf6b834e9f235c3769e738d8ef046382848
5
5
  SHA512:
6
- metadata.gz: 8e4de5b6716a266ce48b6bd83452ef8af9a3a2574ea8a3c035670f26fa205559d1b75f8a13eb9a7bed32aacacf6e28441a5b00687cc1efddc2686892dc76b346
7
- data.tar.gz: dc4a98ac286c781e429b80b9f01eec4adebf779b82b921541328c50756473b3d666fbc4811a00c91c0d0c33d34cdef34af260f4f0a060e1b6e062af3f35f065b
6
+ metadata.gz: ad94c2948cc78ea005437934b97245e0d95d166a48e5a434cba86b7b9c9f92622247f620b83bf56e5346bb1575c4b5fc719c5ae7450c729dd463289fd527848f
7
+ data.tar.gz: a41ed3908e683e310d4019f7769f7bd14a88225875df16c762a6b530c900069cef802bb13cfbd35da115213182fe0dd44f3b42f2919cd02cf80d5338cf046481
@@ -6,7 +6,8 @@ module Pronto
6
6
  return [] unless @patches
7
7
 
8
8
  lcov = parse_lcov('target/lcov.info')
9
- messages = []
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
- messages << Message.new(
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
- messages
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
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.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Lazureykis