fix line numbers for code comments

jobatzil/rename
Marko Gaćeša 2023-04-28 12:38:05 +02:00
parent a837513a7d
commit 96942f13b6
10 changed files with 110 additions and 80 deletions

View File

@ -220,6 +220,7 @@ func (c *Client) GetDiffHunkHeaders(
type DiffCutOutput struct {
Header HunkHeader
LinesHeader string
Lines []string
MergeBaseSHA string
LatestSourceSHA string
@ -277,6 +278,7 @@ func (c *Client) DiffCut(ctx context.Context, params *DiffCutParams) (DiffCutOut
return DiffCutOutput{
Header: HunkHeader(hunkHeader),
LinesHeader: result.LinesHeader,
Lines: result.Lines,
MergeBaseSHA: result.MergeBaseSha,
LatestSourceSHA: result.LatestSourceSha,

View File

@ -122,7 +122,7 @@ func (g Adapter) DiffCut(
ctx context.Context,
repoPath, targetRef, sourceRef, path string,
params types.DiffCutParams,
) (types.Hunk, error) {
) (types.HunkHeader, types.Hunk, error) {
pipeRead, pipeWrite := io.Pipe()
stderr := &bytes.Buffer{}
go func() {
@ -143,19 +143,19 @@ func (g Adapter) DiffCut(
})
}()
hunk, err := parser.DiffCut(pipeRead, params)
diffCutHeader, linesHunk, err := parser.DiffCut(pipeRead, params)
// First check if there's something in the stderr buffer, if yes that's the error
if errStderr := parseDiffStderr(stderr); errStderr != nil {
return types.Hunk{}, errStderr
return types.HunkHeader{}, types.Hunk{}, errStderr
}
// Next check if reading the git diff output caused an error
if err != nil {
return types.Hunk{}, err
return types.HunkHeader{}, types.Hunk{}, err
}
return hunk, nil
return diffCutHeader, linesHunk, nil
}
func parseDiffStderr(stderr *bytes.Buffer) error {

View File

@ -17,18 +17,18 @@ import (
// and returns lines specified with the parameters.
//
//nolint:funlen,gocognit,nestif,gocognit,gocyclo,cyclop // it's actually very readable
func DiffCut(r io.Reader, params types.DiffCutParams) (types.Hunk, error) {
func DiffCut(r io.Reader, params types.DiffCutParams) (types.HunkHeader, types.Hunk, error) {
scanner := bufio.NewScanner(r)
var err error
var hunkHeader types.HunkHeader
if _, err = scanFileHeader(scanner); err != nil {
return types.Hunk{}, err
return types.HunkHeader{}, types.Hunk{}, err
}
if hunkHeader, err = scanHunkHeader(scanner); err != nil {
return types.Hunk{}, err
return types.HunkHeader{}, types.Hunk{}, err
}
currentOldLine := hunkHeader.OldLine
@ -51,7 +51,7 @@ func DiffCut(r io.Reader, params types.DiffCutParams) (types.Hunk, error) {
line, action, err = scanHunkLine(scanner)
if err != nil {
return types.Hunk{}, err
return types.HunkHeader{}, types.Hunk{}, err
}
if line == "" {
@ -93,7 +93,7 @@ func DiffCut(r io.Reader, params types.DiffCutParams) (types.Hunk, error) {
}
if !inCut {
return types.Hunk{}, types.ErrHunkNotFound
return types.HunkHeader{}, types.Hunk{}, types.ErrHunkNotFound
}
var (
@ -111,34 +111,36 @@ func DiffCut(r io.Reader, params types.DiffCutParams) (types.Hunk, error) {
linesAfter = append(linesAfter, line)
}
if err = scanner.Err(); err != nil {
return types.Hunk{}, err
return types.HunkHeader{}, types.Hunk{}, err
}
}
diffCutHeaderLines := diffCutHeader
for _, s := range linesBefore {
action := diffAction(s[0])
if action != actionRemoved {
diffCutHeader.NewLine--
diffCutHeader.NewSpan++
diffCutHeaderLines.NewLine--
diffCutHeaderLines.NewSpan++
}
if action != actionAdded {
diffCutHeader.OldLine--
diffCutHeader.OldSpan++
diffCutHeaderLines.OldLine--
diffCutHeaderLines.OldSpan++
}
}
for _, s := range linesAfter {
action := diffAction(s[0])
if action != actionRemoved {
diffCutHeader.NewSpan++
diffCutHeaderLines.NewSpan++
}
if action != actionAdded {
diffCutHeader.OldSpan++
diffCutHeaderLines.OldSpan++
}
}
return types.Hunk{
HunkHeader: diffCutHeader,
return diffCutHeader, types.Hunk{
HunkHeader: diffCutHeaderLines,
Lines: concat(linesBefore, diffCut, linesAfter),
}, nil
}

View File

@ -12,6 +12,7 @@ import (
"github.com/harness/gitness/gitrpc/internal/types"
)
//nolint:gocognit // it's a unit test!!!
func TestDiffCut(t *testing.T) {
const input = `diff --git a/test.txt b/test.txt
--- a/test.txt
@ -107,7 +108,7 @@ func TestDiffCut(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
hunk, err := DiffCut(
hunkHeader, linesHunk, err := DiffCut(
strings.NewReader(input),
test.params,
)
@ -122,11 +123,19 @@ func TestDiffCut(t *testing.T) {
return
}
if want, got := test.expCutHeader, hunk.HunkHeader.String(); want != got {
if test.params.LineStartNew && test.params.LineStart != hunkHeader.NewLine {
t.Errorf("hunk line start mismatch: want=%d got=%d", test.params.LineStart, hunkHeader.NewLine)
}
if !test.params.LineStartNew && test.params.LineStart != hunkHeader.OldLine {
t.Errorf("hunk line start mismatch: want=%d got=%d", test.params.LineStart, hunkHeader.OldLine)
}
if want, got := test.expCutHeader, linesHunk.String(); want != got {
t.Errorf("header mismatch: want=%s got=%s", want, got)
}
if want, got := test.expCut, hunk.Lines; !reflect.DeepEqual(want, got) {
if want, got := test.expCut, linesHunk.Lines; !reflect.DeepEqual(want, got) {
t.Errorf("lines mismatch: want=%s got=%s", want, got)
}
})

View File

@ -129,22 +129,27 @@ func (s DiffService) DiffCut(
return nil, processGitErrorf(err, "failed to get list of source branch commits")
}
hunk, err := s.adapter.DiffCut(ctx, repoPath, r.TargetCommitSha, r.SourceCommitSha, r.Path, types.DiffCutParams{
LineStart: int(r.LineStart),
LineStartNew: r.LineStartNew,
LineEnd: int(r.LineEnd),
LineEndNew: r.LineEndNew,
BeforeLines: 2,
AfterLines: 2,
LineLimit: 40,
})
diffHunkHeader, linesHunk, err := s.adapter.DiffCut(ctx,
repoPath,
r.TargetCommitSha, r.SourceCommitSha,
r.Path,
types.DiffCutParams{
LineStart: int(r.LineStart),
LineStartNew: r.LineStartNew,
LineEnd: int(r.LineEnd),
LineEndNew: r.LineEndNew,
BeforeLines: 2,
AfterLines: 2,
LineLimit: 40,
})
if err != nil {
return nil, processGitErrorf(err, "failed to get diff hunk")
}
return &rpc.DiffCutResponse{
HunkHeader: mapHunkHeader(hunk.HunkHeader),
Lines: hunk.Lines,
HunkHeader: mapHunkHeader(diffHunkHeader),
LinesHeader: linesHunk.HunkHeader.String(),
Lines: linesHunk.Lines,
MergeBaseSha: mergeBase,
LatestSourceSha: sourceCommits[0],
}, nil

View File

@ -55,6 +55,6 @@ type GitAdapter interface {
baseRef string, headRef string, direct bool) (types.DiffShortStat, error)
GetDiffHunkHeaders(ctx context.Context, repoPath, targetRef, sourceRef string) ([]*types.DiffFileHunkHeaders, error)
DiffCut(ctx context.Context, repoPath, targetRef, sourceRef, path string,
params types.DiffCutParams) (types.Hunk, error)
params types.DiffCutParams) (types.HunkHeader, types.Hunk, error)
Blame(ctx context.Context, repoPath, rev, file string, lineFrom, lineTo int) types.BlameReader
}

View File

@ -79,7 +79,8 @@ message DiffCutRequest {
message DiffCutResponse {
HunkHeader hunk_header = 1;
repeated string lines = 2;
string merge_base_sha = 3;
string latest_source_sha = 4;
string lines_header = 2;
repeated string lines = 3;
string merge_base_sha = 4;
string latest_source_sha = 5;
}

View File

@ -637,9 +637,10 @@ type DiffCutResponse struct {
unknownFields protoimpl.UnknownFields
HunkHeader *HunkHeader `protobuf:"bytes,1,opt,name=hunk_header,json=hunkHeader,proto3" json:"hunk_header,omitempty"`
Lines []string `protobuf:"bytes,2,rep,name=lines,proto3" json:"lines,omitempty"`
MergeBaseSha string `protobuf:"bytes,3,opt,name=merge_base_sha,json=mergeBaseSha,proto3" json:"merge_base_sha,omitempty"`
LatestSourceSha string `protobuf:"bytes,4,opt,name=latest_source_sha,json=latestSourceSha,proto3" json:"latest_source_sha,omitempty"`
LinesHeader string `protobuf:"bytes,2,opt,name=lines_header,json=linesHeader,proto3" json:"lines_header,omitempty"`
Lines []string `protobuf:"bytes,3,rep,name=lines,proto3" json:"lines,omitempty"`
MergeBaseSha string `protobuf:"bytes,4,opt,name=merge_base_sha,json=mergeBaseSha,proto3" json:"merge_base_sha,omitempty"`
LatestSourceSha string `protobuf:"bytes,5,opt,name=latest_source_sha,json=latestSourceSha,proto3" json:"latest_source_sha,omitempty"`
}
func (x *DiffCutResponse) Reset() {
@ -681,6 +682,13 @@ func (x *DiffCutResponse) GetHunkHeader() *HunkHeader {
return nil
}
func (x *DiffCutResponse) GetLinesHeader() string {
if x != nil {
return x.LinesHeader
}
return ""
}
func (x *DiffCutResponse) GetLines() []string {
if x != nil {
return x.Lines
@ -793,38 +801,41 @@ var file_diff_proto_rawDesc = []byte{
0x65, 0x5f, 0x65, 0x6e, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x69, 0x6e,
0x65, 0x45, 0x6e, 0x64, 0x12, 0x20, 0x0a, 0x0c, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x65, 0x6e, 0x64,
0x5f, 0x6e, 0x65, 0x77, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x6c, 0x69, 0x6e, 0x65,
0x45, 0x6e, 0x64, 0x4e, 0x65, 0x77, 0x22, 0xab, 0x01, 0x0a, 0x0f, 0x44, 0x69, 0x66, 0x66, 0x43,
0x45, 0x6e, 0x64, 0x4e, 0x65, 0x77, 0x22, 0xce, 0x01, 0x0a, 0x0f, 0x44, 0x69, 0x66, 0x66, 0x43,
0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x0b, 0x68, 0x75,
0x6e, 0x6b, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x0f, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72,
0x52, 0x0a, 0x68, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05,
0x6c, 0x69, 0x6e, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x69, 0x6e,
0x65, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x5f, 0x62, 0x61, 0x73, 0x65,
0x5f, 0x73, 0x68, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x65, 0x72, 0x67,
0x65, 0x42, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x12, 0x2a, 0x0a, 0x11, 0x6c, 0x61, 0x74, 0x65,
0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x73, 0x68, 0x61, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x53, 0x68, 0x61, 0x32, 0x96, 0x02, 0x0a, 0x0b, 0x44, 0x69, 0x66, 0x66, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x12, 0x35, 0x0a, 0x07, 0x52, 0x61, 0x77, 0x44, 0x69, 0x66, 0x66, 0x12,
0x52, 0x0a, 0x68, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c,
0x6c, 0x69, 0x6e, 0x65, 0x73, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0b, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12,
0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05,
0x6c, 0x69, 0x6e, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x5f, 0x62,
0x61, 0x73, 0x65, 0x5f, 0x73, 0x68, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d,
0x65, 0x72, 0x67, 0x65, 0x42, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x12, 0x2a, 0x0a, 0x11, 0x6c,
0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x73, 0x68, 0x61,
0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x53, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x53, 0x68, 0x61, 0x32, 0x96, 0x02, 0x0a, 0x0b, 0x44, 0x69, 0x66, 0x66,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x35, 0x0a, 0x07, 0x52, 0x61, 0x77, 0x44, 0x69,
0x66, 0x66, 0x12, 0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x61, 0x77, 0x44, 0x69,
0x66, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x3f,
0x0a, 0x0d, 0x44, 0x69, 0x66, 0x66, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x12,
0x10, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x61, 0x77, 0x44, 0x69, 0x66, 0x66, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x3f, 0x0a, 0x0d, 0x44,
0x69, 0x66, 0x66, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x12, 0x10, 0x2e, 0x72,
0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a,
0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x53, 0x74,
0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x57, 0x0a, 0x12,
0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65,
0x72, 0x73, 0x12, 0x1e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66,
0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66,
0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x07, 0x44, 0x69, 0x66, 0x66, 0x43, 0x75, 0x74,
0x12, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x43, 0x75, 0x74, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66,
0x43, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x27, 0x5a,
0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x72, 0x6e,
0x65, 0x73, 0x73, 0x2f, 0x67, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x2f, 0x67, 0x69, 0x74, 0x72,
0x70, 0x63, 0x2f, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x53, 0x68, 0x6f, 0x72,
0x74, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
0x57, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65,
0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x1e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x44,
0x69, 0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x44,
0x69, 0x66, 0x66, 0x48, 0x75, 0x6e, 0x6b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x07, 0x44, 0x69, 0x66, 0x66,
0x43, 0x75, 0x74, 0x12, 0x13, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x43, 0x75,
0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44,
0x69, 0x66, 0x66, 0x43, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68,
0x61, 0x72, 0x6e, 0x65, 0x73, 0x73, 0x2f, 0x67, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x2f, 0x67,
0x69, 0x74, 0x72, 0x70, 0x63, 0x2f, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (

View File

@ -120,7 +120,7 @@ func (c *Controller) CommentCreate(
setAsCodeComment(act, cut, in.Path, in.SourceCommitSHA)
_ = act.SetPayload(&types.PullRequestActivityPayloadCodeComment{
Title: cut.Header.Text,
Title: cut.LinesHeader,
Lines: cut.Lines,
AnyNew: cut.AnyNew,
})

View File

@ -30,7 +30,7 @@ type PullReqActivity struct {
Created int64 `json:"created"`
Updated int64 `json:"-"` // not returned, it's updated by the server internally. Clients should use EditedAt.
Edited int64 `json:"edited"`
Deleted *int64 `json:"deleted"`
Deleted *int64 `json:"deleted,omitempty"`
ParentID *int64 `json:"parent_id"`
RepoID int64 `json:"repo_id"`
@ -48,19 +48,19 @@ type PullReqActivity struct {
Metadata map[string]interface{} `json:"metadata"`
ResolvedBy *int64 `json:"-"` // not returned, because the resolver info is in the Resolver field
Resolved *int64 `json:"resolved"`
Resolved *int64 `json:"resolved,omitempty"`
Author PrincipalInfo `json:"author"`
Resolver *PrincipalInfo `json:"resolver"`
Resolver *PrincipalInfo `json:"resolver,omitempty"`
Outdated *bool `json:"outdated"`
CodeCommentMergeBaseSHA *string `json:"code_comment_merge_base_sha"`
CodeCommentSourceSHA *string `json:"code_comment_source_sha"`
CodeCommentPath *string `json:"code_comment_path"`
CodeCommentLineNew *int64 `json:"code_comment_line_new"`
CodeCommentSpanNew *int64 `json:"code_comment_span_new"`
CodeCommentLineOld *int64 `json:"code_comment_line_old"`
CodeCommentSpanOld *int64 `json:"code_comment_span_old"`
Outdated *bool `json:"outdated,omitempty"`
CodeCommentMergeBaseSHA *string `json:"code_comment_merge_base_sha,omitempty"`
CodeCommentSourceSHA *string `json:"code_comment_source_sha,omitempty"`
CodeCommentPath *string `json:"code_comment_path,omitempty"`
CodeCommentLineNew *int64 `json:"code_comment_line_new,omitempty"`
CodeCommentSpanNew *int64 `json:"code_comment_span_new,omitempty"`
CodeCommentLineOld *int64 `json:"code_comment_line_old,omitempty"`
CodeCommentSpanOld *int64 `json:"code_comment_span_old,omitempty"`
}
func (a *PullReqActivity) IsValidCodeComment() bool {