Review pull requests using pronto
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 16
- Forks
- 39
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 8
Description
Hello!
I've found [this gem](https://github.com/mmozuras/pronto), which is able to unify the output of multiple static code review services. I already have some contributions to the code and the maintainer was always helpful. This example shows how can a PR reviewed:
``` ruby
#!/bin/env ruby
require 'fileutils'
require 'pronto'
require 'rugged'
require 'pronto/rubocop'
# These two parameters can be extracted from a PR webhook payload
PR_N = 7470
BASE = 'd5b175f'.freeze
REPO = 'manageiq/manageiq'.freeze
TRGT = 'manageiq'.freeze
repo = Rugged::Repository.init_at("tmp/#{TRGT}/")
repo.remotes.create('origin', "https://github.com/#{REPO}.git")
pronto_repo = Pronto::Git::Repository.new("tmp/#{TRGT}")
rugged_repo = pronto_repo.instance_variable_get(:@repo)
rugged_repo.remotes['origin'].fetch("pull/#{PR_N}/head")
rugged_repo.checkout('FETCH_HEAD')
diff = rugged_repo.diff(BASE, rugged_repo.head.target)
patches = Pronto::Git::Patches.new(pronto_repo, BASE, diff)
result = Pronto::Runners.new.run(patches)
formatter = Pronto::Formatter::JsonFormatter.new
formatter.format(result, pronto_repo, patches)
FileUtils.rm_rf("tmp/#{TRGT}")
```
I know that it's not the cleanest code, but it looks way better than our current one :innocent:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the example in the issue, especially the Pronto::Runners and JsonFormatter entry points, then inspect miq_bot's current pull-request review implementation. Adapt the existing flow to use Pronto for reviewing pull requests, with the resulting review output produced through the selected formatter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100