Skip to content

Commit 30ddf78

Browse files
committed
Merge branch 'feat-add-golangci-lint'
2 parents 494d354 + 3aa263b commit 30ddf78

File tree

4 files changed

+75
-6
lines changed

4 files changed

+75
-6
lines changed

.golangci.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
version: "2"
2+
linters:
3+
enable:
4+
- containedctx
5+
- copyloopvar
6+
- dogsled
7+
- dupl
8+
- durationcheck
9+
- errchkjson
10+
- errorlint
11+
- bodyclose
12+
- exhaustive
13+
- forcetypeassert
14+
- gochecknoglobals
15+
- goconst
16+
- gocritic
17+
- gomoddirectives
18+
- gomodguard
19+
- goprintffuncname
20+
- gosec
21+
- importas
22+
- misspell
23+
- nakedret
24+
- nestif
25+
- nilerr
26+
- noctx
27+
- nilnil
28+
- nonamedreturns
29+
- prealloc
30+
- predeclared
31+
- revive
32+
- testpackage
33+
- rowserrcheck
34+
- sqlclosecheck
35+
- tparallel
36+
- unconvert
37+
- unparam
38+
- wastedassign
39+
- whitespace
40+
- wrapcheck
41+
exclusions:
42+
generated: lax
43+
presets:
44+
- comments
45+
- common-false-positives
46+
- legacy
47+
- std-error-handling
48+
rules:
49+
- linters:
50+
- lll
51+
path: _test\.go
52+
paths:
53+
- third_party$
54+
- builtin$
55+
- examples$
56+
settings:
57+
gomoddirectives:
58+
replace-local: true
59+
retract-allow-no-explanation: true
60+
formatters:
61+
enable:
62+
- gofmt
63+
exclusions:
64+
generated: lax
65+
paths:
66+
- third_party$
67+
- builtin$
68+
- examples$
69+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Pull requests are welcome! Just ensure no bunnies are harmed during the process.
116116

117117
### Testing & Quality Assurance
118118
- [ ] **Add unit tests**
119-
- [ ] **Set up golangci-lint** with `.golangci.yml` configuration
119+
- [x] **Set up golangci-lint** with `.golangci.yml` configuration
120120

121121
### CI/CD & Automation
122122
- [ ] **GitHub Actions workflow** Once tests are in place enable `ci.yml`

cmd/bunnysign/main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,16 @@ type CLIConfig struct {
1414
}
1515

1616
func parseFlags() CLIConfig {
17-
clear := flag.Bool("c", false, "Clear the bunny after showing the message")
17+
clearLastFrame := flag.Bool("c", false, "Clear the bunny after showing the message")
1818
debug := flag.Bool("debug", false, "Debug CLI features")
1919
flag.Parse()
2020
return CLIConfig{
21-
Clear: *clear,
21+
Clear: *clearLastFrame,
2222
Debug: *debug,
2323
}
2424
}
2525

2626
func main() {
27-
2827
config := parseFlags()
2928

3029
phrases := flag.Args() // os.Args[1:]

logupdate/logupdate.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@ import (
1212
// CreatePlayer is a HOF: creates an animation player function that manages frame updates.
1313
// It takes the FrameGenerator function and returns another function that displays the animated content.
1414
// Thjis returned function handles clearing previous frames and displaying new ones with timing.
15-
func CreatePlayer(FrameGenerator func(content string) string) func(content string) int {
15+
func CreatePlayer(frameGenerator func(content string) string) func(content string) int {
1616
previousFrameLines := 0
1717

1818
return func(content string) int {
1919
if previousFrameLines > 0 {
2020
ClearLines(previousFrameLines)
2121
}
2222
// print the frame
23-
frame := FrameGenerator(content)
23+
frame := frameGenerator(content)
2424
fmt.Printf("%s\n", frame)
2525

2626
previousFrameLines = strings.Count(frame, "\n") + 1
2727
// wait random to print the new frame
28+
//nolint:gosec
2829
time.Sleep(time.Duration(rand.Intn(300)+100) * time.Millisecond)
2930

3031
return previousFrameLines

0 commit comments

Comments
 (0)