pronto-rustcov 0.1.7 → 0.1.10

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +92 -0
  3. data/lib/pronto/rustcov.rb +5 -6
  4. metadata +10 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7df000545899a6dcf0010858dce8b6b70fbd490b3267ce907167289be36c746f
4
- data.tar.gz: 1e7e6c583a9be88702d442f9da91921e0bb1debed9563af582f1e06d356cc575
3
+ metadata.gz: 6b882e49777342c96bf1f0def3681be1bad19a48e5198e42b1d89d7edf2e0cb3
4
+ data.tar.gz: a40b8c9f86b206f6a242ce8ad126ef02020c9445b88fa1ec34b8bab29d9a0bef
5
5
  SHA512:
6
- metadata.gz: 9d3cc9a905b9ed10d597c8e2a414a1fe4d368c486cb80d0adb9751df1c594f745597b5edbfc0087780154df510691fb6b5de3147fdc5f06ef4eac5c1312e7478
7
- data.tar.gz: a04b4aa9f19c3dd7b6bf2dd555f35129c5a89b1432997f6e1e9b0c5ada57d3a558e0a8eb570d36fc81f89fea27cb00f0c8d3aa06568228d3a170d848d3f7d4d0
6
+ metadata.gz: 19553596ea3125a7d3bbe5d78e4da9ebca04f50068582d293fc886e2f367a9dac9f1ef94d2cf3511233feb07d5f8b883bcc3020b2e91f21d6be339564e6bb383
7
+ data.tar.gz: 1a39b04b65a0acfbfde29cdd9e8c8eb352fd919ea5d62f657fd8d0985b47c8a7b146c2473aa49a2a464f3dd5e546613ab458f0fe791ffeecb0c65ae0c7f44d0d
data/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # pronto-rustcov
2
+
3
+ ⚡ A [Pronto](https://github.com/prontolabs/pronto) runner that highlights **uncovered Rust lines** in GitHub pull requests using LCOV reports from [`cargo llvm-cov`](https://github.com/taiki-e/cargo-llvm-cov).
4
+
5
+ ## 🔧 Installation
6
+
7
+ Add to your `Gemfile` in the `:development` group:
8
+
9
+ ```ruby
10
+ gem 'pronto-rustcov', group: :development
11
+ ```
12
+
13
+ Then install:
14
+
15
+ ```bash
16
+ bundle install
17
+ ```
18
+
19
+ Alternatively, install the gem globally:
20
+
21
+ ```bash
22
+ gem install pronto-rustcov
23
+ ```
24
+
25
+ ## 🚀 Usage
26
+
27
+ Make sure you've generated an LCOV file using `cargo llvm-cov`:
28
+
29
+ ```bash
30
+ cargo install cargo-llvm-cov
31
+ cargo llvm-cov clean
32
+ cargo llvm-cov --no-report
33
+ cargo llvm-cov report --lcov > target/lcov.info
34
+ ```
35
+
36
+
37
+ ## Github Actions Example
38
+
39
+ ```yaml
40
+ name: Tests
41
+
42
+ permissions:
43
+ contents: read
44
+ pull-requests: write
45
+ checks: write
46
+ statuses: write
47
+
48
+ on:
49
+ pull_request:
50
+ branches:
51
+ - main
52
+
53
+ jobs:
54
+ tests:
55
+ runs-on: ubuntu-latest
56
+
57
+ steps:
58
+ - name: Rust Toolchain Setup
59
+ uses: actions-rust-lang/setup-rust-toolchain@v1
60
+ with:
61
+ components: llvm-tools-preview
62
+
63
+ - uses: ruby/setup-ruby@v1
64
+ with:
65
+ ruby-version: '3.3'
66
+ bundler-cache: true
67
+
68
+ - name: Install rustup component
69
+ uses: taiki-e/install-action@cargo-llvm-cov
70
+
71
+ - name: Run Tests
72
+ run: |
73
+ cargo llvm-cov clean
74
+ cargo llvm-cov --no-report --workspace --no-cfg-coverage --remap-path-prefix
75
+ cargo llvm-cov report --html
76
+ cargo llvm-cov report --lcov > target/lcov.info
77
+
78
+ - name: Run Pronto
79
+ env:
80
+ PRONTO_PULL_REQUEST_ID: ${{ github.event.pull_request.number }}
81
+ PRONTO_GITHUB_ACCESS_TOKEN: "${{ github.token }}"
82
+ PRONTO_RUSTCOV_FILES_LIMIT: 3
83
+ PRONTO_RUSTCOV_MESSAGES_PER_FILE_LIMIT: 3
84
+ PRONTO_RUSTCOV_LCOV_PATH: target/lcov.info
85
+ run: |
86
+ gem install pronto pronto-rustcov
87
+ pronto run -f github_status github_pr -c origin/${{ github.base_ref }}
88
+ ```
89
+
90
+ ## 📝 License
91
+
92
+ MIT
@@ -33,7 +33,7 @@ module Pronto
33
33
  def group_patches(patches, lcov)
34
34
  grouped = Hash.new { |h, k| h[k] = [] }
35
35
 
36
- patches.sort_by { |patch| -patch.added_lines.count }.take(pronto_files_limit).each do |patch|
36
+ patches.each do |patch|
37
37
  next unless patch.added_lines.any?
38
38
  file_path = patch.new_file_full_path.to_s
39
39
  uncovered = lcov[file_path]
@@ -46,7 +46,7 @@ module Pronto
46
46
  end
47
47
  end
48
48
 
49
- grouped
49
+ grouped.sort_by { |_, lines| -lines.count }.take(pronto_files_limit)
50
50
  end
51
51
 
52
52
  def build_messages(grouped)
@@ -56,9 +56,11 @@ module Pronto
56
56
  linenos = lines.map(&:new_lineno).sort
57
57
  line_ranges = linenos.chunk_while { |i, j| j == i + 1 }.to_a
58
58
 
59
+ best_ranges = line_ranges.sort_by { |range| [-range.size, range.first] }.take(pronto_messages_per_file_limit)
60
+
59
61
  # If we have a message per file limit of N, then create N individual messages
60
62
  # We'll take each range and create a separate message for it, up to the limit
61
- line_ranges.each do |range|
63
+ best_ranges.each do |range|
62
64
  message_text = format_message_text(range)
63
65
 
64
66
  # Find the first line in this range for the message
@@ -72,9 +74,6 @@ module Pronto
72
74
  nil,
73
75
  self.class
74
76
  )
75
-
76
- # Stop if we've reached the limit of messages per file
77
- break if messages.count { |m| m.path == patch.new_file_path } >= pronto_messages_per_file_limit
78
77
  end
79
78
  end
80
79
 
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.7
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Lazureykis
@@ -14,44 +14,44 @@ dependencies:
14
14
  name: pronto
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.11.0
19
+ version: 0.11.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.11.0
26
+ version: 0.11.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.12'
33
+ version: '3.13'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.12'
40
+ version: '3.13'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '13.0'
47
+ version: '13.2'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '13.0'
54
+ version: '13.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: simplecov
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -73,6 +73,7 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - README.md
76
77
  - lib/pronto/rustcov.rb
77
78
  homepage: https://github.com/lazureykis/pronto-rustcov
78
79
  licenses: