Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(lint): update soft lint directives; fix soft lint issues #423

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions align.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func alignTextHorizontal(str string, pos Position, width int, style *ansi.Style)
l = s + l
case Center:
// Note: remainder goes on the right.
left := shortAmount / 2 //nolint:gomnd
right := left + shortAmount%2 //nolint:gomnd
left := shortAmount / 2 //nolint:mnd
right := left + shortAmount%2 //nolint:mnd

leftSpaces := strings.Repeat(" ", left)
rightSpaces := strings.Repeat(" ", right)
Expand Down Expand Up @@ -68,7 +68,7 @@ func alignTextVertical(str string, pos Position, height int, _ *ansi.Style) stri
case Top:
return str + strings.Repeat("\n", height-strHeight)
case Center:
topPadding, bottomPadding := (height-strHeight)/2, (height-strHeight)/2 //nolint:gomnd
topPadding, bottomPadding := (height-strHeight)/2, (height-strHeight)/2 //nolint:mnd
if strHeight+topPadding+bottomPadding > height {
topPadding--
} else if strHeight+topPadding+bottomPadding < height {
Expand Down
14 changes: 7 additions & 7 deletions color.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type NoColor struct{}
//
// Red: 0x0, Green: 0x0, Blue: 0x0, Alpha: 0xFFFF.
func (n NoColor) RGBA() (r, g, b, a uint32) {
return 0x0, 0x0, 0x0, 0xFFFF //nolint:gomnd
return 0x0, 0x0, 0x0, 0xFFFF //nolint:mnd
}

// Color specifies a color by hex or ANSI256 value. For example:
Expand All @@ -66,18 +66,18 @@ func Color(c any) color.Color {
if h, err := colorful.Hex(c); err == nil {
return h
} else if i, err := strconv.Atoi(c); err == nil {
if i < 16 { //nolint:gomnd
if i < 16 { //nolint:mnd
return ansi.BasicColor(i) //nolint:gosec
} else if i < 256 { //nolint:gomnd
} else if i < 256 { //nolint:mnd
return ansi.ExtendedColor(i) //nolint:gosec
}
return ansi.TrueColor(i) //nolint:gosec
}
return noColor
case int:
if c < 16 {
if c < 16 { //nolint:mnd
return ansi.BasicColor(c) //nolint:gosec
} else if c < 256 {
} else if c < 256 { //nolint:mnd
return ansi.ExtendedColor(c) //nolint:gosec
}
return ansi.TrueColor(c) //nolint:gosec
Expand All @@ -101,7 +101,7 @@ func (c RGBColor) RGBA() (r, g, b, a uint32) {
r |= uint32(c.R) << shift
g |= uint32(c.G) << shift
b |= uint32(c.B) << shift
a = 0xFFFF //nolint:gomnd
a = 0xFFFF
return
}

Expand Down Expand Up @@ -177,5 +177,5 @@ func isDarkColor(c color.Color) bool {
}

_, _, l := col.Hsl()
return l < 0.5
return l < 0.5 //nolint:mnd
}
18 changes: 9 additions & 9 deletions set.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,19 +705,19 @@ func whichSidesInt(i ...int) (top, right, bottom, left int, ok bool) {
left = i[0]
right = i[0]
ok = true
case 2: //nolint:gomnd
case 2: //nolint:mnd
top = i[0]
bottom = i[0]
left = i[1]
right = i[1]
ok = true
case 3: //nolint:gomnd
case 3: //nolint:mnd
top = i[0]
left = i[1]
right = i[1]
bottom = i[2]
ok = true
case 4: //nolint:gomnd
case 4: //nolint:mnd
top = i[0]
right = i[1]
bottom = i[2]
Expand All @@ -738,19 +738,19 @@ func whichSidesBool(i ...bool) (top, right, bottom, left bool, ok bool) {
left = i[0]
right = i[0]
ok = true
case 2: //nolint:gomnd
case 2: //nolint:mnd
top = i[0]
bottom = i[0]
left = i[1]
right = i[1]
ok = true
case 3: //nolint:gomnd
case 3: //nolint:mnd
top = i[0]
left = i[1]
right = i[1]
bottom = i[2]
ok = true
case 4: //nolint:gomnd
case 4: //nolint:mnd
top = i[0]
right = i[1]
bottom = i[2]
Expand All @@ -771,19 +771,19 @@ func whichSidesColor(i ...color.Color) (top, right, bottom, left color.Color, ok
left = i[0]
right = i[0]
ok = true
case 2: //nolint:gomnd
case 2: //nolint:mnd
top = i[0]
bottom = i[0]
left = i[1]
right = i[1]
ok = true
case 3: //nolint:gomnd
case 3: //nolint:mnd
top = i[0]
left = i[1]
right = i[1]
bottom = i[2]
ok = true
case 4: //nolint:gomnd
case 4: //nolint:mnd
top = i[0]
right = i[1]
bottom = i[2]
Expand Down
4 changes: 2 additions & 2 deletions table/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ func median(n []int) int {
return 0
}
if len(n)%2 == 0 {
h := len(n) / 2 //nolint:gomnd
return (n[h-1] + n[h]) / 2 //nolint:gomnd
h := len(n) / 2 //nolint:mnd
return (n[h-1] + n[h]) / 2 //nolint:mnd
}
return n[len(n)/2]
}
Expand Down
4 changes: 2 additions & 2 deletions terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
//
// copied from x/term@v0.1.3.
func queryBackgroundColor(in io.Reader, out io.Writer) (c color.Color, err error) {
// nolint: errcheck
//nolint: errcheck
err = queryTerminal(in, out, defaultQueryTimeout,
func(events []input.Event) bool {
for _, e := range events {
Expand Down Expand Up @@ -84,7 +84,7 @@ func queryTerminal(
for {
events, err := rd.ReadEvents()
if err != nil {
return err
return fmt.Errorf("could not read events: %s", err)
}

if !filter(events) {
Expand Down
Loading