Skip to content

Commit

Permalink
fix: update golangci linter config for ci vs. local
Browse files Browse the repository at this point in the history
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
  • Loading branch information
golanglemonade committed Nov 11, 2024
1 parent 37c91b9 commit 998b75d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ steps:
plugins:
- docker#v5.12.0:
image: "ghcr.io/theopenlane/build-image:latest"
command: ["task", "go:lint"]
command: ["task", "go:lint:ci"]
always_pull: true
environment:
- "GOTOOLCHAIN=auto"
Expand Down
18 changes: 11 additions & 7 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ run:
timeout: 15m
allow-serial-runners: true
concurrency: 0
tests: false
linters-settings:
goimports:
local-prefixes: github.com/theopenlane/core
Expand All @@ -13,29 +14,30 @@ linters-settings:
ignore-generated-header: true
linters:
enable:
# default linters
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- unused
# additional linters
- bodyclose
- errcheck
- gocritic
- gocyclo
- err113
- gofmt
- goimports
- mnd
- gosimple
- govet
- gosec
- ineffassign
- misspell
- noctx
- revive
- staticcheck
- stylecheck
- typecheck
- unused
- whitespace
- wsl
issues:
fix: true
exclude-use-default: true
exclude-dirs:
- pkg/testutils/*
Expand All @@ -55,3 +57,5 @@ issues:
- internal/graphapi/gen_models.go
- internal/openlaneclient/graphclient.go
- pkg/openlaneclient/graphclient.go
output:
show-stats: true
6 changes: 6 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ tasks:
desc: runs golangci-lint, the most annoying opinionated linter ever
cmds:
- golangci-lint run --config=.golangci.yaml --verbose --fast --fix

go:lint:ci:
desc: runs golangci-lint, the most annoying opinionated linter ever, for CI
## do not use --fast or --fix in CI
cmds:
- golangci-lint run --config=.golangci.yaml --verbose

go:test:
desc: runs and outputs results of created go tests
Expand Down
2 changes: 1 addition & 1 deletion pkg/middleware/ratelimiter/ratelimiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (r *RateLimiter) Check(key string) (limitStatus *LimitStatus, err error) {
}

// calcRate calculates current rate based on previous and current values
func (r *RateLimiter) calcRate(timeFromCurrWindow time.Duration, prevValue int64, currentValue int64) float64 {
func (r *RateLimiter) calcRate(timeFromCurrWindow time.Duration, prevValue int64, currentValue int64) float64 { // nolint: unused
return float64((float64(r.windowSize)-float64(timeFromCurrWindow))/float64(r.windowSize))*float64(prevValue) + float64(currentValue)
}

Expand Down

0 comments on commit 998b75d

Please sign in to comment.