prontolabs / pronto Goto Github PK
View Code? Open in Web Editor NEWQuick automated code review of your changes
License: MIT License
Quick automated code review of your changes
License: MIT License
The idea would be to have commands like rackup
(with a config.ru
file) or pronto server
or pronto watch
. This micro server would listen to Github webhooks when PR events happen, and analyze the PR.
This would allow people to easily have their own free version of https://houndci.com by deploying it to a free Heroku dyno or any other server. This also has the advantage of being independent from a CI server and it does not require too much effort to give it a spin.
I do not know if this is in the scope of the pronto project though. This small 60-lines Sinatra server I wrote basically just wraps pronto, so I was thinking it would not be too much effort to integrate it in this project. The server works quite well, it is on a free Heroky dyno and we use it every day at my job.
If this is not in the scope of this project and these kinds of servers should be independent, please close this enhancement request. If it is, I could maybe find some time to make a PR (although I do not guarantee anything).
When running pronto with github formatter it crashes after first comment. When GITHUB_ACCESS_TOKEN
is missing, there's the same error but without comment on PR.
Installed runners as gems (i.e. not within Gemfile):
Backtrace:
$ GITHUB_ACCESS_TOKEN='...' pronto run -f github
.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http/response.rb:350:in `initialize': stream error (Zlib::StreamError)
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http/response.rb:350:in `new'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http/response.rb:350:in `initialize'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http/response.rb:257:in `new'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http/response.rb:257:in `inflater'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http/response.rb:274:in `read_body_0'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http/response.rb:201:in `read_body'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1127:in `block in get'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1413:in `block (2 levels) in transport_request'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http/response.rb:162:in `reading_body'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1412:in `block in transport_request'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1403:in `catch'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1403:in `transport_request'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1376:in `request'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1369:in `block in request'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:852:in `start'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1367:in `request'
from .rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1126:in `get'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/faraday-0.9.0/lib/faraday/adapter/net_http.rb:78:in `perform_request'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/faraday-0.9.0/lib/faraday/adapter/net_http.rb:39:in `call'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/faraday-0.9.0/lib/faraday/response.rb:8:in `call'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/faraday-0.9.0/lib/faraday/response.rb:8:in `call'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/faraday-0.9.0/lib/faraday/rack_builder.rb:139:in `build_response'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/faraday-0.9.0/lib/faraday/connection.rb:377:in `run_request'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/faraday-0.9.0/lib/faraday/connection.rb:140:in `get'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/sawyer-0.5.3/lib/sawyer/agent.rb:94:in `call'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/octokit-2.7.1/lib/octokit/client.rb:257:in `request'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/octokit-2.7.1/lib/octokit/client.rb:129:in `get'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/octokit-2.7.1/lib/octokit/client/commit_comments.rb:25:in `commit_comments'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/pronto-0.2.4/lib/pronto/formatter/github_formatter.rb:23:in `create_comment'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/pronto-0.2.4/lib/pronto/formatter/github_formatter.rb:14:in `block in format'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/pronto-0.2.4/lib/pronto/formatter/github_formatter.rb:7:in `map'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/pronto-0.2.4/lib/pronto/formatter/github_formatter.rb:7:in `format'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/pronto-0.2.4/lib/pronto.rb:30:in `run'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/pronto-0.2.4/lib/pronto/cli.rb:42:in `run'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from .rvm/gems/ruby-2.0.0-p247@gemset/gems/pronto-0.2.4/bin/pronto:6:in `<top (required)>'
from .rvm/gems/ruby-2.0.0-p247@gemset/bin/pronto:23:in `load'
from .rvm/gems/ruby-2.0.0-p247@gemset/bin/pronto:23:in `<main>'
When i need run pronto to my own gitlab with ssl self-signed, i get:
/home/gitlab-runner/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/net/http.rb:923:in connect: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
How i can workaround on this?
Stack trace
$ bundle exec pronto run -f gitlab -c origin/master
warning: parser/current is loading parser/ruby21, which recognizes
warning: 2.1.6-compliant syntax, but you are running 2.1.7.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
/home/gitlab-runner/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/net/http.rb:923:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
from /home/gitlab-runner/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/net/http.rb:923:in `block in connect'
from /home/gitlab-runner/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/timeout.rb:75:in `timeout'
from /home/gitlab-runner/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/net/http.rb:923:in `connect'
from /home/gitlab-runner/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/net/http.rb:863:in `do_start'
from /home/gitlab-runner/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/net/http.rb:852:in `start'
from /home/gitlab-runner/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/net/http.rb:1375:in `request'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/httparty-0.13.5/lib/httparty/request.rb:101:in `perform'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/httparty-0.13.5/lib/httparty.rb:522:in `perform_request'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/httparty-0.13.5/lib/httparty.rb:460:in `get'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/gitlab-3.4.0/lib/gitlab/request.rb:41:in `get'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/gitlab-3.4.0/lib/gitlab/client/repositories.rb:111:in `commit_comments'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/pronto-0.4.2/lib/pronto/gitlab.rb:10:in `commit_comments'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/pronto-0.4.2/lib/pronto/formatter/gitlab_formatter.rb:23:in `create_comment'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/pronto-0.4.2/lib/pronto/formatter/gitlab_formatter.rb:9:in `block in format'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/pronto-0.4.2/lib/pronto/formatter/gitlab_formatter.rb:8:in `map'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/pronto-0.4.2/lib/pronto/formatter/gitlab_formatter.rb:8:in `format'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/pronto-0.4.2/lib/pronto.rb:37:in `run'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/pronto-0.4.2/lib/pronto/cli.rb:52:in `run'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/gems/pronto-0.4.2/bin/pronto:6:in `<top (required)>'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/bin/pronto:23:in `load'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/bin/pronto:23:in `<main>'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/bin/ruby_executable_hooks:15:in `eval'
from /home/gitlab-runner/.rvm/gems/ruby-2.1.7/bin/ruby_executable_hooks:15:in `<main>'
Any help here? Looks like a problem with Rugged.
$# gem install pronto
Fetching: rugged-0.23.2.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing pronto:
ERROR: Failed to build gem native extension.
/Users/bhardin/.rbenv/versions/2.0.0-p643/bin/ruby extconf.rb
checking for gmake... no
checking for make... yes
checking for cmake... no
ERROR: CMake is required to build Rugged.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/bhardin/.rbenv/versions/2.0.0-p643/bin/ruby
--use-system-libraries
Gem files will remain installed in /Users/bhardin/.rbenv/versions/2.0.0-p643/lib/ruby/gems/2.0.0/gems/rugged-0.23.2 for inspection.
Results logged to /Users/bhardin/.rbenv/versions/2.0.0-p643/lib/ruby/gems/2.0.0/gems/rugged-0.23.2/ext/rugged/gem_make.out```
If you're getting an Object not found - no matching loose object
error like the following on CircleCI or similar continuous integration servers, it may be caused by them running a shallow clone:
bundle exec pronto run -f github -c=$(git log --pretty=format:%H | tail -1) --exit-code
/home/ubuntu/cii-best-practices-badge/vendor/bundle/ruby/2.2.0/gems/pronto-0.4.3/lib/pronto/git/repository.rb:68:in `merge_base': Object not found - no matching loose object (9035627bcab7e9bd64dd47c37b7fbfd67045a106) (Rugged::OdbError)
from /home/ubuntu/cii-best-practices-badge/vendor/bundle/ruby/2.2.0/gems/pronto-0.4.3/lib/pronto/git/repository.rb:68:in `merge_base'
from /home/ubuntu/cii-best-practices-badge/vendor/bundle/ruby/2.2.0/gems/pronto-0.4.3/lib/pronto/git/repository.rb:15:in `diff'
from /home/ubuntu/cii-best-practices-badge/vendor/bundle/ruby/2.2.0/gems/pronto-0.4.3/lib/pronto.rb:33:in `run'
from /home/ubuntu/cii-best-practices-badge/vendor/bundle/ruby/2.2.0/gems/pronto-0.4.3/lib/pronto/cli.rb:52:in `run'
from /home/ubuntu/cii-best-practices-badge/vendor/bundle/ruby/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /home/ubuntu/cii-best-practices-badge/vendor/bundle/ruby/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /home/ubuntu/cii-best-practices-badge/vendor/bundle/ruby/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /home/ubuntu/cii-best-practices-badge/vendor/bundle/ruby/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /home/ubuntu/cii-best-practices-badge/vendor/bundle/ruby/2.2.0/gems/pronto-0.4.3/bin/pronto:6:in `<top (required)>'
from /home/ubuntu/cii-best-practices-badge/vendor/bundle/ruby/2.2.0/bin/pronto:23:in `load'
from /home/ubuntu/cii-best-practices-badge/vendor/bundle/ruby/2.2.0/bin/pronto:23:in `<main>' bundle exec pronto run -f github -c=$(git log --pretty=format:%H | tail -1) --exit-code returned exit code 1
The solution is do an unshallow git fetch before running pronto. For example, use the following syntax for circle.yml
:
test:
pre:
- "[[ ! -s \"$(git rev-parse --git-dir)/shallow\" ]] || git fetch --unshallow"
post:
- bundle exec pronto run -f github -c=$(git log --pretty=format:%H | tail -1) --exit-code
Right now pronto appends automated comments in github's [Discussion](https://github.com/mmozuras/pronto/pull/14] page).
However it is more common to place the comments inline within the Files Changed tab.
It would be nice to see this behaviour ⛵
Provide more output, for debugging and following of progress, if --verbose
flag is passed.
On our continuous integration server, I would like to be able to run:
bundle exec pronto run -f=text,github -c origin/master --exit-code
so that I can both get errors posted into Github and to show up in the CI logs. However, formatter
currently takes a string instead of an array: https://github.com/mmozuras/pronto/blob/master/lib/pronto/cli.rb#L39
Since poper's message have no line number attached the uniqueness check breaks on both formatters (I did not check any other formatters, but text works).
It's basically because this line of code:
messages = messages.uniq { |message| [message.msg, message.line.new_lineno] }
Because message.line
is nil we get an undefined method exception for new_lineno
.
I would like to run pronto on the entire source tree (for the initial run) - how would I do that?
I have a repository with certain submodules. When I let pronto review a commit which changes a submodule, I get an error:
/home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.1/lib/pronto/runner.rb:16:in `readline': Is a directory @ io_fillbuf - fd:9 /home/gitlab-runner/tmp/builds/project-1/app/assets/javascripts/lib/edifact.js (Errno::EISDIR)
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.1/lib/pronto/runner.rb:16:in `block in ruby_executable?'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.1/lib/pronto/runner.rb:16:in `open'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.1/lib/pronto/runner.rb:16:in `ruby_executable?'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.1/lib/pronto/runner.rb:10:in `ruby_file?'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-rubocop-0.4.0/lib/pronto/rubocop.rb:16:in `block in run'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.1/lib/pronto/git/patches.rb:15:in `each'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.1/lib/pronto/git/patches.rb:15:in `each'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-rubocop-0.4.0/lib/pronto/rubocop.rb:14:in `select'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-rubocop-0.4.0/lib/pronto/rubocop.rb:14:in `run'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.1/lib/pronto.rb:60:in `block in run_all_runners'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.1/lib/pronto.rb:59:in `map'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.1/lib/pronto.rb:59:in `run_all_runners'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.1/lib/pronto.rb:34:in `run'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.1/lib/pronto/cli.rb:52:in `run'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /home/gitlab-runner/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.1/bin/pronto:6:in `<top (required)>'
from /home/gitlab-runner/.rbenv/versions/2.1.5/bin/pronto:23:in `load'
from /home/gitlab-runner/.rbenv/versions/2.1.5/bin/pronto:23:in `<main>'
What I think is happening is that pronto is not checking if the changed items are files or not (=> submodules are directories)
Aurimass-MacBook-Pro:core aurimas$ pronto run
dyld: lazy symbol binding failed: Symbol not found: _SSL_load_error_strings
Referenced from: /Users/aurimas/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/rugged-0.22.2/rugged/rugged.bundle
Expected in: flat namespace
dyld: Symbol not found: _SSL_load_error_strings
Referenced from: /Users/aurimas/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/rugged-0.22.2/rugged/rugged.bundle
Expected in: flat namespace
Trace/BPT trap: 5
Uninstalling rugged-0.22.2 and using rugged-0.22.1b1 solved the issue
Since we are using GitLab at our company it would be nice to have GitLab formatter.
I already started working on it and I've got a working formatter but it's far from completed: https://github.com/jeroenj/pronto/tree/gitlab-formatter.
I'll try to clean it up when I find the time, but I'm already putting it here for anybody who's interested to help out.
There also needs to be some work done in the GitLab API to improve this code.
With six runners, API is starting to get more stable. Time to refactor, clean up the API.
Also: high time to write a wiki entry on how to write a runner for Pronto.
╰─$ GITHUB_ACCESS_TOKEN=* PULL_REQUEST_ID=* pronto run -f github_pr
/home/sjke/.rvm/gems/ruby-2.1.5@***/gems/octokit-3.8.0/lib/octokit/response/raise_error.rb:16:in `on_complete': POST https://api.github.com/repos/***/***/pulls/***/comments: 422 - Validation Failed (Octokit::UnprocessableEntity)
Error summary:
resource: PullRequestReviewComment
code: custom
field: commit_id
message: commit_id is not part of the pull request // See: https://developer.github.com/v3/pulls/comments/#create-a-comment
group :development do
gem 'pronto'
gem 'pronto-rubocop', require: false #Ruby styleguide
gem 'pronto-rails_best_practices', require: false #Ruby styleguide
end
It would be good if pronto can omit some files based on glob patterns, such as db/schema.rb in Rails project which is always a generated file and should not be a subject of any check.
I'm running pronto-rubocop with Gitlab CI. It's returning a failing exit code even when Pronto is not finding any errors. Any idea on what is happening? I can't figure out what that code status means, where does the exit code come from?
0 Pronto messages posted to GitLab
ERROR: Build failed with: exit code 36
This pull request to support a newer thor
, which you've already merged, is necessary to work with rspec-rails
3.0.22. #26 WIthout it, I get:
$ bundle
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "thor":
In Gemfile:
pronto (= 0.2.5) ruby depends on
thor (~> 0.18.0) ruby
rspec-rails (= 3.0.2) ruby depends on
railties (>= 3.0) ruby depends on
thor (0.19.1)
Could you please rev the version of pronto to 0.26 and push to Rubygems. In the meantime, pulling master works:
gem 'pronto', github: 'mmozuras/pronto', ref: '0b6db2e'
Thanks.
Would it be possible to add instructions to the CONTRIBUTING or README doc to advise developers/potential contributors on how to run pronto using the latest code from the pronto repo?
I apologize in advance that this bug report will probably not have enough detail to enable debugging. However, last night, pronto, invoked as normal from our continuous integration machine with bundle exec rake pronto:github
issued over 500 comments on a 5 month old commit, rather than the commit it was supposed to run on. Specifically, my team received over 500 emails from Github with tons of specific errors, however those errors did not appear as in-line comments when I click on the accompanying link, the way they normally do.
The only thing I can find that is different is that the commit causing the problem was a revert of a commit earlier that day. However, it had nothing to do with the 5 month old commit that was being emailed about.
Unfortunately, this is a closed source project, so I don't have a good way of showing the error. And, I don't know what's causing it enough to replicate it.
But, pronto has been very reliable for me until now, so I wanted to put this out there in case others can replicate the error.
It seems that rugged has changed its api causing it to break with pronto:
/Users/jeroen/.gem/ruby/2.0.0/gems/pronto-haml-0.2.0/lib/pronto/haml.rb:13:in `block in run': undefined method `additions' for #<Rugged::Patch:70093436035160> (NoMethodError)
from /Users/jeroen/.gem/ruby/2.0.0/gems/pronto-haml-0.2.0/lib/pronto/haml.rb:13:in `each_patch'
from /Users/jeroen/.gem/ruby/2.0.0/gems/pronto-haml-0.2.0/lib/pronto/haml.rb:13:in `select'
from /Users/jeroen/.gem/ruby/2.0.0/gems/pronto-haml-0.2.0/lib/pronto/haml.rb:13:in `run'
from /Users/jeroen/.gem/ruby/2.0.0/bundler/gems/pronto-772610d36858/lib/pronto.rb:54:in `block in run_all_runners'
from /Users/jeroen/.gem/ruby/2.0.0/bundler/gems/pronto-772610d36858/lib/pronto.rb:53:in `map'
from /Users/jeroen/.gem/ruby/2.0.0/bundler/gems/pronto-772610d36858/lib/pronto.rb:53:in `run_all_runners'
from /Users/jeroen/.gem/ruby/2.0.0/bundler/gems/pronto-772610d36858/lib/pronto.rb:29:in `run'
from /Users/jeroen/.gem/ruby/2.0.0/bundler/gems/pronto-772610d36858/lib/pronto/cli.rb:42:in `run'
from /Users/jeroen/.gem/ruby/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/jeroen/.gem/ruby/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/jeroen/.gem/ruby/2.0.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /Users/jeroen/.gem/ruby/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Users/jeroen/.gem/ruby/2.0.0/bundler/gems/pronto-772610d36858/bin/pronto:6:in `<top (required)>'
from /Users/jeroen/.gem/ruby/2.0.0/bin/pronto:23:in `load'
from /Users/jeroen/.gem/ruby/2.0.0/bin/pronto:23:in `<main>'
rspec, rubocop, and many other tools will run and have an exit code of 1 if anything is "wrong" with your code.
For example:
rubocop:
rubocop spec
Inspecting 34 files
..................................
34 files inspected, no offenses detected
$ echo $?
0
fail
rubocop spec
Inspecting 34 files
.........................C........
Offenses:
spec/mailers/batch_mailer_spec.rb:48:5: C: Use 2 (not 3) spaces for indentation.
is_expected.to deliver_to(user.email)
^^^
34 files inspected, 1 offense detected
echo $?
1
This feature will help with integration of other tools into pronto that look at exit codes.
Messages for PR, not for commit.
Any plans for this?
I'm trying to get pronto to submit comments on a pull request coming from a forked repo, but I can't seem to get anything to work:
[tansaku@Samuels-MBP:~/Documents/Github/MakersAcademy/airport_challenge (master)]$
→ PULL_REQUEST_ID=133 pronto run -f github_pr
0 Pronto messages posted to GitHub
Here's the pull request that I want to get commented: makersacademy/airport_challenge#133
Having tried the above on the upstream repo (makersacademy/airport_challenge), I guessed (by repeatedly watching the animated gif) that I needed to be in the feature branch in order for things to work, so staying in my local repo that has makersacademy/airport_challenge as origin, I did the following:
$ git checkout -b tansaku/master # checkout the branch on the forked repo the pull request is coming from
$ PULL_REQUEST_ID=133 pronto run -f github_pr
which gives this error:
/Users/tansaku/.rvm/gems/ruby-2.2.2/gems/octokit-3.8.0/lib/octokit/response/raise_error.rb:16:in `on_complete': GET https://api.github.com/pulls/133/comments: 404 - Not Found // See: https://developer.github.com/v3 (Octokit::NotFound)
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/faraday-0.9.1/lib/faraday/response.rb:9:in `block in call'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/faraday-0.9.1/lib/faraday/response.rb:57:in `on_complete'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/faraday-0.9.1/lib/faraday/response.rb:8:in `call'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/faraday-0.9.1/lib/faraday/connection.rb:140:in `get'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/sawyer-0.6.0/lib/sawyer/agent.rb:94:in `call'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/octokit-3.8.0/lib/octokit/client.rb:339:in `request'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/octokit-3.8.0/lib/octokit/client.rb:200:in `paginate'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/octokit-3.8.0/lib/octokit/client/pull_requests.rb:184:in `pull_request_comments'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/pronto-0.4.2/lib/pronto/github.rb:11:in `pull_comments'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/pronto-0.4.2/lib/pronto/formatter/github_pull_request_formatter.rb:31:in `create_comment'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/pronto-0.4.2/lib/pronto/formatter/github_pull_request_formatter.rb:21:in `block in format'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/pronto-0.4.2/lib/pronto/formatter/github_pull_request_formatter.rb:8:in `map'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/pronto-0.4.2/lib/pronto/formatter/github_pull_request_formatter.rb:8:in `format'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/pronto-0.4.2/lib/pronto.rb:37:in `run'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/pronto-0.4.2/lib/pronto/cli.rb:52:in `run'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/gems/pronto-0.4.2/bin/pronto:6:in `<top (required)>'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/bin/pronto:23:in `load'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/bin/pronto:23:in `<main>'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
from /Users/tansaku/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'
which makes it look like the API endpoint is not configured properly for working with forks maybe?
https://api.github.com/pulls/133/comments
since that request should be for:
https://api.github.com/repos/makersacademy/airport_challenge/pulls/133/comments
Just for confirmation I can run pronto and get output locally:
$ pronto run
lib/airport.rb:6 W: Doesn't depend on instance state (UtilityFunction)
lib/plane.rb:5 I: Style/TrivialAccessors: Use `attr_reader` to define trivial reader methods. (https://github.com/bbatsov/ruby-style-guide#attr_family)
any thoughts? Would love to be able to run pronto on pull requests from forked repos.
Hi
Is it possible to run Pronto without checking out the entire source locally?
I mean, when commenting on a PR diff it does not seem necessary to be in the actual repo when running Pronto.
Something like this:
GITHUB_URL=https://github.com/mmozuras/pronto GITHUB_PR_ID=44 pronto run -f github_pr
This could just pull the diff from:
https://github.com/mmozuras/pronto/pull/44.diff
and analyze that?
Our workflow requires a shipit/LGTM/+1 type comment from anyone involved in a pull request. It would be handy to have pronto add such a message to the github pull request if no issues were found during the last run.
I have just installed pronto 0.3.3 as you see
pronto (0.3.3)
octokit (~> 3.2)
rugged (~> 0.21.0)
thor (~> 0.19.0)
and when I execute pronto run I'm getting
/home/ccvera/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/find.rb:43:in `block in find': undefined method `encoding' for #<Pathname:/home/ccvera/Workspace/my_app/Gemfile> (NoMethodError)
from /home/ccvera/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/find.rb:42:in `each'
from /home/ccvera/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/find.rb:42:in `find'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/haml-lint-0.7.0/lib/haml_lint/utils.rb:13:in `block in extract_files_from'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/haml-lint-0.7.0/lib/haml_lint/utils.rb:11:in `each'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/haml-lint-0.7.0/lib/haml_lint/utils.rb:11:in `extract_files_from'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/haml-lint-0.7.0/lib/haml_lint/runner.rb:69:in `extract_applicable_files'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/haml-lint-0.7.0/lib/haml_lint/runner.rb:12:in `run'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/pronto-haml-0.3.1/lib/pronto/haml.rb:18:in `inspect'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/pronto-haml-0.3.1/lib/pronto/haml.rb:14:in `block in run'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/pronto-haml-0.3.1/lib/pronto/haml.rb:14:in `map'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/pronto-haml-0.3.1/lib/pronto/haml.rb:14:in `run'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/pronto-0.3.3/lib/pronto.rb:57:in `block in run_all_runners'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/pronto-0.3.3/lib/pronto.rb:56:in `map'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/pronto-0.3.3/lib/pronto.rb:56:in `run_all_runners'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/pronto-0.3.3/lib/pronto.rb:30:in `run'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/pronto-0.3.3/lib/pronto/cli.rb:46:in `run'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /home/ccvera/.rvm/gems/ruby-2.1.1/gems/pronto-0.3.3/bin/pronto:6:in `<top (required)>'
from /home/ccvera/.rvm/gems/ruby-2.1.1/bin/pronto:23:in `load'
from /home/ccvera/.rvm/gems/ruby-2.1.1/bin/pronto:23:in `<main>'
Hi!
I'd like to run Pronto from another directory than the git repo to analyze, is that possible?
I thought that was what this PR was for: #52 but it doesn't seem to work. Whenever I pass options for pronto run
I get errors.
pronto run tmp/repository/foobar
ERROR: "pronto run" was called with arguments ["tmp/repository/foobar"]
I'm using the github version of pronto.
I can confirm that rubocop and rails_best_practices both return a handful of errors, however running pronto results in zero comments both in its normal mode (pronto run master) and github mode (GITHUB_ACCESS_TOKEN=[....] PULL_REQUEST_ID=3147 pronto run -f github_pr)
Has anyone experienced this? Ruby 2.1.1 / Rails 4.1
Following runners dependant on older versions of pronto so cannot run them in whole package with latest pronto. Included are links to relevant files.
pronto/reek
pronto/spell
pronto/fasterer
I found this including the gems in the following format in my gemfile
gem 'pronto'
gem 'pronto-fasterer', require: false
gem 'pronto-spell', require: false
gem 'pronto-reek', require: false
Other runners are running just fine.
If there's anything integration-wise I'm missing just give me a holler!
Hi!
I need to have the runner class name inside each report message for a personal project. The simplest solution is to add an extra runner argument to the constructor of the Message
class, but this requires to adjust all the existing runners. An other (very ugly) solution is to somehow parse the backtrace in the Message
's constructor and get the caller class from it.
Which solution sounds better for you? Would you accept a PR?
I'm seeing dozens of errors like:
$ bundle exec pronto run -f text -r rubocop -c origin/master
An error occurred while RSpec/FilePath cop was inspecting /home/ubuntu/chewy/spec/alerts/admin/claim_edited_alert_spec.rb.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/FilePath cop was inspecting /home/ubuntu/chewy/spec/alerts/admin/claim_other_alert_spec.rb.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/FilePath cop was inspecting /home/ubuntu/chewy/spec/alerts/admin/doctor_referral_created_alert_spec.rb.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/FilePath cop was inspecting /home/ubuntu/chewy/spec/alerts/admin/doctor_referral_notes_alert_spec.rb.
But when I run bundle exec rubocop -d
I'm not seeing any RSpec/FilePath
errors.
Anything suggestions on how to debug the problem?
Provide a way to configure runners. First use case: --liberal
flag for pronto-flay.
GithubPullRequestFormatter bug:
If new commits are added to a pull request, Pronto sometimes writes comments on incorrect lines. Before doing that, it should check whether pull request hasn't changed.
Reported by @ljank
/gems/grit-2.5.0/lib/grit/blame.rb:41:in block in process_raw_blame': undefined method
id' for nil:NilClass (NoMethodError)
Firstly, thanks @mmozuras for pronto. I'm trialling using it to help with teaching Rails, when reviewing student projects.
The running order of pronto-brakeman and pronto-rails_best_practices can affect what issues are detected.
For a Rails 4.2.0 app I'm trying this out with, here are the total counts of issues found when the runners are run alone and together in both orders:
Command | Number of issues pronto found |
---|---|
pronto run -r=rails_best_practices | 4 |
pronto run -r=brakeman | 1 |
pronto run -r=rails_best_practices brakeman | 5 |
pronto run -r=brakeman rails_best_practices | 6 |
Neither of the above There were missing issues and false positives pronto run
s which ran with both runners quite found all the issues.in both when the running order was "1. brakeman, 2. rails_best_practices" . For more details see the full output further below.
Debugging so far shows part of the issue is due to two different gems (brakeman and code_analyzer (code_analyzer is used by rails_best_practices)) monkey-patching the same Sexp
methods with different behaviours.
For example, the RemoveEmptyHelpersReview#empty_body?(module_node)
is dependent on Sexp#body
that behaves differently in brakeman compared to code_analyzer. As a result the RemoveEmptyHelpersReview
from rails_best_practices only detects empty helpers when rails_best_practices runs before brakeman.
(I'm not sure that the Sexp
monkey-patching explains the entire issue yet).
I'd like to contribute a fix for this, though I'm not sure where to go from here, so any guidance and ideas would be much appreciated.
One thought is that to help uncover these kind of issues, perhaps the installed pronto-*
runners could run in a random order when they're run with pronto run
(i.e. no -r=
option).
$ pronto run -r=rails_best_practices
app/controllers/collaborations_controller.rb:22 W: Law of demeter
app/views/wikis/show.html.haml:10 W: Law of demeter
app/helpers/collaborations_helper.rb:1 W: Remove empty helpers
app/views/collaborations/new.html.haml:10 W: Remove trailing whitespace
$ pronto run -r=brakeman
app/controllers/collaborations_controller.rb:15 W: Possible security vulnerability: Possible unprotected redirect
$ pronto run -r=rails_best_practices brakeman
app/controllers/collaborations_controller.rb:22 W: Law of demeter
app/views/wikis/show.html.haml:10 W: Law of demeter
app/helpers/collaborations_helper.rb:1 W: Remove empty helpers
app/views/collaborations/new.html.haml:10 W: Remove trailing whitespace
app/controllers/collaborations_controller.rb:15 W: Possible security vulnerability: Possible unprotected redirect
$ pronto run -r=brakeman rails_best_practices
app/controllers/collaborations_controller.rb:15 W: Possible security vulnerability: Possible unprotected redirect
app/controllers/collaborations_controller.rb:22 W: Law of demeter
app/views/wikis/show.html.haml:10 W: Law of demeter
config/routes.rb:4 W: Restrict auto-generated routes wikis (only: [])
config/routes.rb:5 W: Restrict auto-generated routes wikis/collaborations (only: [])
app/views/collaborations/new.html.haml:10 W: Remove trailing whitespace
# MISSING ISSUE: app/helpers/collaborations_helper.rb:1 W: Remove empty helpers
# FALSE POSITIVE: config/routes.rb:4 W: Restrict auto-generated routes wikis (only: [])
# FALSE POSITIVE: config/routes.rb:5 W: Restrict auto-generated routes wikis/collaborations (only: [])
Hi!
I came across an issue that makes the pronto run task fail miserably - with segmentation fault.
The error message can be seen in this gist: https://gist.github.com/simicic/60f84a1f6187c0ec6e1c
Checking it in deep I saw it comes from the rugged gem - I can report an issue there as well, but let me first ask, how come that a single rename of a class (class name and file name) breaks pronto?
The task is running after the test suit on Circle CI and I could detect what actually caused the failure - or at least I like to think so. After the commit that changes the file name - things started to go wrong.
I tried to clear the cache for running the task, update both pronto and rugged to the latest version but nothing seem to be helping...
(Running Ruby 2.0.0-p353, also tried with 2.1.0-p95, Pronto: 0.4.1, Rugged: 0.21.4, Github Formatter )
I would appreciate any help - maybe I am doing something wrong?
When running Pronto via Jenkins with github_pr formatter, I often get this:
/var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/octokit-4.1.1/lib/octokit/response/raise_error.rb:16:in `on_complete': POST https://api.github.com/repos/<org>/<repo>/pulls/355/comments: 422 - Validation Failed (Octokit::UnprocessableEntity)
Error summary:
resource: PullRequestReviewComment
code: custom
field: commit_id
message: commit_id is not part of the pull request // See: https://developer.github.com/v3/pulls/comments/#create-a-comment
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/response.rb:9:in `block in call'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/response.rb:57:in `on_complete'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/response.rb:8:in `call'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/octokit-4.1.1/lib/octokit/middleware/follow_redirects.rb:73:in `perform_with_redirection'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/octokit-4.1.1/lib/octokit/middleware/follow_redirects.rb:61:in `call'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/connection.rb:177:in `post'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/sawyer-0.6.0/lib/sawyer/agent.rb:94:in `call'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/octokit-4.1.1/lib/octokit/connection.rb:154:in `request'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/octokit-4.1.1/lib/octokit/connection.rb:28:in `post'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/octokit-4.1.1/lib/octokit/client/pull_requests.rb:211:in `create_pull_request_comment'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.3/lib/pronto/github.rb:31:in `create_pull_comment'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.3/lib/pronto/formatter/github_pull_request_formatter.rb:33:in `create_comment'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.3/lib/pronto/formatter/github_pull_request_formatter.rb:21:in `block in format'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.3/lib/pronto/formatter/github_pull_request_formatter.rb:8:in `map'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.3/lib/pronto/formatter/github_pull_request_formatter.rb:8:in `format'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.3/lib/pronto.rb:37:in `run'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.3/lib/pronto/cli.rb:52:in `run'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /var/lib/jenkins/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pronto-0.4.3/bin/pronto:6:in `<top (required)>'
from /var/lib/jenkins/.rbenv/versions/2.1.5/bin/pronto:23:in `load'
from /var/lib/jenkins/.rbenv/versions/2.1.5/bin/pronto:23:in `<main>'
I've been trying to execute pronto in a pre-commit hook, and I ended up with the following issue.
Suppose I have a file with inorrect indentation: in this case it's Gemfile
. I stage it with git add Gemfile
and execute pronto run --index
. No issues are reported.
Now, if I do git reset Gemfile
, pronto run --index
will report the issues correctly, e.g.:
Gemfile:166 I: Inconsistent indentation detected.
Gemfile:167 I: Tab detected.
Gemfile:167 I: Inconsistent indentation detected.
Gemfile:168 I: Tab detected.
Gemfile:168 I: Inconsistent indentation detected.
I tested a bit more, and staged changes are not being analysed with all of the following:
pronto run
,
pronto run --index
,
pronto run --commit=$(git log --pretty=format:%H | head -1)
,
pronto run --commit=HEAD
.
Is there something trivial I have missed, or is this behaviour expected?
I used Ruby 2.1.5. More info:
pronto (0.5.3)
gitlab (~> 3.4.0)
octokit (~> 4.1.0)
rugged (~> 0.23.0)
thor (~> 0.19.0)
pronto-flay (0.5.0)
flay (~> 2.6.0)
pronto (~> 0.5.0)
pronto-jshint (0.5.0)
jshintrb (~> 0.3.0)
pronto (~> 0.5.0)
pronto-rails_best_practices (0.5.0)
pronto (~> 0.5.0)
rails_best_practices (~> 1.15.0)
pronto-rails_schema (0.5.0)
pronto (~> 0.5.0)
pronto-rubocop (0.5.0)
pronto (~> 0.5.0)
rubocop (~> 0.35.0)
I am using pronto in CI and I miss one feature to mark build as failed if any issues found in pronto run.
So, it would be great to add some command, which would set status code as not zero, if any issues found, so that CI would fail the build.
If I run pronto on a branch with the github_pr
formatter it crashes if there is no PR.
octokit-3.5.2/lib/octokit/response/raise_error.rb:16:in
on_complete': POST https://api.github.com/repos/Linuus/foobar/pulls/comments: 404 - Not Found // See: https://developer.github.com/v3 (Octokit::NotFound)`
Maybe it should just emit a more friendly message instead if the PR ID detection fails to find a PR.
Rugged::Blame
doesn't seem to detect them or have an option to detect them. Maybe using Diff#find_similar!
is an option, but will require further investigation.
Hello @mmozuras ,
I spent time getting to know the pronto gem and after some tests on pull-requests on github, I realized that the gem can analyze only my own pull-requests (please correct me if I'm wrong), but I was wondering why the gem does not apply in other pull-requests?
I think it would be very relevant if I could analyze a pull-request from another person that work in the same organization. I started writing a few lines of code to add this option and decided to take a break to get your opinion and if this feature would be a good contribution and avoid implementing a feature that would not come to be used for some reason.
https://github.com/fernandopso/pronto/commit/c5da797248659d79a5df9a4605829c9b442d018d
It would be nice to have runner for haml-lint.
I currenlty don't have to the time to find out how to write one, but I'll try to get to it somewhere the following weeks. Unless somebody else would like to work on it of course. :)
It'd be quite nice to use this with bitbucket's PR Requests!
Running pronto (installed from master at c88e2b0) causes the following error when using the github_pr formatter. This is reproducible and 0.4.3 of the gem does not have this behaviour. Curiously the 15609e8fb17fffbf2d51958bf5df6c57160fd281 commit sha below is not part of my local repository (git show 156... throws an error), but viewing it on github shows it as a merge of the last commit in my branch into master. Presumably that is why it fails, curious how it is picked up by pronto (or is travis ci to blame?).
bundle exec pronto run -f github_pr
Failed to post: #<struct Pronto::Github::Comment sha="15609e8fb17fffbf2d51958bf5df6c57160fd281", body="Unnecessary spacing detected.", path="file.rb", position=40> with POST https://api.github.com/repos/removed/removed/pulls/437/comments: 422 - Validation Failed
Error summary:
resource: PullRequestReviewComment
code: custom
field: commit_id
message: commit_id is not part of the pull request // See: https://developer.github.com/v3/pulls/comments/#create-a-comment
0 Pronto messages posted to GitHub
It might be interesting to have a runner for fasterer. I might give a shot at it but I guess you will be feaster at it. :)
Would it be possible to enable the option to run pronto-jshint against a local .jshintrc configuration
bundle exec pronto run --config .jshintrc
?
Thanks,
Gabriel
Sometimes, when you are importing third party code into your repo (don't ask 😄 ), you know it will be shit and pronto will be all over it. It would be nice to be able to say pronto no bueno
or some other safe-word in your commit message / pull request to skip pronto.
Would be a nice integration to have.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.