-
-
Notifications
You must be signed in to change notification settings - Fork 457
Closed
Description
When sending review comments to Bitbucket Server, the line number sent seems to be one less than the actual line number.
Therefore, if there is only one line in the diff, the comment will not be added to BitBucket because it will be outside the scope of the diff.
After cloning it locally and doing some trial and error, I modified the following parts and it worked.
diff --git a/service/bitbucket/server_api_helper.go b/service/bitbucket/server_api_helper.go
index 876d69b..a37dca6 100644
--- a/service/bitbucket/server_api_helper.go
+++ b/service/bitbucket/server_api_helper.go
@@ -42,7 +42,7 @@ func (h *ServerAPIHelper) buildAnnotation(comment *reviewdog.Comment) insights.A
data := insights.NewAnnotation(
comment.Result.Diagnostic.GetLocation().GetPath(),
- comment.Result.Diagnostic.GetLocation().GetRange().GetStart().GetLine()-1,
+ comment.Result.Diagnostic.GetLocation().GetRange().GetStart().GetLine(),
fmt.Sprintf(`[%s] %s`, comment.ToolName, comment.Result.Diagnostic.GetMessage()),
severity,
)
cf. Bitbucket server API Spec: https://docs.atlassian.com/bitbucket-server/rest/5.15.0/bitbucket-code-insights-rest.html
/rest/insights/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations
Metadata
Metadata
Assignees
Labels
No labels