pronto 0.10.0 → 0.11.1
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 +4 -4
- data/.github/CODEOWNERS +3 -0
- data/.github/workflows/pronto.yml +20 -0
- data/.github/workflows/specs.yml +41 -0
- data/CHANGELOG.md +58 -1
- data/README.md +113 -5
- data/lib/pronto/cli.rb +6 -2
- data/lib/pronto/clients/bitbucket_client.rb +46 -18
- data/lib/pronto/config.rb +56 -3
- data/lib/pronto/config_file.rb +8 -2
- data/lib/pronto/formatter/checkstyle_formatter.rb +1 -1
- data/lib/pronto/formatter/formatter.rb +2 -0
- data/lib/pronto/formatter/git_formatter.rb +1 -1
- data/lib/pronto/formatter/github_combined_status_formatter.rb +24 -0
- data/lib/pronto/formatter/github_pull_request_review_formatter.rb +1 -1
- data/lib/pronto/formatter/gitlab_merge_request_review_formatter.rb +29 -0
- data/lib/pronto/formatter/json_formatter.rb +1 -1
- data/lib/pronto/formatter/null_formatter.rb +1 -1
- data/lib/pronto/formatter/text_formatter.rb +1 -1
- data/lib/pronto/git/patch.rb +0 -2
- data/lib/pronto/git/repository.rb +14 -2
- data/lib/pronto/github.rb +25 -11
- data/lib/pronto/gitlab.rb +61 -2
- data/lib/pronto/runner.rb +8 -1
- data/lib/pronto/runners.rb +23 -6
- data/lib/pronto/version.rb +1 -1
- data/lib/pronto.rb +8 -2
- data/pronto.gemspec +9 -7
- metadata +113 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 544591a739632f48bdbe56cc7a006b02a8ce13a22c9fbc679d35a4d5e67a0b00
|
4
|
+
data.tar.gz: 1fee173f0ab873998cc2920a576687a842485509bbef0bd4fc23c03703372d20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b172a79ba57c6319761945212c7d8991adfafb4fdb6a3a91d9dea587a2099859bc5b052e0c54f694a5760b5f98d1a32e146d5811cbaf45d85afbf3c1204526a3
|
7
|
+
data.tar.gz: ea63d5bb296cebc7628af1d1d20a93877cd40ac297954bbe898b7e7b8137482e2c516755c4ea63ef8ca2ee8c60331a39d3c9be6edc4aeab609a816c8ff9bc720
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
name: Pronto
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches: [master]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
pronto:
|
9
|
+
runs-on: ubuntu-20.04
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v3
|
12
|
+
with:
|
13
|
+
fetch-depth: 0
|
14
|
+
- name: Set up Ruby
|
15
|
+
uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: 2.5
|
18
|
+
bundler-cache: true
|
19
|
+
- name: Run Pronto
|
20
|
+
run: bundle exec pronto run --exit-code -c origin/${{ github.base_ref }}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
name: Specs
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [master]
|
6
|
+
pull_request:
|
7
|
+
branches: [master]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-20.04
|
12
|
+
strategy:
|
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"
|
23
|
+
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)
|
25
|
+
steps:
|
26
|
+
- uses: actions/checkout@v3
|
27
|
+
- name: Use specific gitlab gem version (if required)
|
28
|
+
if: matrix.ruby-version == '2.4'
|
29
|
+
run: echo "gem 'gitlab', '< 4.14.1'" >> Gemfile.local
|
30
|
+
- name: Set up Ruby
|
31
|
+
uses: ruby/setup-ruby@v1
|
32
|
+
with:
|
33
|
+
ruby-version: ${{ matrix.ruby-version }}
|
34
|
+
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
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,63 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## 0.11.1
|
4
|
+
|
5
|
+
### New features
|
6
|
+
|
7
|
+
* [#371](https://github.com/prontolabs/pronto/pull/371) allow to filter runners via config
|
8
|
+
* [#402](https://github.com/prontolabs/pronto/pull/402) add --workdir option
|
9
|
+
* [#410](https://github.com/prontolabs/pronto/pull/410) allow the default commit run against to be configured
|
10
|
+
* [#435](https://github.com/prontolabs/pronto/pull/435) allow override of config file path via PRONTO_CONFIG_FILE
|
11
|
+
|
12
|
+
### Bugs fixed
|
13
|
+
|
14
|
+
* [#422](https://github.com/prontolabs/pronto/pull/422) fix Gitlab#slug_regex when URL has different host
|
15
|
+
* [#423](https://github.com/prontolabs/pronto/pull/423) show existing message count when reporting posted messages
|
16
|
+
|
17
|
+
### Changes
|
18
|
+
|
19
|
+
* [#397](https://github.com/prontolabs/pronto/pull/397) migrate CI to GitHub Actions
|
20
|
+
* [#398](https://github.com/prontolabs/pronto/pull/398) fix duplicated runs on GitHub Actions
|
21
|
+
* [#403](https://github.com/prontolabs/pronto/pull/403) run pronto on GitHub Actions without any reporting
|
22
|
+
* [#408](https://github.com/prontolabs/pronto/pull/408) require rexml ~> 3.2.5 due to CVE-2021-28965
|
23
|
+
* [#409](https://github.com/prontolabs/pronto/pull/409) add article about GitHub Actions to README.md
|
24
|
+
* [#414](https://github.com/prontolabs/pronto/pull/414) fix typo in README.md
|
25
|
+
* [#415](https://github.com/prontolabs/pronto/pull/415) remove deprecated pronto-bundler_audit from README.md
|
26
|
+
* [#417](https://github.com/prontolabs/pronto/pull/417) relax rugged dependency to allow releases up to 1.2.0
|
27
|
+
* [#424](https://github.com/prontolabs/pronto/pull/424) add Ruby 3.1 to the test matrix
|
28
|
+
* [#431](https://github.com/prontolabs/pronto/pull/431) relax rugged dependency to allow releases up to 2.0
|
29
|
+
* [#436](https://github.com/prontolabs/pronto/pull/436) update dead links in README.md
|
30
|
+
* [#438](https://github.com/prontolabs/pronto/pull/438) add Ruby 3.2 to the test matrix
|
31
|
+
* [#439](https://github.com/prontolabs/pronto/pull/439) relax dependencies to allow currently released major versions
|
32
|
+
|
33
|
+
## 0.11.0
|
34
|
+
|
35
|
+
### New features
|
36
|
+
|
37
|
+
* [#304](https://github.com/prontolabs/pronto/pull/304) add option to limit comments per PR review
|
38
|
+
* [#333](https://github.com/prontolabs/pronto/pull/333) add github_combined_status formatter
|
39
|
+
* [#334](https://github.com/prontolabs/pronto/pull/334) add configurable review_type for GitHub (with REQUEST_CHANGES as default)
|
40
|
+
* [#351](https://github.com/prontolabs/pronto/pull/351) add gitLab_mr formatter
|
41
|
+
* [#369](https://github.com/prontolabs/pronto/pull/369) make Pronto::Git::Patch#new_file_path public
|
42
|
+
* update to the BitBucket 2.0 API (_as the 1.0 API was deprecated_) via [#347](https://github.com/prontolabs/pronto/pull/347), [#348](https://github.com/prontolabs/pronto/pull/348), [#352](https://github.com/prontolabs/pronto/pull/352) and [#354](https://github.com/prontolabs/pronto/pull/354)
|
43
|
+
|
44
|
+
### Bugs fixed
|
45
|
+
|
46
|
+
* [#344](https://github.com/prontolabs/pronto/pull/344) treat Gemfile and .gemspecs as Ruby
|
47
|
+
* [#380](https://github.com/prontolabs/pronto/pull/380) fix compatibility with rugged >= 0.99
|
48
|
+
* [#387](https://github.com/prontolabs/pronto/pull/387) fix running pronto inside git submodules
|
49
|
+
|
50
|
+
### Changes
|
51
|
+
|
52
|
+
* [#370](https://github.com/prontolabs/pronto/pull/370) allow thor 1.x gem versions
|
53
|
+
* [#379](https://github.com/prontolabs/pronto/pull/379) allow rugged 1.0.x gem versions
|
54
|
+
* [#386](https://github.com/prontolabs/pronto/pull/386) add ruby 2.7 to CI
|
55
|
+
* [#390](https://github.com/prontolabs/pronto/pull/390) fix issue with generating Sorbet RBI
|
56
|
+
* [#396](https://github.com/prontolabs/pronto/pull/396) add support for Ruby 3.0
|
57
|
+
* document/improve GitHub Actions integration in README.md via [#360](https://github.com/prontolabs/pronto/pull/360), [#378](https://github.com/prontolabs/pronto/pull/378) and [#389](https://github.com/prontolabs/pronto/pull/389)
|
58
|
+
* add links to additional pronto runners in README.md
|
59
|
+
|
60
|
+
## 0.10.0
|
4
61
|
|
5
62
|
### New features
|
6
63
|
|
data/README.md
CHANGED
@@ -110,18 +110,40 @@ If you want comments to appear on pull request diff, instead of commit:
|
|
110
110
|
$ PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github_pr -c origin/master
|
111
111
|
```
|
112
112
|
|
113
|
-
If you want review to appear on pull request diff, instead of comments:
|
113
|
+
If you want review to appear on pull request diff, instead of separate comments:
|
114
114
|
|
115
115
|
```sh
|
116
116
|
$ PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github_pr_review -c origin/master
|
117
117
|
```
|
118
118
|
|
119
|
+
All the **N** pending comments will be now separated into **X** number of PR reviews.
|
120
|
+
The number of the PR reviews will be controlled by an additional environment variable or with the help of a config setting.
|
121
|
+
This way, by a single pronto run, all the comments will be published to the PR, but divided into small reviews
|
122
|
+
in order to avoid the rate limit of the providers.
|
123
|
+
|
124
|
+
```
|
125
|
+
X = N / {PRONTO_WARNINGS_PER_REVIEW || warnings_per_review || 30})
|
126
|
+
```
|
127
|
+
|
128
|
+
Note: In case no environment variable or config setting is specified in `.pronto.yml`,
|
129
|
+
a default value of `30` will be used.
|
130
|
+
|
131
|
+
```sh
|
132
|
+
$ PRONTO_WARNINGS_PER_REVIEW=30 PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github_pr_review -c origin/master
|
133
|
+
```
|
134
|
+
|
119
135
|
Use `GithubStatusFormatter` to submit [commit status](https://github.com/blog/1227-commit-status-api):
|
120
136
|
|
121
137
|
```sh
|
122
138
|
$ PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github_status -c origin/master
|
123
139
|
```
|
124
140
|
|
141
|
+
If you want to show a one single status for all runners, instead of status per runner:
|
142
|
+
|
143
|
+
```sh
|
144
|
+
$ PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github_combined_status -c origin/master
|
145
|
+
```
|
146
|
+
|
125
147
|
It's possible to combine multiple formatters.
|
126
148
|
To get both pull request comments and commit status summary use:
|
127
149
|
|
@@ -140,6 +162,39 @@ formatters = [formatter, status_formatter]
|
|
140
162
|
Pronto.run('origin/master', '.', formatters)
|
141
163
|
```
|
142
164
|
|
165
|
+
#### GitHub Actions Integration
|
166
|
+
|
167
|
+
You can also run Pronto as a GitHub action.
|
168
|
+
|
169
|
+
Here's an example `.github/workflows/pronto.yml` workflow file using the `github_status` and `github_pr` formatters and running on each GitHub PR, with `pronto-rubocop` as the runner:
|
170
|
+
|
171
|
+
|
172
|
+
```yml
|
173
|
+
name: Pronto
|
174
|
+
on: [pull_request]
|
175
|
+
|
176
|
+
jobs:
|
177
|
+
pronto:
|
178
|
+
|
179
|
+
runs-on: ubuntu-latest
|
180
|
+
|
181
|
+
steps:
|
182
|
+
- name: Checkout code
|
183
|
+
uses: actions/checkout@v2
|
184
|
+
- run: |
|
185
|
+
git fetch --no-tags --prune --depth=10 origin +refs/heads/*:refs/remotes/origin/*
|
186
|
+
- name: Setup Ruby
|
187
|
+
uses: ruby/setup-ruby@v1
|
188
|
+
- name: Setup pronto
|
189
|
+
run: gem install pronto pronto-rubocop
|
190
|
+
- name: Run Pronto
|
191
|
+
run: pronto run -f github_status github_pr -c origin/${{ github.base_ref }}
|
192
|
+
env:
|
193
|
+
PRONTO_PULL_REQUEST_ID: ${{ github.event.pull_request.number }}
|
194
|
+
PRONTO_GITHUB_ACCESS_TOKEN: "${{ github.token }}"
|
195
|
+
```
|
196
|
+
check Wiki on [GitHub Actions Integration](https://github.com/prontolabs/pronto/wiki/GitHub-Actions-Integration) for more info.
|
197
|
+
|
143
198
|
### GitLab Integration
|
144
199
|
|
145
200
|
You can run Pronto as a step of your CI builds and get the results as comments
|
@@ -159,6 +214,29 @@ Then just run it:
|
|
159
214
|
$ PRONTO_GITLAB_API_PRIVATE_TOKEN=token pronto run -f gitlab -c origin/master
|
160
215
|
```
|
161
216
|
|
217
|
+
**note: this requires at least Gitlab 11.6+**
|
218
|
+
|
219
|
+
Merge request integration:
|
220
|
+
|
221
|
+
```sh
|
222
|
+
$ PRONTO_GITLAB_API_PRIVATE_TOKEN=token PRONTO_PULL_REQUEST_ID=id pronto run -f gitlab_mr -c origin/master
|
223
|
+
```
|
224
|
+
|
225
|
+
On GitLabCI, make sure to run Pronto in a [merge request pipeline](https://docs.gitlab.com/ce/ci/merge_request_pipelines/):
|
226
|
+
|
227
|
+
```yml
|
228
|
+
lint:
|
229
|
+
image: ruby
|
230
|
+
variables:
|
231
|
+
PRONTO_GITLAB_API_ENDPOINT: "https://gitlab.com/api/v4"
|
232
|
+
PRONTO_GITLAB_API_PRIVATE_TOKEN: token
|
233
|
+
only:
|
234
|
+
- merge_requests
|
235
|
+
script:
|
236
|
+
- bundle install
|
237
|
+
- bundle exec pronto run -f gitlab_mr -c origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
|
238
|
+
```
|
239
|
+
|
162
240
|
### Bitbucket Integration
|
163
241
|
|
164
242
|
You can run Pronto as a step of your CI builds and get the results as comments
|
@@ -183,7 +261,14 @@ $ PRONTO_BITBUCKET_USERNAME=user PRONTO_BITBUCKET_PASSWORD=pass pronto run -f bi
|
|
183
261
|
## Configuration
|
184
262
|
|
185
263
|
The behavior of Pronto can be controlled via the `.pronto.yml` configuration
|
186
|
-
file. It
|
264
|
+
file. It can either be placed in the working directory (*) or specified using
|
265
|
+
the environment variable `PRONTO_CONFIG_FILE`.
|
266
|
+
|
267
|
+
(*) The working directory is where you run the command from, which is typically
|
268
|
+
your project directory.
|
269
|
+
|
270
|
+
If this file cannot be found, then the default configuration in
|
271
|
+
[Pronto::ConfigFile::EMPTY](lib/pronto/config_file.rb) applies.
|
187
272
|
|
188
273
|
The file has the following format:
|
189
274
|
|
@@ -210,7 +295,10 @@ bitbucket:
|
|
210
295
|
password: pass
|
211
296
|
web_endpoint: https://bitbucket.org/
|
212
297
|
max_warnings: 150
|
298
|
+
warnings_per_review: 30
|
213
299
|
verbose: false
|
300
|
+
runners: [rubocop, eslint] # only listed runners will be executed
|
301
|
+
skip_runners: [reek] # all, except listed runners will be executed
|
214
302
|
```
|
215
303
|
|
216
304
|
All properties that can be specified via `.pronto.yml`, can also be specified
|
@@ -218,6 +306,14 @@ via environment variables. Their names will be the upcased path to the property.
|
|
218
306
|
For example: `PRONTO_GITHUB_SLUG` or `PRONTO_GITLAB_API_PRIVATE_TOKEN`. Environment variables
|
219
307
|
will always take precedence over values in configuration file.
|
220
308
|
|
309
|
+
| Property | Description |
|
310
|
+
|-----------------------|--------------------------------------------------------------------------------------|
|
311
|
+
| `max_warnings` | Limits the amount of warnings. Returns all warnings if option is skipped. |
|
312
|
+
| `runners` | Runs only listed runners. Runs everything if option is skipped. |
|
313
|
+
| `skip_runners` | All, except listed runners will be executed. Runs everything if option is skipped. |
|
314
|
+
| `verbose` | Outputs more information when set to `true`. |
|
315
|
+
| `warnings_per_review` | Limits the amount of warnings per review. Returns all warnings if option is skipped. |
|
316
|
+
|
221
317
|
### Message format
|
222
318
|
|
223
319
|
Pronto allows you to configure the format of the messages that are produced. You
|
@@ -260,13 +356,16 @@ The following values are available only to the text formatter:
|
|
260
356
|
Pronto can run various tools and libraries, as long as there's a runner for it.
|
261
357
|
Currently available:
|
262
358
|
|
359
|
+
* [pronto-bigfiles](https://github.com/apiology/pronto-bigfiles)
|
263
360
|
* [pronto-blacklist](https://github.com/pbstriker38/pronto-blacklist)
|
264
361
|
* [pronto-brakeman](https://github.com/prontolabs/pronto-brakeman)
|
362
|
+
* [pronto-checkstyle](https://github.com/seikichi/pronto-checkstyle)
|
265
363
|
* [pronto-coffeelint](https://github.com/siebertm/pronto-coffeelint)
|
266
364
|
* [pronto-clang_format](https://github.com/micjabbour/pronto-clang_format)
|
267
365
|
* [pronto-clang_tidy](https://github.com/micjabbour/pronto-clang_tidy)
|
268
366
|
* [pronto-clippy](https://github.com/hauleth/pronto-clippy)
|
269
367
|
* [pronto-credo](https://github.com/carakan/pronto-credo)
|
368
|
+
* [pronto-dialyxir](https://github.com/Apelsinka223/pronto-dialyxir)
|
270
369
|
* [pronto-dialyzer](https://github.com/iurifq/pronto-dialyzer)
|
271
370
|
* [pronto-dirty_words](https://github.com/kevinjalbert/pronto-dirty_words)
|
272
371
|
* [pronto-dogma](https://github.com/iurifq/pronto-dogma)
|
@@ -274,11 +373,15 @@ Currently available:
|
|
274
373
|
* [pronto-eslint](https://github.com/prontolabs/pronto-eslint) (uses [eslintrb](https://github.com/zendesk/eslintrb))
|
275
374
|
* [pronto-eslint_npm](https://github.com/doits/pronto-eslint_npm) (uses eslint installed from npm)
|
276
375
|
* [pronto-fasterer](https://github.com/prontolabs/pronto-fasterer)
|
376
|
+
* [pronto-findbugs](https://github.com/seikichi/pronto-findbugs)
|
277
377
|
* [pronto-flake8](https://github.com/scoremedia/pronto-flake8)
|
278
378
|
* [pronto-flay](https://github.com/prontolabs/pronto-flay)
|
279
379
|
* [pronto-flow](https://github.com/kevinjalbert/pronto-flow)
|
280
380
|
* [pronto-foodcritic](https://github.com/prontolabs/pronto-foodcritic)
|
381
|
+
* [pronto-goodcheck](https://github.com/aergonaut/pronto-goodcheck)
|
281
382
|
* [pronto-haml](https://github.com/prontolabs/pronto-haml)
|
383
|
+
* [pronto-hlint](https://github.com/fretlink/pronto-hlint/) (uses Haskell code suggestions [hlint](https://github.com/ndmitchell/hlint))
|
384
|
+
* [pronto-infer](https://github.com/seikichi/pronto-infer)
|
282
385
|
* [pronto-inspec](https://github.com/stiller-leser/pronto-inspec)
|
283
386
|
* [pronto-jscs](https://github.com/spajus/pronto-jscs)
|
284
387
|
* [pronto-jshint](https://github.com/prontolabs/pronto-jshint)
|
@@ -289,7 +392,9 @@ Currently available:
|
|
289
392
|
* [pronto-phpmd](https://github.com/EllisV/pronto-phpmd)
|
290
393
|
* [pronto-phpstan](https://github.com/Powerhamster/pronto-phpstan)
|
291
394
|
* [pronto-poper](https://github.com/prontolabs/pronto-poper)
|
395
|
+
* [pronto-punchlist](https://github.com/apiology/pronto-punchlist)
|
292
396
|
* [pronto-rails_best_practices](https://github.com/prontolabs/pronto-rails_best_practices)
|
397
|
+
* [pronto-rails_data_schema](https://github.com/mbajur/pronto-rails_data_schema)
|
293
398
|
* [pronto-rails_schema](https://github.com/raimondasv/pronto-rails_schema)
|
294
399
|
* [pronto-reek](https://github.com/prontolabs/pronto-reek)
|
295
400
|
* [pronto-rubocop](https://github.com/prontolabs/pronto-rubocop)
|
@@ -297,15 +402,17 @@ Currently available:
|
|
297
402
|
* [pronto-shellcheck](https://github.com/pclalv/pronto-shellcheck)
|
298
403
|
* [pronto-slim](https://github.com/nysthee/pronto-slim)
|
299
404
|
* [pronto-slim_lint](https://github.com/ibrahima/pronto-slim_lint)
|
405
|
+
* [pronto-sorbet](https://github.com/teamsimplepay/pronto-sorbet)
|
300
406
|
* [pronto-spell](https://github.com/prontolabs/pronto-spell)
|
407
|
+
* [pronto-standardrb](https://github.com/julianrubisch/pronto-standardrb)
|
301
408
|
* [pronto-stylelint](https://github.com/kevinjalbert/pronto-stylelint)
|
302
409
|
* [pronto-swiftlint](https://github.com/ajanauskas/pronto-swiftlint)
|
303
410
|
* [pronto-tailor](https://github.com/ajanauskas/pronto-tailor)
|
304
411
|
* [pronto-textlint](https://github.com/seikichi/pronto-textlint)
|
305
412
|
* [pronto-tslint_npm](https://github.com/eprislac/pronto-tslint_npm)
|
306
413
|
* [pronto-yamllint](https://github.com/pauliusm/pronto-yamllint)
|
307
|
-
* [pronto-goodcheck](https://github.com/aergonaut/pronto-goodcheck)
|
308
414
|
* [pronto-undercover](https://github.com/grodowski/pronto-undercover)
|
415
|
+
* [pronto-xmllint](https://github.com/pauliusm/pronto-xmllint)
|
309
416
|
|
310
417
|
## Articles
|
311
418
|
|
@@ -319,12 +426,13 @@ Articles to help you to get started:
|
|
319
426
|
* [How to end fruitless dev discussions about your project’s code style?](https://medium.com/appaloosa-store-engineering/how-to-end-fruitless-dev-discussions-about-your-project-s-code-style-245070bff6d4)
|
320
427
|
* [Free automated code reviews using Pronto](https://hovancik.net/blog/2016/04/11/free-automated-code-reviews-using-pronto/)
|
321
428
|
* [Automated Elixir code review with Github, Credo and Travis CI](https://medium.com/fazibear/automated-elixir-code-review-with-github-credo-and-travis-ci-986cd56b8f02)
|
322
|
-
* [Running Rubocop before git commit](https://christoph.luppri.ch/articles/
|
429
|
+
* [Running Rubocop before git commit](https://web.archive.org/web/20181225040512/https://christoph.luppri.ch/articles/code-quality/running-rubocop-before-git-commit/)
|
323
430
|
* [Pronto, Codeship and GitHub for automatic code review](http://abinoam.tl1n.com/pronto-codeship-and-github-for-automatic-code-review/)
|
324
|
-
* [How to automatically review your PRs for style violations with Pronto and RuboCop](https://christoph.luppri.ch/
|
431
|
+
* [How to automatically review your PRs for style violations with Pronto and RuboCop](https://christoph.luppri.ch/how-to-automatically-review-your-prs-for-style-violations-with-pronto-and-rubocop)
|
325
432
|
* [Create your own Pronto Runner](https://kevinjalbert.com/create-your-own-pronto-runner/)
|
326
433
|
* [Make Code Reviews A Little Bit Better With Automation](https://medium.com/jimmy-farrell/make-codes-reviews-a-little-bit-better-with-automation-35640df08a62)
|
327
434
|
* [Stop shipping untested Ruby code with undercover](https://medium.com/futuredev/stop-shipping-untested-ruby-code-with-undercover-1edc963be4a6)
|
435
|
+
* [Automatic code review with Pronto and GitHub Actions](https://everydayrails.com/2021/05/29/pronto-github-actions-code-quality.html)
|
328
436
|
|
329
437
|
Make a Pull Request to add something you wrote or found useful.
|
330
438
|
|
data/lib/pronto/cli.rb
CHANGED
@@ -20,7 +20,6 @@ module Pronto
|
|
20
20
|
|
21
21
|
method_option :commit,
|
22
22
|
type: :string,
|
23
|
-
default: 'master',
|
24
23
|
aliases: '-c',
|
25
24
|
desc: 'Commit for the diff'
|
26
25
|
|
@@ -33,6 +32,11 @@ module Pronto
|
|
33
32
|
type: :boolean,
|
34
33
|
desc: 'Analyze changes in git staging area'
|
35
34
|
|
35
|
+
method_option :workdir,
|
36
|
+
type: :boolean,
|
37
|
+
aliases: ['-w'],
|
38
|
+
desc: 'Analyze both staged and unstaged changes'
|
39
|
+
|
36
40
|
method_option :runner,
|
37
41
|
type: :array,
|
38
42
|
default: [],
|
@@ -55,7 +59,7 @@ module Pronto
|
|
55
59
|
|
56
60
|
formatters = ::Pronto::Formatter.get(options[:formatters])
|
57
61
|
|
58
|
-
commit_options = %i[staged unstaged index]
|
62
|
+
commit_options = %i[workdir staged unstaged index]
|
59
63
|
commit = commit_options.find { |o| options[o] } || options[:commit]
|
60
64
|
|
61
65
|
repo_workdir = ::Rugged::Repository.discover(path).workdir
|
@@ -1,28 +1,39 @@
|
|
1
1
|
class BitbucketClient
|
2
2
|
include HTTParty
|
3
|
-
base_uri 'https://api.bitbucket.org/
|
3
|
+
base_uri 'https://api.bitbucket.org/2.0/repositories'
|
4
4
|
|
5
5
|
def initialize(username, password)
|
6
6
|
self.class.basic_auth(username, password)
|
7
7
|
end
|
8
8
|
|
9
9
|
def commit_comments(slug, sha)
|
10
|
-
response = get("/#{slug}/
|
11
|
-
openstruct(response)
|
10
|
+
response = get("/#{slug}/commit/#{sha}/comments?pagelen=100")
|
11
|
+
result = parse_comments(openstruct(response))
|
12
|
+
while (response['next'])
|
13
|
+
response = get response['next']
|
14
|
+
result.concat(parse_comments(openstruct(response)))
|
15
|
+
end
|
16
|
+
result
|
12
17
|
end
|
13
18
|
|
14
19
|
def create_commit_comment(slug, sha, body, path, position)
|
15
|
-
post("/#{slug}/
|
20
|
+
post("/#{slug}/commit/#{sha}/comments", body, path, position)
|
16
21
|
end
|
17
22
|
|
18
23
|
def pull_comments(slug, pull_id)
|
19
|
-
response = get("/#{slug}/pullrequests/#{pull_id}/comments")
|
20
|
-
openstruct(response)
|
24
|
+
response = get("/#{slug}/pullrequests/#{pull_id}/comments?pagelen=100")
|
25
|
+
parse_comments(openstruct(response))
|
26
|
+
result = parse_comments(openstruct(response))
|
27
|
+
while (response['next'])
|
28
|
+
response = get response['next']
|
29
|
+
result.concat(parse_comments(openstruct(response)))
|
30
|
+
end
|
31
|
+
result
|
21
32
|
end
|
22
33
|
|
23
34
|
def pull_requests(slug)
|
24
|
-
response = get("
|
25
|
-
openstruct(response
|
35
|
+
response = get("/#{slug}/pullrequests?state=OPEN")
|
36
|
+
openstruct(response)
|
26
37
|
end
|
27
38
|
|
28
39
|
def create_pull_comment(slug, pull_id, body, path, position)
|
@@ -30,29 +41,46 @@ class BitbucketClient
|
|
30
41
|
end
|
31
42
|
|
32
43
|
def approve_pull_request(slug, pull_id)
|
33
|
-
self.class.post("
|
44
|
+
self.class.post("/#{slug}/pullrequests/#{pull_id}/approve")
|
34
45
|
end
|
35
46
|
|
36
47
|
def unapprove_pull_request(slug, pull_id)
|
37
|
-
self.class.delete("
|
48
|
+
self.class.delete("/#{slug}/pullrequests/#{pull_id}/approve")
|
38
49
|
end
|
39
50
|
|
40
51
|
private
|
41
52
|
|
42
|
-
def pull_request_api(slug)
|
43
|
-
"https://api.bitbucket.org/2.0/repositories/#{slug}"
|
44
|
-
end
|
45
|
-
|
46
53
|
def openstruct(response)
|
47
|
-
response
|
54
|
+
if response['values']
|
55
|
+
response['values'].map { |r| OpenStruct.new(r) }
|
56
|
+
else
|
57
|
+
p response
|
58
|
+
raise 'BitBucket response invalid'
|
59
|
+
end
|
48
60
|
end
|
49
61
|
|
62
|
+
def parse_comments(values)
|
63
|
+
values.each do |value|
|
64
|
+
value.content = value.content['raw']
|
65
|
+
value.line_to = value.inline ? value.inline['to'] : 0
|
66
|
+
value.filename = value.inline ? value.inline['path'] : ''
|
67
|
+
end
|
68
|
+
values
|
69
|
+
end
|
70
|
+
|
50
71
|
def post(url, body, path, position)
|
51
72
|
options = {
|
52
73
|
body: {
|
53
|
-
content:
|
54
|
-
|
55
|
-
|
74
|
+
content: {
|
75
|
+
raw: body
|
76
|
+
},
|
77
|
+
inline: {
|
78
|
+
to: position,
|
79
|
+
path: path
|
80
|
+
}
|
81
|
+
}.to_json,
|
82
|
+
headers: {
|
83
|
+
'Content-Type': 'application/json'
|
56
84
|
}
|
57
85
|
}
|
58
86
|
self.class.post(url, options)
|
data/lib/pronto/config.rb
CHANGED
@@ -11,6 +11,13 @@ module Pronto
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
def default_commit
|
15
|
+
default_commit =
|
16
|
+
ENV['PRONTO_DEFAULT_COMMIT'] ||
|
17
|
+
@config_hash.fetch('default_commit', 'master')
|
18
|
+
default_commit
|
19
|
+
end
|
20
|
+
|
14
21
|
def consolidate_comments?
|
15
22
|
consolidated =
|
16
23
|
ENV['PRONTO_CONSOLIDATE_COMMENTS'] ||
|
@@ -18,6 +25,18 @@ module Pronto
|
|
18
25
|
consolidated
|
19
26
|
end
|
20
27
|
|
28
|
+
def github_review_type
|
29
|
+
review_type =
|
30
|
+
ENV['PRONTO_GITHUB_REVIEW_TYPE'] ||
|
31
|
+
@config_hash.fetch('github_review_type', false)
|
32
|
+
|
33
|
+
if review_type == 'request_changes'
|
34
|
+
'REQUEST_CHANGES'
|
35
|
+
else
|
36
|
+
'COMMENT'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
21
40
|
def excluded_files(runner)
|
22
41
|
files =
|
23
42
|
if runner == 'all'
|
@@ -39,8 +58,12 @@ module Pronto
|
|
39
58
|
URI.parse(bitbucket_web_endpoint).host
|
40
59
|
end
|
41
60
|
|
61
|
+
def warnings_per_review
|
62
|
+
fetch_integer('warnings_per_review')
|
63
|
+
end
|
64
|
+
|
42
65
|
def max_warnings
|
43
|
-
|
66
|
+
fetch_integer('max_warnings')
|
44
67
|
end
|
45
68
|
|
46
69
|
def message_format(formatter)
|
@@ -48,15 +71,45 @@ module Pronto
|
|
48
71
|
if formatter_config && formatter_config.key?('format')
|
49
72
|
formatter_config['format']
|
50
73
|
else
|
51
|
-
|
74
|
+
fetch_value('format')
|
52
75
|
end
|
53
76
|
end
|
54
77
|
|
78
|
+
def skip_runners
|
79
|
+
fetch_list('skip_runners')
|
80
|
+
end
|
81
|
+
|
82
|
+
def runners
|
83
|
+
fetch_list('runners')
|
84
|
+
end
|
85
|
+
|
55
86
|
def logger
|
56
87
|
@logger ||= begin
|
57
|
-
verbose =
|
88
|
+
verbose = fetch_value('verbose')
|
58
89
|
verbose ? Logger.new($stdout) : Logger.silent
|
59
90
|
end
|
60
91
|
end
|
92
|
+
|
93
|
+
private
|
94
|
+
|
95
|
+
def fetch_integer(key)
|
96
|
+
full_key = env_key(key)
|
97
|
+
|
98
|
+
(ENV[full_key] && Integer(ENV[full_key])) || @config_hash[key]
|
99
|
+
end
|
100
|
+
|
101
|
+
def fetch_value(key)
|
102
|
+
ENV[env_key(key)] || @config_hash[key]
|
103
|
+
end
|
104
|
+
|
105
|
+
def env_key(key)
|
106
|
+
"PRONTO_#{key.upcase}"
|
107
|
+
end
|
108
|
+
|
109
|
+
def fetch_list(key)
|
110
|
+
Array(fetch_value(key)).flat_map do |runners|
|
111
|
+
runners.split(',')
|
112
|
+
end
|
113
|
+
end
|
61
114
|
end
|
62
115
|
end
|
data/lib/pronto/config_file.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Pronto
|
2
2
|
class ConfigFile
|
3
3
|
DEFAULT_MESSAGE_FORMAT = '%{msg}'.freeze
|
4
|
+
DEFAULT_WARNINGS_PER_REVIEW = 30
|
4
5
|
|
5
6
|
EMPTY = {
|
6
7
|
'all' => {
|
@@ -11,7 +12,8 @@ module Pronto
|
|
11
12
|
'slug' => nil,
|
12
13
|
'access_token' => nil,
|
13
14
|
'api_endpoint' => 'https://api.github.com/',
|
14
|
-
'web_endpoint' => 'https://github.com/'
|
15
|
+
'web_endpoint' => 'https://github.com/',
|
16
|
+
'review_type' => 'request_changes'
|
15
17
|
},
|
16
18
|
'gitlab' => {
|
17
19
|
'slug' => nil,
|
@@ -29,14 +31,18 @@ module Pronto
|
|
29
31
|
'text' => {
|
30
32
|
'format' => '%{color_location} %{color_level}: %{msg}'
|
31
33
|
},
|
34
|
+
'default_commit' => 'master',
|
32
35
|
'runners' => [],
|
33
36
|
'formatters' => [],
|
34
37
|
'max_warnings' => nil,
|
38
|
+
'warnings_per_review' => DEFAULT_WARNINGS_PER_REVIEW,
|
35
39
|
'verbose' => false,
|
36
40
|
'format' => DEFAULT_MESSAGE_FORMAT
|
37
41
|
}.freeze
|
38
42
|
|
39
|
-
|
43
|
+
attr_reader :path
|
44
|
+
|
45
|
+
def initialize(path = ENV.fetch('PRONTO_CONFIG_FILE', '.pronto.yml'))
|
40
46
|
@path = path
|
41
47
|
end
|
42
48
|
|
@@ -13,9 +13,11 @@ module Pronto
|
|
13
13
|
FORMATTERS = {
|
14
14
|
'github' => GithubFormatter,
|
15
15
|
'github_status' => GithubStatusFormatter,
|
16
|
+
'github_combined_status' => GithubCombinedStatusFormatter,
|
16
17
|
'github_pr' => GithubPullRequestFormatter,
|
17
18
|
'github_pr_review' => GithubPullRequestReviewFormatter,
|
18
19
|
'gitlab' => GitlabFormatter,
|
20
|
+
'gitlab_mr' => GitlabMergeRequestReviewFormatter,
|
19
21
|
'bitbucket' => BitbucketFormatter,
|
20
22
|
'bitbucket_pr' => BitbucketPullRequestFormatter,
|
21
23
|
'bitbucket_server_pr' => BitbucketServerPullRequestFormatter,
|