Skip to content

Commit 5b3dd78

Browse files
chore: Bump golangci/golangci-lint-action from 6 to 7 (#226)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jahvon Dockery <[email protected]>
1 parent 065ad5c commit 5b3dd78

File tree

8 files changed

+133
-115
lines changed

8 files changed

+133
-115
lines changed

.github/workflows/analyze.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ jobs:
5252
with:
5353
go-version: "^1.24"
5454
- name: golangci-lint
55-
uses: golangci/golangci-lint-action@v6
55+
uses: golangci/golangci-lint-action@v7
5656
with:
57-
version: v1.64.5
58-
args: --out-format=sarif:results.sarif,colored-line-number,github-actions
57+
version: v2.1.6
58+
args: --output.sarif.path=results.sarif
5959
- name: Upload SARIF file
6060
uses: github/codeql-action/upload-sarif@v3
6161
with:

.golangci.yaml

Lines changed: 108 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,112 @@
1-
run:
2-
timeout: 2m
3-
4-
linters-settings:
5-
cyclop:
6-
max-complexity: 30
7-
package-average: 10.0
8-
errcheck:
9-
check-type-assertions: true
10-
funlen:
11-
lines: 100
12-
statements: 50
13-
ignore-comments: true
14-
gocognit:
15-
min-complexity: 30
16-
govet:
17-
enable-all: true
18-
disable:
19-
- fieldalignment # too strict
20-
1+
version: "2"
212
linters:
22-
disable-all: true
3+
default: none
234
enable:
24-
## enabled by default
25-
- errcheck # checking for unchecked errors, these unchecked errors can be critical bugs in some cases
26-
- gosimple # specializes in simplifying a code
27-
- govet # reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
28-
- ineffassign # detects when assignments to existing variables are not used
29-
- staticcheck # is a go vet on steroids, applying a ton of static analysis checks
30-
- typecheck # like the front-end of a Go compiler, parses and type-checks Go code
31-
- unused # checks for unused constants, variables, functions and types
32-
## disabled by default
33-
- asciicheck # checks that your code does not contain non-ASCII identifiers
34-
- bidichk # checks for dangerous unicode character sequences
35-
- bodyclose # checks whether HTTP response body is closed successfully
36-
- cyclop # checks function and package cyclomatic complexity
37-
- dupl # tool for code clone detection
38-
- durationcheck # checks for two durations multiplied together
39-
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
40-
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
41-
- funlen # tool for detection of long functions
42-
- gocognit # computes and checks the cognitive complexity of functions
43-
- goconst # finds repeated strings that could be replaced by a constant
44-
- gocritic # provides diagnostics that check for bugs, performance and style issues
45-
- gocyclo # computes and checks the cyclomatic complexity of functions
46-
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt
47-
- gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
48-
- gosec # inspects source code for security problems
49-
- lll # reports long lines
50-
- loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap)
51-
- makezero # finds slice declarations with non-zero initial length
52-
- nakedret # finds naked returns in functions greater than a specified function length
53-
- nestif # reports deeply nested if statements
54-
- nilerr # finds the code that returns nil even if it checks that the error is not nil
55-
- nilnil # checks that there is no simultaneous return of nil error and an invalid value
56-
- noctx # finds sending http request without context.Context
57-
- nolintlint # reports ill-formed or insufficient nolint directives
58-
- nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL
59-
- predeclared # finds code that shadows one of Go's predeclared identifiers
60-
- reassign # checks that package variables are not reassigned
61-
- stylecheck # is a replacement for golint
62-
- usetesting # detects when some calls can be replaced by methods from the testing package
63-
- testableexamples # checks if examples are testable (have an expected output)
64-
- testpackage # makes you use a separate _test package
65-
- tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
66-
- unconvert # removes unnecessary type conversions
67-
- unparam # reports unused function parameters
68-
- usestdlibvars # detects the possibility to use variables/constants from the Go standard library
69-
- wastedassign # finds wasted assignment statements
70-
- whitespace # detects leading and trailing whitespace
71-
- zerologlint # detects the wrong usage of zerolog that a user forgets to dispatch zerolog.Event
72-
- decorder # checks declaration order and count of types, constants, variables and functions
73-
- ginkgolinter # [if you use ginkgo/gomega] enforces standards of using ginkgo and gomega
74-
- interfacebloat # checks the number of methods inside an interface
75-
- tagalign # checks that struct tags are well aligned
76-
5+
- asciicheck
6+
- bidichk
7+
- bodyclose
8+
- cyclop
9+
- decorder
10+
- dupl
11+
- durationcheck
12+
- errcheck
13+
- errname
14+
- errorlint
15+
- funlen
16+
- ginkgolinter
17+
- gocognit
18+
- goconst
19+
- gocritic
20+
- gocyclo
21+
- gomoddirectives
22+
- gosec
23+
- govet
24+
- ineffassign
25+
- interfacebloat
26+
- lll
27+
- loggercheck
28+
- makezero
29+
- nakedret
30+
- nestif
31+
- nilerr
32+
- nilnil
33+
- noctx
34+
- nolintlint
35+
- nosprintfhostport
36+
- predeclared
37+
- reassign
38+
- staticcheck
39+
- tagalign
40+
- testableexamples
41+
- testpackage
42+
- tparallel
43+
- unconvert
44+
- unparam
45+
- unused
46+
- usestdlibvars
47+
- usetesting
48+
- wastedassign
49+
- whitespace
50+
- zerologlint
51+
settings:
52+
cyclop:
53+
max-complexity: 30
54+
package-average: 10
55+
errcheck:
56+
check-type-assertions: true
57+
funlen:
58+
lines: 100
59+
statements: 50
60+
ignore-comments: true
61+
gocognit:
62+
min-complexity: 30
63+
govet:
64+
disable:
65+
- fieldalignment
66+
enable-all: true
67+
exclusions:
68+
generated: lax
69+
presets:
70+
- comments
71+
- common-false-positives
72+
- legacy
73+
- std-error-handling
74+
rules:
75+
- linters:
76+
- godot
77+
source: (noinspection|TODO)
78+
- linters:
79+
- gocritic
80+
source: //noinspection
81+
- linters:
82+
- bodyclose
83+
- dupl
84+
- funlen
85+
- goconst
86+
- gosec
87+
- noctx
88+
- wrapcheck
89+
path: _test\.go
90+
- linters:
91+
- gosec
92+
text: G115
93+
- linters:
94+
- staticcheck
95+
text: SA5011
96+
- path: (.+)\.go$
97+
text: declaration of "(err|ctx)" shadows declaration at
98+
paths:
99+
- third_party$
100+
- builtin$
101+
- examples$
77102
issues:
78103
max-same-issues: 0
79-
exclude:
80-
- 'declaration of "(err|ctx)" shadows declaration at' # shadowing of err and ctx is acceptable
81-
exclude-rules:
82-
- source: "(noinspection|TODO)"
83-
linters: [ godot ]
84-
- source: "//noinspection"
85-
linters: [ gocritic ]
86-
- path: "_test\\.go"
87-
linters:
88-
- bodyclose
89-
- dupl
90-
- funlen
91-
- goconst
92-
- gosec
93-
- noctx
94-
- wrapcheck
95-
- linters: [gosec]
96-
text: "G115"
97-
- linters:
98-
- staticcheck
99-
text: "SA5011" # SA5011: Should not use unsafe.Pointer - this throws false positives when a nil check does not result in a return
104+
formatters:
105+
enable:
106+
- goimports
107+
exclusions:
108+
generated: lax
109+
paths:
110+
- third_party$
111+
- builtin$
112+
- examples$

