pronto 0.11.2 → 0.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc92d09f9dae20d0ddfb42faca81ab52258623f2014a5c0a736466f443996b00
4
- data.tar.gz: 1d1c524e047a717e33d11f993d3e6fa6fc5b4103e9b75b1ae8c1275d7404394b
3
+ metadata.gz: c3bbbe22cb922619189ce37661c76be91e362d75bbbffb913cb494d6c3140903
4
+ data.tar.gz: 49fc04be6c7af5d7912b32304204b441c434101f91da691019d288330dc2be14
5
5
  SHA512:
6
- metadata.gz: 73d534c7929826919482802d0630f73a566e4525a2ffef4fe3a8f9ff1acce051b7dfbe77a01835ba483e6a5d977ddb39b18f455b832773e6e3e32ac9358b9f5a
7
- data.tar.gz: 7c9f9c8ecaa21d3d1860c9da8ddebcfcf61d88deff3717b599c3fd65a0623c33ec76f99f34bd773f0f5d3832129295531c8d7e10ccb205b4714f809a6fc906d8
6
+ metadata.gz: 02dd78392d6285a7eb16789d1e6ec0e1724a6646ea11ea8514f4fade5720ad041f45db1ab7a79eb298a98ada17ce25b9d8e2b620a01ad4523872ffa346936cba
7
+ data.tar.gz: 335eea939fc59917c3abc7a8aa76aee864a8869e5da3cf28035bf8226ce0b67e1e02f1b8ae4e0323fdd3915877985c8276899ce69a52d84ced7c92cf06c0c858
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: 'github-actions'
4
+ directory: '/'
5
+ schedule:
6
+ interval: 'weekly'
@@ -6,9 +6,9 @@ on:
6
6
 
7
7
  jobs:
8
8
  pronto:
9
- runs-on: ubuntu-20.04
9
+ runs-on: ubuntu-24.04
10
10
  steps:
11
- - uses: actions/checkout@v3
11
+ - uses: actions/checkout@v6
12
12
  with:
13
13
  fetch-depth: 0
14
14
  - name: Set up Ruby
@@ -0,0 +1,32 @@
1
+ name: Publish gem to rubygems.org
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ push:
13
+ if: github.repository == 'prontolabs/pronto'
14
+ runs-on: ubuntu-24.04
15
+
16
+ permissions:
17
+ contents: write
18
+ id-token: write
19
+
20
+ steps:
21
+ - uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
22
+ with:
23
+ egress-policy: audit
24
+
25
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
26
+
27
+ - uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4 # v1.207.0
28
+ with:
29
+ bundler-cache: true
30
+ ruby-version: '3.4'
31
+
32
+ - uses: rubygems/release-gem@1c162a739e8b4cb21a676e97b087e8268d8fc40b # v1.1.2
@@ -8,34 +8,21 @@ on:
8
8
 
9
9
  jobs:
10
10
  test:
11
- runs-on: ubuntu-20.04
11
+ runs-on: ubuntu-24.04
12
12
  strategy:
13
13
  matrix:
14
- ruby-version:
15
- - "2.3"
16
- - "2.4"
17
- - "2.5"
18
- - "2.6"
19
- - "2.7"
20
- - "3.0"
21
- - "3.1"
22
- - "3.2"
14
+ ruby: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
23
15
  exclude:
24
- - ruby-version: "2.3" # Rugged uses the wrong openssl version on CI and segfaults (similar to https://github.com/libgit2/rugged/issues/718)
16
+ - ruby: "2.3" # Rugged uses the wrong openssl version on CI and segfaults (similar to https://github.com/libgit2/rugged/issues/718)
25
17
  steps:
26
- - uses: actions/checkout@v3
18
+ - uses: actions/checkout@v6
27
19
  - name: Use specific gitlab gem version (if required)
28
- if: matrix.ruby-version == '2.4'
20
+ if: matrix.ruby == '2.4'
29
21
  run: echo "gem 'gitlab', '< 4.14.1'" >> Gemfile.local
30
22
  - name: Set up Ruby
31
23
  uses: ruby/setup-ruby@v1
