Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 79 additions & 81 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,66 +1,15 @@
version: "2"
run:
timeout: 10m
build-tags:
- e2e
- hpa
- upgrade
allow-parallel-runners: true
exclude-dirs:
- client
- injection/clients

output:
sort-results: true
sort-order:
- linter
- file
show-stats: true


issues:
uniq-by-line: true
max-issues-per-linter: 0
max-same-issues: 0
exclude-rules:
- path: test # Excludes /test, *_test.go etc.
linters:
- gosec
- unparam
- noctx
- protogetter
- linters: ["gocritic"]
# Fixes are non-trivial do in a follow up
text: "ifElseChain"

linters-settings:
# goimports:
# local-prefixes: knative.dev/pkg
gomodguard:
blocked:
modules:
- github.com/ghodss/yaml:
recommendations:
- sigs.k8s.io/yaml
- go.uber.org/atomic:
recommendations:
- sync/atomic
- io/ioutil:
recommendations:
- os
- io
- github.com/hashicorp/go-multierror:
reason: "use errors.Join"
recommendations:
- errors
- go.uber.org/multierr:
reason: "use errors.Join"
recommendations:
- errors
revive:
rules:
# use unparam linter instead - defaults are better
- name: unused-parameter
disabled: true

- linter
- file
linters:
disable:
- errcheck
enable:
# Check for pass []any as any in variadic func(...any).
- asasalint
Expand All @@ -81,7 +30,7 @@ linters:
# # Containedctx is a linter that detects struct contained context.Context
# # field.
# - containedctx

#
# TODO - do a follow up PR
# # Check whether the function uses a non-inherited context.
# - contextcheck
Expand Down Expand Up @@ -115,27 +64,12 @@ linters:
# report message and optional suggestion.
- gocritic

# Gofmt checks whether code was gofmt-ed. By default this tool runs
# with -s option to check for code simplification.
- gofmt

# Gofumpt checks whether code was gofumpt-ed.
- gofumpt

# Check import statements are formatted according to the 'goimport'
# command. Reformat imports in autofix mode.
- goimports

# See config below
- gomodguard

# Inspects source code for security problems.
- gosec

# Linter that specializes in simplifying code.
- gosimple
- govet

# Intrange is a linter to find places where for loops could make use of
# an integer range.
- intrange
Expand Down Expand Up @@ -183,12 +117,7 @@ linters:
# Checks for mistakes with OpenTelemetry/Census spans.
- spancheck

# Stylecheck is a replacement for golint.
- stylecheck

# Tenv is analyzer that detects using os.Setenv instead of t.Setenv
# since Go1.17.
- tenv
- staticcheck

# Linter checks if examples are testable (have an expected output).
- testableexamples
Expand All @@ -209,4 +138,73 @@ linters:
# Whitespace is a linter that checks for unnecessary newlines at the start
# and end of functions, if, for, etc.
- whitespace

disable:
- errcheck
settings:
gocritic:
disabled-checks:
- exitAfterDefer
- appendAssign
gomodguard:
blocked:
modules:
- github.com/ghodss/yaml:
recommendations:
- sigs.k8s.io/yaml
- go.uber.org/atomic:
recommendations:
- sync/atomic
- io/ioutil:
recommendations:
- os
- io
- github.com/hashicorp/go-multierror:
recommendations:
- errors
reason: use errors.Join
- go.uber.org/multierr:
recommendations:
- errors
reason: use errors.Join
revive:
rules:
- name: unused-parameter
disabled: true
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- gosec
- noctx
- protogetter
- unparam
path: test
- linters:
- gocritic
text: ifElseChain
paths:
- pkg/client
- third_party$
- builtin$
- examples$
issues:
max-issues-per-linter: 0
max-same-issues: 0
uniq-by-line: true
formatters:
enable:
- gofmt
- gofumpt
- goimports
exclusions:
generated: lax
paths:
- pkg/client
- third_party$
- builtin$
- examples$
Loading