Skip to content

Commit

Permalink
lint: update linter settings to eliminate false positives
Browse files Browse the repository at this point in the history
  • Loading branch information
umputun committed Dec 17, 2024
1 parent 7613f52 commit b84d0d5
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 18 deletions.
64 changes: 48 additions & 16 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
linters-settings:
govet:
check-shadowing: true
shadow: true
golint:
min-confidence: 0
min-confidence: 0.6
gocyclo:
min-complexity: 15
maligned:
Expand All @@ -24,48 +24,80 @@ linters-settings:
disabled-checks:
- wrapperFunc
- hugeParam
- rangeValCopy

linters:
disable-all: true
enable:
- megacheck
- revive
- govet
- unconvert
- megacheck
- gas
- gocyclo
- dupl
- misspell
- gosec
- unparam
- unused
- typecheck
- ineffassign
- stylecheck
- gochecknoinits
- exportloopref
- gocritic
- nakedret
- gosimple
- prealloc

fast: false
disable-all: true


run:
output:
format: tab
skip-dirs:
- vendor
concurrency: 4

issues:
exclude-dirs:
- vendor
exclude-rules:
- text: "should have a package comment, unless it's in another file for this package"
linters:
- golint
- text: "exitAfterDefer:"
linters:
- gocritic
- text: "whyNoLint: include an explanation for nolint directive"
linters:
- gocritic
- text: "go.mongodb.org/mongo-driver/bson/primitive.E"
linters:
- govet
- text: "weak cryptographic primitive"
linters:
- gosec
- text: "integer overflow conversion"
linters:
- gosec
- text: "should have a package comment"
linters:
- revive
- text: "at least one file in a package should have a package comment"
linters:
- stylecheck
- text: "package-comments: should have a package comment"
- text: "commentedOutCode: may want to remove commented-out code"
linters:
- gocritic
- text: "unnamedResult: consider giving a name to these results"
linters:
- gocritic
- text: "var-naming: don't use an underscore in package name"
linters:
- revive

- text: "should not use underscores in package names"
linters:
- stylecheck
- text: "struct literal uses unkeyed fields"
linters:
- govet
- linters:
- unparam
- unused
- revive
path: _test\.go$
text: "unused-parameter"
exclude-use-default: false

4 changes: 2 additions & 2 deletions middleware/concurrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
)

// MaxConcurrent middleware limits the total concurrency for a given requester
func MaxConcurrent(max int) func(http.RoundTripper) http.RoundTripper {
sema := make(chan struct{}, max)
func MaxConcurrent(maxLimit int) func(http.RoundTripper) http.RoundTripper {
sema := make(chan struct{}, maxLimit)
return func(next http.RoundTripper) http.RoundTripper {
fn := func(req *http.Request) (*http.Response, error) {
sema <- struct{}{}
Expand Down

0 comments on commit b84d0d5

Please sign in to comment.