pronto 0.11.2 → 0.11.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc92d09f9dae20d0ddfb42faca81ab52258623f2014a5c0a736466f443996b00
4
- data.tar.gz: 1d1c524e047a717e33d11f993d3e6fa6fc5b4103e9b75b1ae8c1275d7404394b
3
+ metadata.gz: 732010892d29212f2dd3efcc0930c85e0f585ffa4ed072a0f377b1d008c0f468
4
+ data.tar.gz: 68a2c7447c850429aaaf19bd3cf6d51e01c2364b9528eb77493489a3606be1c9
5
5
  SHA512:
6
- metadata.gz: 73d534c7929826919482802d0630f73a566e4525a2ffef4fe3a8f9ff1acce051b7dfbe77a01835ba483e6a5d977ddb39b18f455b832773e6e3e32ac9358b9f5a
7
- data.tar.gz: 7c9f9c8ecaa21d3d1860c9da8ddebcfcf61d88deff3717b599c3fd65a0623c33ec76f99f34bd773f0f5d3832129295531c8d7e10ccb205b4714f809a6fc906d8
6
+ metadata.gz: 9b612b2f8edb11d70236daad92523076697bf389ad31129a0957fb8d84291c7e92516054f2441208ea1b88192c8ad7d58ef7c0a917e6a75931e79e3b9f116f67
7
+ data.tar.gz: 10f3c215e33277d1d01ac7a9877c34f3a2439e61e5426289fdb95ba709640beaa0db06e7d3169112c5fdae5704fa1c1634cf1959839c555cd2106350b67f9412
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: 'github-actions'
4
+ directory: '/'
5
+ schedule:
6
+ interval: 'weekly'
@@ -8,7 +8,7 @@ jobs:
8
8
  pronto:
9
9
  runs-on: ubuntu-20.04
10
10
  steps:
11
- - uses: actions/checkout@v3
11
+ - uses: actions/checkout@v4
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-latest
15
+
16
+ permissions:
17
+ contents: write
18
+ id-token: write
19
+
20
+ steps:
21
+ - uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
22
+ with:
23
+ egress-policy: audit
24
+
25
+ - uses: actions/checkout@cbb722410c2e876e24abbe8de2cc27693e501dcb # v4.2.2
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@a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1.1.1
@@ -11,29 +11,21 @@ jobs:
11
11
  runs-on: ubuntu-20.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@v4
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
27
  - name: Test & publish code coverage
36
- uses: paambaati/codeclimate-action@7bcf9e73c0ee77d178e72c0ec69f1a99c1afc1f3 # v2.7.5
28
+ uses: paambaati/codeclimate-action@f429536ee076d758a24705203199548125a28ca7 # v9.0.0
37
29
  env:
38
30
  CC_TEST_REPORTER_ID: 3d676246ffa66d3fdef6253a9870431b1a2da04e9ecb25486c08a38823c37b6a
39
31
  COVERAGE: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 0.11.3
