Skip to content

Commit

Permalink
chore(lint): add various nolint directives
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed May 8, 2024
1 parent d7f841e commit 671358b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion key.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ func detectOneMsg(b []byte, canHaveMoreData bool) (w int, msg Msg) {
case '<':
if matchIndices := mouseSGRRegex.FindSubmatchIndex(b[3:]); matchIndices != nil {
// SGR mouse events length is the length of the match plus the length of the escape sequence
mouseEventSGRLen := matchIndices[1] + 3
mouseEventSGRLen := matchIndices[1] + 3 //nolint:gomnd
return mouseEventSGRLen, MouseMsg(parseSGRMouseEvent(b))
}
}
Expand Down
6 changes: 3 additions & 3 deletions mouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (m MouseEvent) String() (s string) {
s += "shift+"
}

if m.Button == MouseButtonNone {
if m.Button == MouseButtonNone { //nolint:nestif
if m.Action == MouseActionMotion || m.Action == MouseActionRelease {
s += mouseActions[m.Action]
} else {
Expand Down Expand Up @@ -172,7 +172,7 @@ const (
func parseSGRMouseEvent(buf []byte) MouseEvent {
str := string(buf[3:])
matches := mouseSGRRegex.FindStringSubmatch(str)
if len(matches) != 5 {
if len(matches) != 5 { //nolint:gomnd
// Unreachable, we already checked the regex in `detectOneMsg`.
panic("invalid mouse event")
}
Expand Down Expand Up @@ -288,7 +288,7 @@ func parseMouseButton(b int, isSGR bool) MouseEvent {
m.Type = MouseForward
case m.Action == MouseActionMotion:
m.Type = MouseMotion
switch m.Button {
switch m.Button { //nolint:exhaustive
case MouseButtonLeft:
m.Type = MouseLeft
case MouseButtonMiddle:
Expand Down

0 comments on commit 671358b

Please sign in to comment.