Skip to content

Commit

Permalink
chore: fix lint issues
Browse files Browse the repository at this point in the history
chore: removed unwanted code
  • Loading branch information
rajesh-jonnalagadda committed Nov 11, 2024
1 parent 914bed8 commit e59800b
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 17 deletions.
7 changes: 0 additions & 7 deletions routers/web/repo/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -958,13 +958,11 @@ func ExcerptBlob(ctx *context.Context) {
section.Lines = append(section.Lines, lineSection)
}
}

for _, line := range section.Lines {
if line.SectionInfo != nil {
//for now considerign only right side.
start := int64(line.SectionInfo.LastRightIdx + 1)
end := int64(line.SectionInfo.RightIdx - 1)

//to check section has comments or not.
//1. we can use binary search
//2. we can LastRightCommentIdx, RightCommentIdx, LastLeftCommentIdx, LeftCommentIdx(little complex but fast)
Expand All @@ -977,11 +975,9 @@ func ExcerptBlob(ctx *context.Context) {
line.SectionInfo.HasComments = true
break
}

}
start += 1

Check failure on line 979 in routers/web/repo/compare.go

View workflow job for this annotation

GitHub Actions / lint-backend

increment-decrement: should replace start += 1 with start++ (revive)

Check failure on line 979 in routers/web/repo/compare.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

increment-decrement: should replace start += 1 with start++ (revive)

Check failure on line 979 in routers/web/repo/compare.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

increment-decrement: should replace start += 1 with start++ (revive)
}

}
if comments, ok := lineCommits[int64(line.LeftIdx*-1)]; ok {
line.Comments = append(line.Comments, comments...)
Expand All @@ -994,7 +990,6 @@ func ExcerptBlob(ctx *context.Context) {
return line.Comments[i].CreatedUnix < line.Comments[j].CreatedUnix
})
}

for _, line := range section.Lines {
for _, comment := range line.Comments {
if err := comment.LoadAttachments(ctx); err != nil {
Expand All @@ -1003,7 +998,6 @@ func ExcerptBlob(ctx *context.Context) {
}
}
}

ctx.Data["section"] = section
ctx.Data["FileNameHash"] = git.HashFilePathForWebUI(filePath)
ctx.Data["AfterCommitID"] = commitID
Expand All @@ -1014,7 +1008,6 @@ func ExcerptBlob(ctx *context.Context) {
ctx.Data["CanBlockUser"] = func(blocker, blockee *user_model.User) bool {
return user_service.CanBlockUser(ctx, ctx.Doer, blocker, blockee)
}

if ctx.Data["SignedUserID"] == nil {
ctx.Data["SignedUserID"] = ctx.Doer.ID
}
Expand Down
4 changes: 0 additions & 4 deletions services/gitdiff/gitdiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,20 +485,16 @@ func (diff *Diff) LoadComments(ctx context.Context, issue *issues_model.Issue, c
if line.SectionInfo != nil {
start := int64(line.SectionInfo.LastRightIdx + 1)
end := int64(line.SectionInfo.RightIdx - 1)

for start <= end {
if _, ok := lineCommits[start]; ok {
if line.SectionInfo.LastRightCommentIdx == 0 {
// line.SectionInfo.LastRightCommentIdx = int(start)
// line.SectionInfo.RightCommentIdx = int(start)
line.SectionInfo.HasComments = true

break
}

}
start += 1

Check failure on line 497 in services/gitdiff/gitdiff.go

View workflow job for this annotation

GitHub Actions / lint-backend

increment-decrement: should replace start += 1 with start++ (revive)

Check failure on line 497 in services/gitdiff/gitdiff.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

increment-decrement: should replace start += 1 with start++ (revive)

Check failure on line 497 in services/gitdiff/gitdiff.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

increment-decrement: should replace start += 1 with start++ (revive)

}
}
if comments, ok := lineCommits[int64(line.LeftIdx*-1)]; ok {
Expand Down
3 changes: 0 additions & 3 deletions templates/repo/diff/blob_excerpt.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,16 @@
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=down&wiki={{$.PageIsWiki}}&pull={{$.PageIsPullFiles}}&anchor={{$.Anchor}}&file_name={{$.section.FileName}}">
{{svg "octicon-fold-down"}}
</button>
test else down blob {{$line.SectionInfo.HasComments}}
{{end}}
{{if or (eq $expandDirection 3) (eq $expandDirection 4)}}
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=up&wiki={{$.PageIsWiki}}&pull={{$.PageIsPullFiles}}&anchor={{$.Anchor}}&file_name={{$.section.FileName}}">
{{svg "octicon-fold-up"}}
</button>
test else up blob
{{end}}
{{if eq $expandDirection 2}}
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=&wiki={{$.PageIsWiki}}&pull={{$.PageIsPullFiles}}&anchor={{$.Anchor}}&file_name={{$.section.FileName}}">
{{svg "octicon-fold"}}
</button>
test else both blob
{{end}}
</div>
</div>
Expand Down
3 changes: 0 additions & 3 deletions templates/repo/diff/section_unified.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,16 @@
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=down&wiki={{$.root.PageIsWiki}}&pull={{$.root.PageIsPullFiles}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}&file_name={{$section.FileName}}">
{{svg "octicon-fold-down"}}
</button>
test down
{{end}}
{{if or (eq $expandDirection 3) (eq $expandDirection 4)}}
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=up&wiki={{$.root.PageIsWiki}}&pull={{$.root.PageIsPullFiles}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}&file_name={{$section.FileName}}">
{{svg "octicon-fold-up"}}
</button>
test up
{{end}}
{{if eq $expandDirection 2}}
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=&wiki={{$.root.PageIsWiki}}&pull={{$.root.PageIsPullFiles}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}&file_name={{$section.FileName}}">
{{svg "octicon-fold"}}
</button>
test fold
{{end}}
</div>
</div>
Expand Down

0 comments on commit e59800b

Please sign in to comment.