Skip to content

Commit

Permalink
chore: update linting configuration, remove deprecated linters and al…
Browse files Browse the repository at this point in the history
…ign with GoKoala config
  • Loading branch information
rkettelerij committed Feb 28, 2025
1 parent 2226cb0 commit 72ad233
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
25 changes: 18 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ issues:
linters:
- bodyclose
- dupl
- dogsled
- funlen

output:
format: colored-line-number
formats: colored-line-number
print-issued-lines: true
print-linter-name: true

Expand All @@ -37,11 +38,15 @@ linters-settings:
skip-tests: true
funlen:
lines: 100
gomoddirectives:
replace-allow-list:
- github.com/abbot/go-http-auth # https://github.com/traefik/traefik/issues/6873#issuecomment-637654361
nestif:
min-complexity: 6
forbidigo:
forbid:
- http\.NotFound.* # return RFC 7807 problem details instead
- http\.Error.* # return RFC 7807 problem details instead
gomoddirectives:
replace-allow-list:
- github.com/abbot/go-http-auth

linters:
disable-all: true
Expand All @@ -62,23 +67,28 @@ linters:
- cyclop # checks function and package cyclomatic complexity
- dupl # tool for code clone detection
- durationcheck # checks for two durations multiplied together
- dogsled # find assignments/declarations with too many blank identifiers
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
- execinquery # checks query string in Query function which reads your Go src files and warning it finds
- exhaustive # checks exhaustiveness of enum switch statements
- exportloopref # checks for pointers to enclosing loop variables
- exptostd # detects functions from golang.org/x/exp/ that can be replaced by std functions
- copyloopvar # checks for pointers to enclosing loop variables
- fatcontext # detects nested contexts in loops and function literals
- forbidigo # forbids identifiers
- funlen # tool for detection of long functions
- gocheckcompilerdirectives # validates go compiler directive comments (//go:)
- goconst # finds repeated strings that could be replaced by a constant
- gocritic # provides diagnostics that check for bugs, performance and style issues
- gofmt # checks if the code is formatted according to 'gofmt' command
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt
- gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
- gomodguard # allow and block lists linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations
- goprintffuncname # checks that printf-like functions are named with f at the end
- gosec # inspects source code for security problems
- loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap)
- makezero # finds slice declarations with non-zero initial length
- mirror # reports wrong mirror patterns of bytes/strings usage
- misspell # finds commonly misspelled English words
- nakedret # finds naked returns in functions greater than a specified function length
- nestif # reports deeply nested if statements
- nilerr # finds the code that returns nil even if it checks that the error is not nil
Expand All @@ -92,7 +102,8 @@ linters:
- rowserrcheck # checks whether Err of rows is checked successfully
- sqlclosecheck # checks that sql.Rows and sql.Stmt are closed
- sloglint # A Go linter that ensures consistent code style when using log/slog
- tenv # detects using os.Setenv instead of t.Setenv since Go1.17
- tagliatelle # checks the struct tags.
- usetesting # detects using os.Setenv instead of t.Setenv since Go1.17
- testableexamples # checks if examples are testable (have an expected output)
- tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
- unconvert # removes unnecessary type conversions
Expand Down
6 changes: 3 additions & 3 deletions internal/model/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ type UptimeCheck struct {
Name string `json:"name"`
URL string `json:"url"`
Tags []string `json:"tags"`
RequestHeaders map[string]string `json:"request_headers"`
StringContains string `json:"string_contains"`
StringNotContains string `json:"string_not_contains"`
RequestHeaders map[string]string `json:"request_headers"` //nolint:tagliatelle // grandfathered in
StringContains string `json:"string_contains"` //nolint:tagliatelle // grandfathered in
StringNotContains string `json:"string_not_contains"` //nolint:tagliatelle // grandfathered in
}

func NewUptimeCheck(ingressName string, annotations map[string]string) (*UptimeCheck, error) {
Expand Down

0 comments on commit 72ad233

Please sign in to comment.