cmd/internal/library.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ func libraryFunc(ctx *context.Context, cmd *cobra.Command, _ []string) {
4444
}
4545

4646
wsFilter := flags.ValueFor[string](ctx, cmd, *flags.FilterWorkspaceFlag, false)
47-
if wsFilter == "." {
47+
switch wsFilter {
48+
case ".":
4849
wsFilter = ctx.Config.CurrentWorkspace
49-
} else if wsFilter == executable.WildcardWorkspace {
50+
case executable.WildcardWorkspace:
5051
wsFilter = ""
5152
}
5253

development.flow

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ executables:
9090
echo "installing cobra-cli..."
9191
go install github.com/spf13/[email protected]
9292
echo "installing golangci-lint..."
93-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.5
93+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v2.1.6
9494
echo "installing ginkgo..."
9595
go install github.com/onsi/ginkgo/v2/[email protected]
9696
echo "installing goreleaser..."

internal/io/library/init.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,14 @@ func (l *Library) setVisibleExecs() {
5555
}
5656

5757
curNs := l.filter.Namespace
58-
if l.showNamespaces && len(l.visibleNamespaces) > 0 { //nolint:nestif
58+
if l.showNamespaces && len(l.visibleNamespaces) > 0 {
5959
if label := l.visibleNamespaces[l.currentNamespace]; label != "" {
60-
if label == withoutNamespaceLabel {
60+
switch label {
61+
case withoutNamespaceLabel:
6162
curNs = ""
62-
} else if label == allNamespacesLabel {
63+
case allNamespacesLabel:
6364
curNs = executable.WildcardNamespace
64-
} else {
65+
default:
6566
curNs = label
6667
}
6768
}
@@ -89,10 +90,10 @@ func (l *Library) setVisibleWorkspaces() {
8990

9091
filter := l.filter
9192
filteredWs := l.allWorkspaces
92-
switch {
93-
case filter.Workspace == "":
93+
switch filter.Workspace {
94+
case "":
9495
// do nothing
95-
case filter.Workspace == allWorkspacesLabel || filter.Workspace == executable.WildcardWorkspace:
96+
case allWorkspacesLabel, executable.WildcardWorkspace:
9697
// do nothing
9798
default:
9899
for _, ws := range filteredWs {

internal/io/library/update.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ func (l *Library) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
5757
wsPane, wsCmd := l.updateWsPane(msg)
5858
l.paneZeroViewport = wsPane
5959
execPane, execCmd := l.updateExecPanes(msg)
60-
if l.currentPane == 1 {
60+
switch l.currentPane {
61+
case 1:
6162
l.paneOneViewport = execPane
62-
} else if l.currentPane == 2 {
63+
case 2:
6364
l.paneTwoViewport = execPane
6465
}
6566

@@ -190,9 +191,10 @@ func (l *Library) updateExecPanes(msg tea.Msg) (viewport.Model, tea.Cmd) {
190191
}
191192

192193
var pane viewport.Model
193-
if l.currentPane == 1 {
194+
switch l.currentPane {
195+
case 1:
194196
pane = l.paneOneViewport
195-
} else if l.currentPane == 2 {
197+
case 2:
196198
pane = l.paneTwoViewport
197199
}
198200

tools/docsgen/schema/schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func MergeSchemas(dst, src *JSONSchema, dstFile FileName, schemaMap map[FileName
140140

141141
src.Ref = convertToLocalSchemaRef(src.Ref, dstFile)
142142
if _, found := dst.Definitions[src.Ref.Key()]; !found {
143-
var d JSONSchema //nolint:gosimple
143+
var d JSONSchema
144144
d = *match
145145
d.Schema = ""
146146
d.Definitions = nil

types/config/config.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,11 @@ func (c *Config) JSON() (string, error) {
8383
func (c *Config) Markdown() string {
8484
mkdwn := "# Global Configurations\n"
8585
mkdwn += fmt.Sprintf("**Current workspace:** `%s`\n", c.CurrentWorkspace)
86-
if c.WorkspaceMode == ConfigWorkspaceModeFixed {
86+
switch c.WorkspaceMode {
87+
case ConfigWorkspaceModeFixed:
8788
mkdwn += "*Workspace mode is set to fixed. This means that your working directory will have no impact on the " +
8889
"current workspace.*\n\n"
89-
} else if c.WorkspaceMode == ConfigWorkspaceModeDynamic {
90+
case ConfigWorkspaceModeDynamic:
9091
mkdwn += "*Workspace mode is set to dynamic. This means that your current workspace is also determined by " +
9192
"your working directory.*\n\n"
9293
}

0 commit comments

Comments
 (0)