Skip to content

Commit 23804be

Browse files
committed
reintroduce linter
1 parent 3cc37a6 commit 23804be

File tree

6 files changed

+88
-82
lines changed

6 files changed

+88
-82
lines changed

.devcontainer/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ RUN sudo pacman -Syu --noconfirm pacman-contrib fish git-delta openssh bat go
77
# Set passwordless sudo for the docker user
88
RUN echo "docker ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/docker
99

10+
# Add /app/bin to the PATH
11+
ENV PATH="/app/bin:$PATH"
12+
1013
# Create a non-root user and switch to it
1114
USER docker
1215

.golangci.yml

Lines changed: 75 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,19 @@
1-
linters-settings:
2-
dupl:
3-
threshold: 100
4-
funlen:
5-
lines: 100
6-
statements: 50
7-
goconst:
8-
min-len: 3
9-
min-occurrences: 4
10-
gocritic:
11-
enabled-tags:
12-
- diagnostic
13-
- experimental
14-
- opinionated
15-
- performance
16-
- style
17-
gocyclo:
18-
min-complexity: 15
19-
goimports:
20-
local-prefixes: github.com/Jguer/yay/v12
21-
gomnd:
22-
checks:
23-
- argument
24-
- case
25-
- condition
26-
- return
27-
ignored-numbers:
28-
- "0"
29-
- "1"
30-
- "2"
31-
- "3"
32-
ignored-functions:
33-
- strings.SplitN
34-
lll:
35-
line-length: 140
36-
misspell:
37-
locale: US
38-
nolintlint:
39-
allow-unused: false # report any unused nolint directives
40-
require-explanation: false # don't require an explanation for nolint directives
41-
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
42-
1+
version: "2"
2+
run:
3+
go: "1.22"
434
linters:
44-
# please, do not use `enable-all`: it's deprecated and will be removed soon.
45-
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
46-
disable-all: true
5+
default: none
476
enable:
48-
- forbidigo
497
- bodyclose
8+
- copyloopvar
509
- dogsled
5110
- dupl
52-
- errorlint
5311
- errcheck
54-
- copyloopvar
55-
# - funlen # TOFIX
12+
- errorlint
13+
- forbidigo
5614
- gochecknoinits
57-
# - goconst # TOFIX
58-
# - gocritic
59-
# - gocyclo # TOFIX
60-
- gofmt
61-
- goimports
62-
# - gomnd # TOFIX
6315
- goprintffuncname
6416
- gosec
65-
- gosimple
6617
- govet
6718
- ineffassign
6819
- lll
@@ -71,32 +22,75 @@ linters:
7122
- noctx
7223
- nolintlint
7324
- staticcheck
74-
- stylecheck
75-
- typecheck
7625
- unconvert
7726
- unparam
7827
- unused
7928
- whitespace
80-
81-
run:
82-
go: "1.22"
83-
timeout: "10m"
84-
85-
issues:
86-
exclude-rules:
87-
- path: (.+)_test.go
88-
linters:
89-
- lll
90-
- revive
91-
- wsl
92-
- govet
93-
- godot
94-
- errcheck
95-
- stylecheck
96-
- dupl
97-
- gocritic
98-
- gochecknoinits
99-
- errorlint
100-
101-
exclude:
102-
- G204
29+
- revive
30+
settings:
31+
dupl:
32+
threshold: 100
33+
funlen:
34+
lines: 100
35+
statements: 50
36+
goconst:
37+
min-len: 3
38+
min-occurrences: 4
39+
gocritic:
40+
enabled-tags:
41+
- diagnostic
42+
- experimental
43+
- opinionated
44+
- performance
45+
- style
46+
gocyclo:
47+
min-complexity: 15
48+
lll:
49+
line-length: 140
50+
misspell:
51+
locale: US
52+
nolintlint:
53+
require-explanation: false
54+
require-specific: false
55+
allow-unused: false
56+
exclusions:
57+
generated: lax
58+
presets:
59+
- comments
60+
- common-false-positives
61+
- legacy
62+
- std-error-handling
63+
rules:
64+
- linters:
65+
- dupl
66+
- errcheck
67+
- errorlint
68+
- gochecknoinits
69+
- gocritic
70+
- godot
71+
- govet
72+
- lll
73+
- revive
74+
- staticcheck
75+
- wsl
76+
path: (.+)_test.go
77+
- path: (.+)\.go$
78+
text: G204
79+
paths:
80+
- third_party$
81+
- builtin$
82+
- examples$
83+
formatters:
84+
enable:
85+
- gofmt
86+
- goimports
87+
settings:
88+
goimports:
89+
local-prefixes:
90+
- github.com/Jguer/go-alpm/v2
91+
exclusions:
92+
generated: lax
93+
paths:
94+
- third_party$
95+
- builtin$
96+
- examples$

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"go.lintTool": "golangci-lint",
3+
"gopls": {
4+
"formatting.gofumpt": true,
5+
"formatting.local": "github.com/Jguer/go-alpm/v2"
6+
}
7+
}

callbacks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var (
3030
questionCallbackContextPool = callbackContextPool{}
3131
)
3232

33-
func DefaultLogCallback(ctx interface{}, lvl LogLevel, s string) {
33+
func DefaultLogCallback(_ interface{}, lvl LogLevel, s string) {
3434
if lvl <= DefaultLogLevel {
3535
fmt.Fprintln(os.Stdout, "go-alpm: ", s)
3636
}

callbacks_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"testing"
55

66
alpm "github.com/Jguer/go-alpm/v2"
7+
78
"github.com/stretchr/testify/require"
89
)
910

package_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"time"
1414

1515
alpm "github.com/Jguer/go-alpm/v2"
16+
1617
"github.com/stretchr/testify/assert"
1718
)
1819

0 commit comments

Comments
 (0)