1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-07 22:02:56 +03:00

add some more linters

This commit is contained in:
Jesse Duffield
2022-01-08 15:46:35 +11:00
parent 5d6d894286
commit 18f48a43d5
37 changed files with 104 additions and 60 deletions

View File

@@ -22,7 +22,7 @@ func GetHeaderFromDiff(diff string) string {
func GetHunksFromDiff(diff string) []*PatchHunk {
hunks := []*PatchHunk{}
firstLineIdx := -1
var hunkLines []string
var hunkLines []string //nolint:prealloc
pastDiffHeader := false
for lineIdx, line := range strings.SplitAfter(diff, "\n") {

View File

@@ -511,6 +511,7 @@ func TestModifyPatchForRange(t *testing.T) {
}
for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
result := ModifiedPatchForRange(nil, s.filename, s.diffText, s.firstLineIndex, s.lastLineIndex, s.reverse, false)
if !assert.Equal(t, s.expected, result) {
@@ -538,6 +539,7 @@ func TestLineNumberOfLine(t *testing.T) {
}
for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
result := s.hunk.LineNumberOfLine(s.idx)
if !assert.Equal(t, s.expected, result) {

View File

@@ -98,7 +98,7 @@ func (l *PatchLine) render(selected bool, included bool) string {
return coloredString(style.FgCyan, match[1], selected, included) + coloredString(theme.DefaultTextColor, match[2], selected, false)
}
textStyle := theme.DefaultTextColor
var textStyle style.TextStyle
switch l.Kind {
case PATCH_HEADER:
textStyle = textStyle.SetBold()
@@ -108,6 +108,8 @@ func (l *PatchLine) render(selected bool, included bool) string {
textStyle = style.FgRed
case COMMIT_SHA:
textStyle = style.FgYellow
default:
textStyle = theme.DefaultTextColor
}
return coloredString(textStyle, content, selected, included)