6
+
7
+ ### Changes
8
+
9
+ * [#455](https://github.com/prontolabs/pronto/pull/455) compatibility fixes for supporting octokit 8.x
10
+ * [#460](https://github.com/prontolabs/pronto/pull/460) improve documentation for Gitlab CI integration
11
+ * [#462](https://github.com/prontolabs/pronto/pull/462) more doc improvements for Gitlab CI integration
12
+ * [#466](https://github.com/prontolabs/pronto/pull/466) relax octokit dependency to allow 9.x releases
13
+
3
14
  ## 0.11.2
4
15
 
5
16
  ### Changes
data/README.md CHANGED
@@ -1,10 +1,8 @@
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)
5
+ [![Code Climate](https://codeclimate.com/github/prontolabs/pronto.svg)](https://codeclimate.com/github/prontolabs/pronto)
8
6
 
9
7
  **Pronto** runs analysis quickly by checking only the relevant changes. Created to
10
8
  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 +11,7 @@ to your [styleguide](https://github.com/prontolabs/pronto-rubocop), [are DRY](ht
13
11
 
14
12
  ![Pronto demo](pronto.gif "")
15
13
 
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)._
14
+ _This README might be ahead of the latest release. Find the README for v0.11.3 [here](https://github.com/prontolabs/pronto/blob/v0.11.3/README.md)._
17
15
 
18
16
  * [Installation](#installation)
19
17
  * [Usage](#usage)
@@ -226,17 +224,26 @@ On GitLabCI, make sure to run Pronto in a [merge request pipeline](https://docs.
226
224
 
227
225
  ```yml
228
226
  lint:
229
- image: ruby
227
+ image: ruby:3.3.0 # change to your app's ruby version
230
228
  variables:
231
- PRONTO_GITLAB_API_ENDPOINT: "https://gitlab.com/api/v4"
232
- PRONTO_GITLAB_API_PRIVATE_TOKEN: token
229
+ PRONTO_GITLAB_API_ENDPOINT: "$CI_API_V4_URL" # this already contains the correct url for your GitLab instance
230
+ 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
231
+
232
+ # Without this variable, GitLab only fetches with git depth set to a fixed amount (by default 20 on newer projects, 50 on older ones).
233
+ # This would make pronto fail with the errror "revspec 'origin/{target_branch}", because it would not know of the target Branch.
234
+ # 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.
235
+ GIT_DEPTH: 0
233
236
  only:
234
237
  - merge_requests
235
238
  script:
239
+ - apt-get update && apt-get install -y cmake # Install cmake required for rugged gem (Pronto depends on it)
236
240
  - bundle install
241
+ # Run pronto on branch of current merge request, comparing to the merge requests target branch
237
242
  - bundle exec pronto run -f gitlab_mr -c origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
238
243
  ```
239
244
 
245
+
246
+
240
247
  ### Bitbucket Integration
241
248
 
242
249
  You can run Pronto as a step of your CI builds and get the results as comments
@@ -433,6 +440,7 @@ Articles to help you to get started:
433
440
  * [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
441
  * [Stop shipping untested Ruby code with undercover](https://medium.com/futuredev/stop-shipping-untested-ruby-code-with-undercover-1edc963be4a6)
435
442
  * [Automatic code review with Pronto and GitHub Actions](https://everydayrails.com/2021/05/29/pronto-github-actions-code-quality.html)
443
+ * [Integrate Pronto with Gitlab CI for Rails App](https://prabinpoudel.com.np/articles/integrate-pronto-with-gitlab-ci-for-rails-app/)
436
444
 
437
445
  Make a Pull Request to add something you wrote or found useful.
438
446
 
@@ -442,4 +450,4 @@ Make a Pull Request to add something you wrote or found useful.
442
450
 
443
451
  ## Copyright
444
452
 
445
- Copyright (c) 2013-2018 Mindaugas Mozūras. See [LICENSE](LICENSE) for further details.
453
+ Copyright (c) 2013-2025 Mindaugas Mozūras. See [LICENSE](LICENSE) for further details.
@@ -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.3'.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,12 @@ 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', '< 10.0')
46
45
  s.add_runtime_dependency('rainbow', '>= 2.2', '< 4.0')
47
46
  s.add_runtime_dependency('rexml', '>= 3.2.5', '< 4.0')
48
47
  s.add_runtime_dependency('rugged', '>= 0.23.0', '< 2.0')
49
48
  s.add_runtime_dependency('thor', '>= 0.20.3', '< 2.0')
49
+ s.add_development_dependency('base64', '~> 0.1.2')
50
50
  s.add_development_dependency('bundler', '>= 1.15')
51
51
  s.add_development_dependency('pronto-rubocop', '~> 0.10.0')
52
52
  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.3
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-01-11 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: '10.0'
63
62
  type: :runtime
64
63
  prerelease: false
65
64
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,7 +68,7 @@ dependencies:
69
68
  version: 4.7.0
70
69
  - - "<"
71
70
  - !ruby/object:Gem::Version
72
- version: '8.0'
71
+ version: '10.0'
73
72
  - !ruby/object:Gem::Dependency
74
73
  name: rainbow
75
74
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +149,20 @@ dependencies:
150
149
  - - "<"
151
150
  - !ruby/object:Gem::Version
152
151
  version: '2.0'
152
+ - !ruby/object:Gem::Dependency
153
+ name: base64
154
+ requirement: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: 0.1.2
159
+ type: :development
160
+ prerelease: false
161
+ version_requirements: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - "~>"
164
+ - !ruby/object:Gem::Version
165
+ version: 0.1.2
153
166
  - !ruby/object:Gem::Dependency
154
167
  name: bundler
155
168
  requirement: !ruby/object:Gem::Requirement
@@ -324,7 +337,9 @@ extra_rdoc_files:
324
337
  - README.md
325
338
  files:
326
339
  - ".github/CODEOWNERS"
340
+ - ".github/dependabot.yml"
327
341
  - ".github/workflows/pronto.yml"
342
+ - ".github/workflows/push_gem.yml"
328
343
  - ".github/workflows/specs.yml"
329
344
  - CHANGELOG.md
330
345
  - CONTRIBUTING.md
@@ -386,7 +401,6 @@ homepage: https://github.com/prontolabs/pronto
386
401
  licenses:
387
402
  - MIT
388
403
  metadata: {}
389
- post_install_message:
390
404
  rdoc_options: []
391
405
  require_paths:
392
406
  - lib
@@ -401,8 +415,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
401
415
  - !ruby/object:Gem::Version
402
416
  version: '0'
403
417
  requirements: []
404
- rubygems_version: 3.3.15
405
- signing_key:
418
+ rubygems_version: 3.6.2
406
419
  specification_version: 4
407
420
  summary: Pronto runs analysis by checking only the introduced changes
408
421
  test_files: []