Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to comment on PR #18

Open
n5ken opened this issue Mar 5, 2019 · 9 comments
Open

Unable to comment on PR #18

n5ken opened this issue Mar 5, 2019 · 9 comments

Comments

@n5ken
Copy link

n5ken commented Mar 5, 2019

Environment:

[deploy@server ~]$ gem list | grep pronto
pronto (0.10.0, 0.9.5)
pronto-eslint (0.10.0)
pronto-flay (0.10.0)
pronto-jshint (0.10.0)
pronto-rails_best_practices (0.10.0)
pronto-rails_schema (0.9.1)
pronto-rubocop (0.10.0)
pronto-stylelint (0.10.0)

It seems there is a problem posting comment on a PR as follow:

Comment message:

Creating a comment from message: #<Pronto::Message:0x00000004382e68 @path=".eslintrc", @line=nil, @level=:fatal, @msg="Parsing error: The keyword 'const' is reserved", @runner=Pronto::ESLint, @commit_sha=nil>
Creating a comment from message: #<Pronto::Message:0x00000004509e58 @path=".eslintrc", @line=nil, @level=:fatal, @msg="Parsing error: The keyword 'import' is reserved", @runner=Pronto::ESLint, @commit_sha=nil>

Back trace:

Creating commit comment on 
POST https://api.github.com/repos/n5ken/lcola-saas/commits/comments: 404 - Not Found // See: https://developer.github.com/v3
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/octokit-4.13.0/lib/octokit/response/raise_error.rb:16:in `on_complete'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/faraday-0.15.4/lib/faraday/response.rb:9:in `block in call'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/faraday-0.15.4/lib/faraday/response.rb:61:in `on_complete'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/faraday-0.15.4/lib/faraday/response.rb:8:in `call'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/octokit-4.13.0/lib/octokit/middleware/follow_redirects.rb:73:in `perform_with_redirection'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/octokit-4.13.0/lib/octokit/middleware/follow_redirects.rb:61:in `call'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/faraday-0.15.4/lib/faraday/request/retry.rb:128:in `call'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/faraday-0.15.4/lib/faraday/rack_builder.rb:143:in `build_response'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/faraday-0.15.4/lib/faraday/connection.rb:387:in `run_request'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/faraday-0.15.4/lib/faraday/connection.rb:175:in `post'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/sawyer-0.8.1/lib/sawyer/agent.rb:94:in `call'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/octokit-4.13.0/lib/octokit/connection.rb:156:in `request'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/octokit-4.13.0/lib/octokit/connection.rb:28:in `post'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/octokit-4.13.0/lib/octokit/client/commit_comments.rb:63:in `create_commit_comment'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/pronto-0.10.0/lib/pronto/github.rb:34:in `create_commit_comment'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/pronto-0.10.0/lib/pronto/github.rb:49:in `create_pull_comment'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/pronto-0.10.0/lib/pronto/formatter/pull_request_formatter.rb:11:in `block in submit_comments'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/pronto-0.10.0/lib/pronto/formatter/pull_request_formatter.rb:11:in `each'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/pronto-0.10.0/lib/pronto/formatter/pull_request_formatter.rb:11:in `submit_comments'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/pronto-0.10.0/lib/pronto/formatter/git_formatter.rb:9:in `format'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/pronto-0.10.0/lib/pronto.rb:67:in `block in run'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/pronto-0.10.0/lib/pronto.rb:66:in `each'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/pronto-0.10.0/lib/pronto.rb:66:in `run'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/pronto-0.10.0/lib/pronto/cli.rb:66:in `block in run'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/pronto-0.10.0/lib/pronto/cli.rb:64:in `chdir'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/pronto-0.10.0/lib/pronto/cli.rb:64:in `run'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/gems/pronto-0.10.0/bin/pronto:6:in `<top (required)>'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/bin/pronto:22:in `load'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/bin/pronto:22:in `<main>'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/bin/ruby_executable_hooks:15:in `eval'
/home/deploy/.rvm/gems/ruby-2.3.3@happypower-server/bin/ruby_executable_hooks:15:in `<main>'
@abinoam
Copy link

abinoam commented Sep 20, 2019

@abinoam
Copy link

abinoam commented Sep 20, 2019

@mmozuras I'm trying to hunt this one.

I can see that the SHA is not getting into the url.

GET https://api.github.com/repos/abinoam/gomedical/commits//comments?per_page=100

The part commits/SHA_SHOULD_GO_HERE/comments

Traceback (most recent call last):
	32: from /home/rof/cache/bundler/bin/pronto:29:in `<main>'
	31: from /home/rof/cache/bundler/bin/pronto:29:in `load'
	30: from /home/rof/cache/bundler/ruby/2.6.0/gems/pronto-0.9.5/bin/pronto:6:in `<top (required)>'
	29: from /home/rof/cache/bundler/ruby/2.6.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
	28: from /home/rof/cache/bundler/ruby/2.6.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
	27: from /home/rof/cache/bundler/ruby/2.6.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
	26: from /home/rof/cache/bundler/ruby/2.6.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
	25: from /home/rof/cache/bundler/ruby/2.6.0/gems/pronto-0.9.5/lib/pronto/cli.rb:60:in `run'
	24: from /home/rof/cache/bundler/ruby/2.6.0/gems/pronto-0.9.5/lib/pronto/cli.rb:60:in `chdir'
	23: from /home/rof/cache/bundler/ruby/2.6.0/gems/pronto-0.9.5/lib/pronto/cli.rb:61:in `block in run'
	22: from /home/rof/cache/bundler/ruby/2.6.0/gems/pronto-0.9.5/lib/pronto.rb:66:in `run'
	21: from /home/rof/cache/bundler/ruby/2.6.0/gems/pronto-0.9.5/lib/pronto.rb:66:in `each'
	20: from /home/rof/cache/bundler/ruby/2.6.0/gems/pronto-0.9.5/lib/pronto.rb:67:in `block in run'
	19: from /home/rof/cache/bundler/ruby/2.6.0/gems/pronto-0.9.5/lib/pronto/formatter/git_formatter.rb:6:in `format'
	18: from /home/rof/cache/bundler/ruby/2.6.0/gems/pronto-0.9.5/lib/pronto/formatter/commit_formatter.rb:6:in `existing_comments'
	17: from /home/rof/cache/bundler/ruby/2.6.0/gems/pronto-0.9.5/lib/pronto/formatter/commit_formatter.rb:6:in `flat_map'
	16: from /home/rof/cache/bundler/ruby/2.6.0/gems/pronto-0.9.5/lib/pronto/formatter/commit_formatter.rb:6:in `each'
	15: from /home/rof/cache/bundler/ruby/2.6.0/gems/pronto-0.9.5/lib/pronto/formatter/commit_formatter.rb:6:in `block in existing_comments'
	14: from /home/rof/cache/bundler/ruby/2.6.0/gems/pronto-0.9.5/lib/pronto/github.rb:18:in `commit_comments'
	13: from /home/rof/cache/bundler/ruby/2.6.0/gems/octokit-4.13.0/lib/octokit/client/commit_comments.rb:25:in `commit_comments'
	12: from /home/rof/cache/bundler/ruby/2.6.0/gems/octokit-4.13.0/lib/octokit/connection.rb:84:in `paginate'
	11: from /home/rof/cache/bundler/ruby/2.6.0/gems/octokit-4.13.0/lib/octokit/connection.rb:156:in `request'
	10: from /home/rof/cache/bundler/ruby/2.6.0/gems/sawyer-0.8.1/lib/sawyer/agent.rb:94:in `call'
	 9: from /home/rof/cache/bundler/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/connection.rb:138:in `get'
	 8: from /home/rof/cache/bundler/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/connection.rb:387:in `run_request'
	 7: from /home/rof/cache/bundler/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/rack_builder.rb:143:in `build_response'
	 6: from /home/rof/cache/bundler/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/request/retry.rb:128:in `call'
	 5: from /home/rof/cache/bundler/ruby/2.6.0/gems/octokit-4.13.0/lib/octokit/middleware/follow_redirects.rb:61:in `call'
	 4: from /home/rof/cache/bundler/ruby/2.6.0/gems/octokit-4.13.0/lib/octokit/middleware/follow_redirects.rb:73:in `perform_with_redirection'
	 3: from /home/rof/cache/bundler/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/response.rb:8:in `call'
	 2: from /home/rof/cache/bundler/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/response.rb:61:in `on_complete'
	 1: from /home/rof/cache/bundler/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/response.rb:9:in `block in call'
/home/rof/cache/bundler/ruby/2.6.0/gems/octokit-4.13.0/lib/octokit/response/raise_error.rb:16:in `on_complete': GET https://api.github.com/repos/abinoam/gomedical/commits//comments?per_page=100: 422 - No commit found for SHA: /comments // See: https://developer.github.com/v3/repos/commits/#get-a-single-commit (Octokit::UnprocessableEntity)

