reviewdog / reviewdog

🐶 Automated code review tool integrated with any code analysis tools regardless of programming language

Home Page:https://medium.com/@haya14busa/reviewdog-a-code-review-dog-who-keeps-your-codebase-healthy-d957c471938b#.8xctbaw5u

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

File filter for github doesn't correctly submit comments

taekahn opened this issue · comments

if !c.Result.InDiffContext {
			// If the result is outside of diff context, fallback to GitHub Review
			// Comment API.
			comment := buildPullRequestComment(c, body, g.sha)
			plainComments = append(plainComments, comment)
			continue
		}

This block of code does not seem to function correctly.

The error:
2024/01/22 15:24:23 reviewdog: failed to post a pull request comment: POST https://github....: 422 Invalid request.

No subschema in "oneOf" matched.
"position" wasn't supplied.
"in_reply_to" wasn't supplied.
"subject_type" is not a permitted key.
"line" wasn't supplied. []

The github api attempting to be used is v3
review dog was not being run as a github action.

simply giving a line of 0 (or the real line number if one exists) might fix this, but i didn't keep going past figuring out where the error was coming from and why. I simply switched to diff_context only.

@shogo82148 @bgpat

I'm thinking we should revert this feature #1576.

  • It doesn't work according to this bug report.
  • The comments don't include any position (line) data and must be confusing. I'm not sure it correctly support avoiding posting multiple same comments with new commits.
  • Someone (like me) actually prefers using github annotation as a fallback. It can correctly post comments to specific line.

If we would keep the feature, we should use the API only when there are no line data.

Or/and we should add position data in comments itself somehow.