Skip to content
Myr

ci(lint): fix all lint issues on `main` (#1342)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Andrey Nering · committed by GitHub · parent bf1216d · Browse files · 7 files+38 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

7 files+38 added−9 removed

  • other:+38 added−9 removed

7 files+38 added−9 removed

modified:inputreader_other.go+6 added-1 removed
2 unmodified lines
34package tea56import (7 "fmt"8 "io"910 "github.com/muesli/cancelreader"11)1213func newInputReader(r io.Reader, _ bool) (cancelreader.CancelReader, error) {13 return cancelreader.NewReader(r)14 cr, err := cancelreader.NewReader(r)15 if err != nil {16 return nil, fmt.Errorf("bubbletea: error creating cancel reader: %w", err)17 }18 return cr, nil19}
modified:key_sequences.go+2 added-3 removed
117 unmodified lines
118 return true, inputLen, KeyMsg(k)119}120121// detectReportFocus detects a focus report sequence.122// nolint: gomnd122func detectReportFocus(input []byte) (hasRF bool, width int, msg Msg) {123 switch {124 case bytes.Equal(input, []byte("\x1b[I")):126 return true, 3, FocusMsg{}125 return true, 3, FocusMsg{} //nolint:mnd126 case bytes.Equal(input, []byte("\x1b[O")):128 return true, 3, BlurMsg{}127 return true, 3, BlurMsg{} //nolint:mnd128 }129 return false, 0, nil130}
modified:key.go+1 added-1 removed
620 unmodified lines
621 return mouseEventX10Len, MouseMsg(parseX10MouseEvent(b))622 case '<':623 if matchIndices := mouseSGRRegex.FindSubmatchIndex(b[3:]); matchIndices != nil {624 // SGR mouse events length is the length of the match plus the length of the escape sequence625 mouseEventSGRLen := matchIndices[1] + 3 //nolint:gomnd625 mouseEventSGRLen := matchIndices[1] + 3 //nolint:mnd626 return mouseEventSGRLen, MouseMsg(parseSGRMouseEvent(b))627 }628 }629 }
86 unmodified lines
modified:logging.go+1 added-1 removed
31 unmodified lines
32}3334// LogToFileWith does allows to call LogToFile with a custom LogOptionsSetter.35func LogToFileWith(path string, prefix string, log LogOptionsSetter) (*os.File, error) {36 f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0o600) //nolint:gomnd36 f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0o600) //nolint:mnd37 if err != nil {38 return nil, fmt.Errorf("error opening file for logging: %w", err)39 }40 log.SetOutput(f)
13 unmodified lines
modified:mouse.go+1 added-1 removed
170 unmodified lines
171// https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Extended-coordinates172func parseSGRMouseEvent(buf []byte) MouseEvent {173 str := string(buf[3:])174 matches := mouseSGRRegex.FindStringSubmatch(str)175 if len(matches) != 5 { //nolint:gomnd175 if len(matches) != 5 { //nolint:mnd176 // Unreachable, we already checked the regex in `detectOneMsg`.177 panic("invalid mouse event")178 }179
129 unmodified lines
added:Taskfile.yaml+25 added
modified:tty.go+2 added-2 removed
50 unmodified lines
51 if p.renderer.altScreen() {52 p.renderer.exitAltScreen()5354 // give the terminal a moment to catch up55 time.Sleep(time.Millisecond * 10) //nolint:gomnd55 time.Sleep(time.Millisecond * 10) //nolint:mnd56 }57 }5859 return p.restoreInput()
48 unmodified lines
108// waitForReadLoop waits for the cancelReader to finish its read loop.109func (p *Program) waitForReadLoop() {110 select {111 case <-p.readLoopDone:112 case <-time.After(500 * time.Millisecond): //nolint:gomnd112 case <-time.After(500 * time.Millisecond): //nolint:mnd113 // The read loop hangs, which means the input114 // cancelReader's cancel function has returned true even115 // though it was not able to cancel the read.116 }
25 unmodified lines