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

Fix lint comments (godot) #160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion ansicolors.go
@@ -1,6 +1,6 @@
package termenv

// ANSI color codes
// ANSI color codes.
const (
ANSIBlack ANSIColor = iota
ANSIRed
Expand Down
2 changes: 1 addition & 1 deletion color.go
Expand Up @@ -14,7 +14,7 @@
ErrInvalidColor = errors.New("invalid color")
)

// Foreground and Background sequence codes
// Foreground and Background sequence codes.
const (
Foreground = "38"
Background = "48"
Expand Down Expand Up @@ -83,9 +83,9 @@
}

if col < 8 {
return fmt.Sprintf("%d", bgMod(col)+30)

Check failure on line 86 in color.go

View workflow job for this annotation

GitHub Actions / lint-soft

mnd: Magic number: 30, in <argument> detected (gomnd)
}
return fmt.Sprintf("%d", bgMod(col-8)+90)

Check failure on line 88 in color.go

View workflow job for this annotation

GitHub Actions / lint-soft

mnd: Magic number: 90, in <argument> detected (gomnd)
}

// Sequence returns the ANSI Sequence for the color.
Expand All @@ -108,7 +108,7 @@
if bg {
prefix = Background
}
return fmt.Sprintf("%s;2;%d;%d;%d", prefix, uint8(f.R*255), uint8(f.G*255), uint8(f.B*255))

Check failure on line 111 in color.go

View workflow job for this annotation

GitHub Actions / lint-soft

mnd: Magic number: 255, in <argument> detected (gomnd)
}

func xTermColor(s string) (RGBColor, error) {
Expand Down Expand Up @@ -166,13 +166,13 @@
if v < 115 {
return 1
}
return int((v - 35) / 40)

Check failure on line 169 in color.go

View workflow job for this annotation

GitHub Actions / lint-soft

mnd: Magic number: 40, in <argument> detected (gomnd)
}

// Calculate the nearest 0-based color index at 16..231
r := v2ci(c.R * 255.0) // 0..5 each

Check failure on line 173 in color.go

View workflow job for this annotation

GitHub Actions / lint-soft

mnd: Magic number: 255.0, in <argument> detected (gomnd)
g := v2ci(c.G * 255.0)

Check failure on line 174 in color.go

View workflow job for this annotation

GitHub Actions / lint-soft

mnd: Magic number: 255.0, in <argument> detected (gomnd)
b := v2ci(c.B * 255.0)

Check failure on line 175 in color.go

View workflow job for this annotation

GitHub Actions / lint-soft

mnd: Magic number: 255.0, in <argument> detected (gomnd)
ci := 36*r + 6*g + b /* 0..215 */

// Calculate the represented colors back from the index
Expand All @@ -198,7 +198,7 @@
grayDist := c.DistanceHSLuv(g2)

if colorDist <= grayDist {
return ANSI256Color(16 + ci)

Check failure on line 201 in color.go

View workflow job for this annotation

GitHub Actions / lint-soft

mnd: Magic number: 16, in <argument> detected (gomnd)
}
return ANSI256Color(232 + grayIdx)

Check failure on line 203 in color.go

View workflow job for this annotation

GitHub Actions / lint-soft

mnd: Magic number: 232, in <argument> detected (gomnd)
}
8 changes: 4 additions & 4 deletions profile.go
Expand Up @@ -12,13 +12,13 @@ import (
type Profile int

const (
// TrueColor, 24-bit color profile
// TrueColor, 24-bit color profile.
TrueColor = Profile(iota)
// ANSI256, 8-bit color profile
// ANSI256, 8-bit color profile.
ANSI256
// ANSI, 4-bit color profile
// ANSI, 4-bit color profile.
ANSI
// Ascii, uncolored profile
// Ascii, uncolored profile.
Ascii //nolint:revive
)

Expand Down
10 changes: 5 additions & 5 deletions termenv.go
Expand Up @@ -13,15 +13,15 @@ var (
)

const (
// Escape character
// Escape character.
ESC = '\x1b'
// Bell
// Bell.
BEL = '\a'
// Control Sequence Introducer
// Control Sequence Introducer.
CSI = string(ESC) + "["
// Operating System Command
// Operating System Command.
OSC = string(ESC) + "]"
// String Terminator
// String Terminator.
ST = string(ESC) + `\`
)

Expand Down