commit 2eaf8b6

Hubert Hirtz  ·  2021-09-13 12:10:09 +0000 UTC
parent b4f3d87
More lints
6 files changed,  +19, -26
+2, -2
 1@@ -296,9 +296,9 @@ func commandDoNick(app *App, buffer string, args []string) (err error) {
 2 func commandDoMode(app *App, buffer string, args []string) (err error) {
 3 	channel := args[0]
 4 	flags := args[1]
 5-	mode_args := args[2:]
 6+	modeArgs := args[2:]
 7 
 8-	app.s.ChangeMode(channel, flags, mode_args)
 9+	app.s.ChangeMode(channel, flags, modeArgs)
10 	return
11 }
12 
+2, -9
 1@@ -22,7 +22,7 @@ func CasemapASCII(name string) string {
 2 	return sb.String()
 3 }
 4 
 5-// CasemapASCII of name is the canonical representation of name according to the
 6+// CasemapRFC1459 of name is the canonical representation of name according to the
 7 // rfc-1459 casemapping.
 8 func CasemapRFC1459(name string) string {
 9 	var sb strings.Builder
10@@ -57,7 +57,7 @@ func word(s string) (word, rest string) {
11 	return
12 }
13 
14-// tagEscape returns the the value of '\c' given c according to the message-tags
15+// tagEscape returns the value of '\c' given c according to the message-tags
16 // specification.
17 func tagEscape(c rune) (escape rune) {
18 	switch c {
19@@ -157,13 +157,6 @@ var (
20 	errIncompleteMessage = errors.New("message is incomplete")
21 )
22 
23-var (
24-	errEmptyBatchID    = errors.New("empty BATCH ID")
25-	errNoPrefix        = errors.New("missing prefix")
26-	errNotEnoughParams = errors.New("not enough params")
27-	errUnknownCommand  = errors.New("unknown command")
28-)
29-
30 type Prefix struct {
31 	Name string
32 	User string
+1, -1
1@@ -69,7 +69,7 @@ func (ts *Typings) Active(target, name string) {
2 	}()
3 }
4 
5-// Active should be called when a user is done typing to some target.
6+// Done should be called when a user is done typing to some target.
7 func (ts *Typings) Done(target, name string) {
8 	ts.l.Lock()
9 	delete(ts.targets, Typing{target, name})
+3, -3
 1@@ -2,8 +2,8 @@ package ui
 2 
 3 import "testing"
 4 
 5-var hell Editor = Editor{
 6-	text:      [][]rune{[]rune{'h', 'e', 'l', 'l'}},
 7+var hell = Editor{
 8+	text:      [][]rune{{'h', 'e', 'l', 'l'}},
 9 	textWidth: []int{0, 1, 2, 3, 4},
10 	cursorIdx: 4,
11 	offsetIdx: 0,
12@@ -55,7 +55,7 @@ func TestOneLetter(t *testing.T) {
13 	e.Resize(5)
14 	e.PutRune('h')
15 	assertEditorEq(t, e, Editor{
16-		text:      [][]rune{[]rune{'h'}},
17+		text:      [][]rune{{'h'}},
18 		textWidth: []int{0, 1},
19 		cursorIdx: 1,
20 		offsetIdx: 0,
+1, -1
1@@ -10,7 +10,7 @@ import (
2 	"github.com/mattn/go-runewidth"
3 )
4 
5-var condition runewidth.Condition = runewidth.Condition{}
6+var condition = runewidth.Condition{}
7 
8 func runeWidth(r rune) int {
9 	return condition.RuneWidth(r)
+10, -10
 1@@ -35,62 +35,62 @@ func TestIRCString(t *testing.T) {
 2 	assertIRCString(t, "\x02hello", StyledString{
 3 		string: "hello",
 4 		styles: []rangedStyle{
 5-			rangedStyle{Start: 0, Style: tcell.StyleDefault.Bold(true)},
 6+			{Start: 0, Style: tcell.StyleDefault.Bold(true)},
 7 		},
 8 	})
 9 	assertIRCString(t, "\x035hello", StyledString{
10 		string: "hello",
11 		styles: []rangedStyle{
12-			rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
13+			{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
14 		},
15 	})
16 	assertIRCString(t, "\x0305hello", StyledString{
17 		string: "hello",
18 		styles: []rangedStyle{
19-			rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
20+			{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
21 		},
22 	})
23 	assertIRCString(t, "\x0305,0hello", StyledString{
24 		string: "hello",
25 		styles: []rangedStyle{
26-			rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
27+			{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
28 		},
29 	})
30 	assertIRCString(t, "\x035,00hello", StyledString{
31 		string: "hello",
32 		styles: []rangedStyle{
33-			rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
34+			{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
35 		},
36 	})
37 	assertIRCString(t, "\x0305,00hello", StyledString{
38 		string: "hello",
39 		styles: []rangedStyle{
40-			rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
41+			{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
42 		},
43 	})
44 
45 	assertIRCString(t, "\x035,hello", StyledString{
46 		string: ",hello",
47 		styles: []rangedStyle{
48-			rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
49+			{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
50 		},
51 	})
52 	assertIRCString(t, "\x0305,hello", StyledString{
53 		string: ",hello",
54 		styles: []rangedStyle{
55-			rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
56+			{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
57 		},
58 	})
59 	assertIRCString(t, "\x03050hello", StyledString{
60 		string: "0hello",
61 		styles: []rangedStyle{
62-			rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
63+			{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)},
64 		},
65 	})
66 	assertIRCString(t, "\x0305,000hello", StyledString{
67 		string: "0hello",
68 		styles: []rangedStyle{
69-			rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
70+			{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)},
71 		},
72 	})
73 }