32
24
  with:
33
- ruby-version: ${{ matrix.ruby-version }}
25
+ ruby-version: ${{ matrix.ruby }}
34
26
  bundler-cache: true
35
- - name: Test & publish code coverage
36
- uses: paambaati/codeclimate-action@7bcf9e73c0ee77d178e72c0ec69f1a99c1afc1f3 # v2.7.5
37
- env:
38
- CC_TEST_REPORTER_ID: 3d676246ffa66d3fdef6253a9870431b1a2da04e9ecb25486c08a38823c37b6a
39
- COVERAGE: true
40
- with:
41
- coverageCommand: bundle exec rspec
27
+ - name: Test
28
+ run: bundle exec rspec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 0.11.5
6
+
7
+ ### Changes
8
+
9
+ * [#481](https://github.com/prontolabs/pronto/pull/481) add "ostruct" as dependency for Ruby 4.0 compatibility
10
+ * [#493](https://github.com/prontolabs/pronto/pull/493) docs: document setting an alternate default branch
11
+
12
+ ## 0.11.4
13
+
14
+ ### Changes
15
+
16
+ * [#477](https://github.com/prontolabs/pronto/pull/477) fix uninitialized constant error with BitBucket integration
17
+ * [#479](https://github.com/prontolabs/pronto/pull/479) relax octokit dependency to allow 10.x releases
18
+
19
+ ## 0.11.3
20
+
21
+ ### Changes
22
+
23
+ * [#455](https://github.com/prontolabs/pronto/pull/455) compatibility fixes for supporting octokit 8.x
24
+ * [#460](https://github.com/prontolabs/pronto/pull/460) improve documentation for Gitlab CI integration
25
+ * [#462](https://github.com/prontolabs/pronto/pull/462) more doc improvements for Gitlab CI integration
26
+ * [#466](https://github.com/prontolabs/pronto/pull/466) relax octokit dependency to allow 9.x releases
27
+
3
28
  ## 0.11.2
4
29
 
5
30
  ### Changes
data/README.md CHANGED
@@ -1,10 +1,7 @@
1
1
  # Pronto
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/prontolabs/pronto.svg)](http://travis-ci.org/prontolabs/pronto)
4
- [![Coverage Status](https://img.shields.io/codeclimate/coverage/prontolabs/pronto.svg)](https://codeclimate.com/github/prontolabs/pronto)
5
- [![Code Climate](https://codeclimate.com/github/prontolabs/pronto.svg)](https://codeclimate.com/github/prontolabs/pronto)
6
3
  [![Gem Version](https://badge.fury.io/rb/pronto.svg)](http://badge.fury.io/rb/pronto)
7
- [![Inline docs](http://inch-ci.org/github/prontolabs/pronto.svg)](http://inch-ci.org/github/prontolabs/pronto)
4
+ [![Build Status](https://github.com/prontolabs/pronto/actions/workflows/specs.yml/badge.svg)](https://github.com/prontolabs/pronto/actions/workflows/specs.yml)
8
5
 
9
6
  **Pronto** runs analysis quickly by checking only the relevant changes. Created to
10
7
  be used on [GitHub pull requests](#github-integration), but also works [locally](#local-changes) and integrates with [GitLab](#gitlab-integration) and [Bitbucket](#bitbucket-integration).
@@ -13,7 +10,7 @@ to your [styleguide](https://github.com/prontolabs/pronto-rubocop), [are DRY](ht
13
10
 
14
11
  ![Pronto demo](pronto.gif "")
15
12
 
16
- _This README might be ahead of the latest release. Find the README for v0.9.2 [here](https://github.com/prontolabs/pronto/blob/v0.9.2/README.md)._
13
+ _This README might be ahead of the latest release. Find the README for v0.11.5 [here](https://github.com/prontolabs/pronto/blob/v0.11.5/README.md)._
17
14
 
18
15
  * [Installation](#installation)
19
16
  * [Usage](#usage)
@@ -55,6 +52,9 @@ gem 'pronto-flay', require: false
55
52
 
56
53
  Pronto runs the checks on a diff between the current HEAD and the provided commit-ish (default is master).
57
54
 
55
+ > [!NOTE]
56
+ > If the default branch is NOT `master`, invoke `pronto run -c=<branch>` OR set the `default_commit` config value.
57
+
58
58
  ### Local Changes
59
59
 
60
60
  Navigate to the repository you want to run Pronto on, and:
@@ -226,17 +226,26 @@ On GitLabCI, make sure to run Pronto in a [merge request pipeline](https://docs.
226
226
 
227
227
  ```yml
228
228
  lint:
229
- image: ruby
229
+ image: ruby:3.3.0 # change to your app's ruby version
230
230
  variables:
231
- PRONTO_GITLAB_API_ENDPOINT: "https://gitlab.com/api/v4"
232
- PRONTO_GITLAB_API_PRIVATE_TOKEN: token
231
+ PRONTO_GITLAB_API_ENDPOINT: "$CI_API_V4_URL" # this already contains the correct url for your GitLab instance
232
+ PRONTO_GITLAB_API_PRIVATE_TOKEN: $ACCESS_TOKEN # configure as a variable in Gitlab CI settings; you might use a "Project Access Token" with api scope instead of your private one
233
+
234
+ # Without this variable, GitLab only fetches with git depth set to a fixed amount (by default 20 on newer projects, 50 on older ones).
235
+ # This would make pronto fail with the errror "revspec 'origin/{target_branch}", because it would not know of the target Branch.
236
+ # It would also make pronto unable to compare changes with more than that amount of commits. E.g. running on 25 new commits would just return all problems, instead of only the ones in your changes.
237
+ GIT_DEPTH: 0
233
238
  only:
234
239
  - merge_requests
235
240
  script:
241
+ - apt-get update && apt-get install -y cmake # Install cmake required for rugged gem (Pronto depends on it)
236
242
  - bundle install
243
+ # Run pronto on branch of current merge request, comparing to the merge requests target branch
237
244
  - bundle exec pronto run -f gitlab_mr -c origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
238
245
  ```
239
246
 
247
+
248
+
240
249
  ### Bitbucket Integration
241
250
 
242
251
  You can run Pronto as a step of your CI builds and get the results as comments
@@ -280,6 +289,7 @@ all:
280
289
  eslint:
281
290
  exclude:
282
291
  - 'app/assets/**/*'
292
+ default_commit: 'main' # set this if your repo differs from master
283
293
  github:
284
294
  slug: prontolabs/pronto
285
295
  access_token: B26354
@@ -313,6 +323,7 @@ will always take precedence over values in configuration file.
313
323
  | `skip_runners` | All, except listed runners will be executed. Runs everything if option is skipped. |
314
324
  | `verbose` | Outputs more information when set to `true`. |
315
325
  | `warnings_per_review` | Limits the amount of warnings per review. Returns all warnings if option is skipped. |
326
+ | `default_commit` | Commit-ish `pronto run` will execute runners against. |
316
327
 
317
328
  ### Message format
318
329
 
@@ -433,6 +444,7 @@ Articles to help you to get started:
433
444
  * [Make Code Reviews A Little Bit Better With Automation](https://medium.com/jimmy-farrell/make-codes-reviews-a-little-bit-better-with-automation-35640df08a62)
434
445
  * [Stop shipping untested Ruby code with undercover](https://medium.com/futuredev/stop-shipping-untested-ruby-code-with-undercover-1edc963be4a6)
435
446
  * [Automatic code review with Pronto and GitHub Actions](https://everydayrails.com/2021/05/29/pronto-github-actions-code-quality.html)
447
+ * [Integrate Pronto with Gitlab CI for Rails App](https://prabinpoudel.com.np/articles/integrate-pronto-with-gitlab-ci-for-rails-app/)
436
448
 
437
449
  Make a Pull Request to add something you wrote or found useful.
438
450
 
@@ -442,4 +454,4 @@ Make a Pull Request to add something you wrote or found useful.
442
454
 
443
455
  ## Copyright
444
456
 
445
- Copyright (c) 2013-2018 Mindaugas Mozūras. See [LICENSE](LICENSE) for further details.
457
+ Copyright (c) 2013-2025 Mindaugas Mozūras. See [LICENSE](LICENSE) for further details.
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ostruct'
4
+
1
5
  class BitbucketClient
2
6
  include HTTParty
3
7
  base_uri 'https://api.bitbucket.org/2.0/repositories'
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ostruct'
4
+
1
5
  class BitbucketServerClient
2
6
  include HTTParty
3
7
 
@@ -13,9 +13,8 @@ module Pronto
13
13
  'GitHub'
14
14
  end
15
15
 
16
- def line_number(message, patches)
17
- line = patches.find_line(message.full_path, message.line.new_lineno)
18
- line.position
16
+ def line_number(message, _)
17
+ message.line&.new_lineno
19
18
  end
20
19
  end
21
20
  end
@@ -19,9 +19,8 @@ module Pronto
19
19
  $stderr.puts "Failed to post: #{e.message}"
20
20
  end
21
21
 
22
- def line_number(message, patches)
23
- line = patches.find_line(message.full_path, message.line.new_lineno)
24
- line.position
22
+ def line_number(message, _)
23
+ message.line&.new_lineno
25
24
  end
26
25
  end
27
26
  end
data/lib/pronto/github.rb CHANGED
@@ -10,8 +10,9 @@ module Pronto
10
10
  def pull_comments(sha)
11
11
  @comment_cache["#{pull_id}/#{sha}"] ||= begin
12
12
  client.pull_comments(slug, pull_id).map do |comment|
13
- Comment.new(sha, comment.body, comment.path,
14
- comment.position || comment.original_position)
13
+ Comment.new(
14
+ sha, comment.body, comment.path, comment.line || comment.original_line
15
+ )
15
16
  end
16
17
  end
17
18
  rescue Octokit::NotFound => e
@@ -23,7 +24,7 @@ module Pronto
23
24
  def commit_comments(sha)
24
25
  @comment_cache[sha.to_s] ||= begin
25
26
  client.commit_comments(slug, sha).map do |comment|
26
- Comment.new(sha, comment.body, comment.path, comment.position)
27
+ Comment.new(sha, comment.body, comment.path, comment.line)
27
28
  end
28
29
  end
29
30
  end
@@ -37,9 +38,13 @@ module Pronto
37
38
  def create_pull_comment(comment)
38
39
  if comment.path && comment.position
39
40
  @config.logger.log("Creating pull request comment on #{pull_id}")
40
- client.create_pull_comment(slug, pull_id, comment.body,
41
- pull_sha || comment.sha,
42
- comment.path, comment.position)
41
+ client.create_pull_comment(
42
+ # Depending on the Octokit version the 6th argument can be either postion or line. We'll
43
+ # provide the `line` as this argument and also provide the line in the options argument.
44
+ # The API uses `line` and ignores position when `line` is provided.
45
+ slug, pull_id, comment.body, pull_sha || comment.sha,
46
+ comment.path, comment.position, { line: comment.position }
47
+ )
43
48
  else
44
49
  create_commit_comment(comment)
45
50
  end
@@ -66,12 +71,11 @@ module Pronto
66
71
  def create_pull_request_review(comments)
67
72
  options = {
68
73
  event: @config.github_review_type,
69
- accept: 'application/vnd.github.v3.diff+json', # https://developer.github.com/v3/pulls/reviews/#create-a-pull-request-review
70
74
  comments: comments.map do |comment|
71
75
  {
72
- path: comment.path,
73
- position: comment.position,
74
- body: comment.body
76
+ path: comment.path,
77
+ line: comment.position,
78
+ body: comment.body
75
79
  }
76
80
  end
77
81
  }
@@ -1,6 +1,6 @@
1
1
  module Pronto
2
2
  module Version
3
- STRING = '0.11.2'.freeze
3
+ STRING = '0.11.5'.freeze
4
4
 
5
5
  MSG = '%s (running on %s %s %s)'.freeze
6
6
 
data/pronto.gemspec CHANGED
@@ -21,7 +21,6 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.licenses = ['MIT']
23
23
  s.required_ruby_version = '>= 2.3.0'
24
- s.rubygems_version = '1.8.23'
25
24
 
26
25
  s.files = `git ls-files`.split($RS).reject do |file|
27
26
  file =~ %r{^(?:
@@ -42,11 +41,13 @@ Gem::Specification.new do |s|
42
41
 
43
42
  s.add_runtime_dependency('gitlab', '>= 4.4.0', '< 5.0')
44
43
  s.add_runtime_dependency('httparty', '>= 0.13.7', '< 1.0')
45
- s.add_runtime_dependency('octokit', '>= 4.7.0', '< 8.0')
44
+ s.add_runtime_dependency('octokit', '>= 4.7.0', '< 11.0')
45
+ s.add_runtime_dependency('ostruct')
46
46
  s.add_runtime_dependency('rainbow', '>= 2.2', '< 4.0')
47
47
  s.add_runtime_dependency('rexml', '>= 3.2.5', '< 4.0')
48
48
  s.add_runtime_dependency('rugged', '>= 0.23.0', '< 2.0')
49
49
  s.add_runtime_dependency('thor', '>= 0.20.3', '< 2.0')
50
+ s.add_development_dependency('base64', '~> 0.1.2')
50
51
  s.add_development_dependency('bundler', '>= 1.15')
51
52
  s.add_development_dependency('pronto-rubocop', '~> 0.10.0')
52
53
  s.add_development_dependency('rake', '~> 12.0')
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pronto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.11.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mindaugas Mozūras
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-10-30 00:00:00.000000000 Z
10
+ date: 2025-12-05 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: gitlab
@@ -59,7 +58,7 @@ dependencies:
59
58
  version: 4.7.0
60
59
  - - "<"
61
60
  - !ruby/object:Gem::Version
62
- version: '8.0'
61
+ version: '11.0'
63
62
  type: :runtime
64
63
  prerelease: false
65
64
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,7 +68,21 @@ dependencies:
69
68
  version: 4.7.0
70
69
  - - "<"
71
70
  - !ruby/object:Gem::Version
72
- version: '8.0'
71
+ version: '11.0'
72
+ - !ruby/object:Gem::Dependency
73
+ name: ostruct
74
+ requirement: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ type: :runtime
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
73
86
  - !ruby/object:Gem::Dependency
74
87
  name: rainbow
75
88
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +163,20 @@ dependencies:
150
163
  - - "<"
151
164
  - !ruby/object:Gem::Version
152
165
  version: '2.0'
166
+ - !ruby/object:Gem::Dependency
167
+ name: base64
168
+ requirement: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - "~>"
171
+ - !ruby/object:Gem::Version
172
+ version: 0.1.2
173
+ type: :development
174
+ prerelease: false
175
+ version_requirements: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - "~>"
178
+ - !ruby/object:Gem::Version
179
+ version: 0.1.2
153
180
  - !ruby/object:Gem::Dependency
154
181
  name: bundler
155
182
  requirement: !ruby/object:Gem::Requirement
@@ -324,7 +351,9 @@ extra_rdoc_files:
324
351
  - README.md
325
352
  files:
326
353
  - ".github/CODEOWNERS"
354
+ - ".github/dependabot.yml"
327
355
  - ".github/workflows/pronto.yml"
356
+ - ".github/workflows/push_gem.yml"
328
357
  - ".github/workflows/specs.yml"
329
358
  - CHANGELOG.md
330
359
  - CONTRIBUTING.md
@@ -386,7 +415,6 @@ homepage: https://github.com/prontolabs/pronto
386
415
  licenses:
387
416
  - MIT
388
417
  metadata: {}
389
- post_install_message:
390
418
  rdoc_options: []
391
419
  require_paths:
392
420
  - lib
@@ -401,8 +429,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
401
429
  - !ruby/object:Gem::Version
402
430
  version: '0'
403
431
  requirements: []
404
- rubygems_version: 3.3.15
405
- signing_key:
432
+ rubygems_version: 3.6.2
406
433
  specification_version: 4
407
434
  summary: Pronto runs analysis by checking only the introduced changes
408
435
  test_files: []