@abinoam
Copy link

abinoam commented Sep 20, 2019

The comment by @jdq22 at prontolabs/pronto#353 (comment) made me pay closer attention to pronto-eslint

Running a clean pronto run -c develop one of the errors are:

...
.eslintrc: F: Parsing error: The keyword 'import' is reserved
app/models/bill.rb:171 W: Remove unused methods (bill#with_statuses)
...

There's no line number indications and the file name is wrong.

Perhaps the problematic part of the code is:

    def inspect(patch)
      offences = Eslintrb.lint(patch.new_file_full_path, options).compact

      fatals = offences.select { |offence| offence['fatal'] }
        .map { |offence| new_message(offence, nil) }

      return fatals if fatals && !fatals.empty?

      offences.map do |offence|
        patch.added_lines.select { |line| line.new_lineno == offence['line'] }
          .map { |line| new_message(offence, line) }
      end
    end

From: https://github.com/prontolabs/pronto-eslint/blob/master/lib/pronto/eslint.rb#L15

Mainly the way how it treats fatal errors (prematurely returning).

Perhaps I can come up with patch soon.

@abinoam
Copy link

abinoam commented Sep 21, 2019

Examples of fatal and non-fatal returns by Eslintrb

Fatal rule by eslintrb

{"ruleId"=>nil,
 "fatal"=>true,
 "severity"=>2,
 "source"=>"import { Doughnut } from 'vue-chartjs';",
 "message"=>"Parsing error: The keyword 'import' is reserved",
 "line"=>2,
 "column"=>1}

Non-fatal rule

 {"ruleId"=>"strict",
 "severity"=>2,
 "source"=>"$(function () {",
 "message"=>"Use the function form of 'use strict'.",
 "line"=>6,
 "column"=>3,
 "nodeType"=>"FunctionExpression"
 }

@abinoam
Copy link

abinoam commented Sep 21, 2019

A fatal rule by fail to pass .eslintrc

{ "ruleId"=>nil,
 "fatal"=>true,
 "severity"=>2,
 "source"=>nil,
 "message"=>"Parsing error: ecmaVersion must be 3, 5, 6, or 7."}

@doomspork
Copy link
Member

@abinoam if you're open to submitting a fix those this it would be greatly appreciated 😁

@jamienourish
Copy link

Did you find a solution for this? Moving to Git Hub actions we are now seeing this exact problem

@abinoam
Copy link

abinoam commented Sep 28, 2020

It's been a while since then. I've had a storm of things to do at that time and it just stayed untouched. Sorry.

@tobischo
Copy link

We ran into the same issue just now and to me the issue seems to come from using nil here for the commit_sha parameter:

Message.new(path, line, level, offence['message'], nil, self.class)

I am proposing the following change: #24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants