Skip to content

Commit

Permalink
update golangci-lint to 1.50 and fixes (crowdsecurity#1828)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc authored Oct 26, 2022
1 parent 22479a2 commit 02d2eab
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.49
version: v1.50
# Optional: golangci-lint command line arguments.
args: --issues-exit-code=1 --timeout 10m
# Optional: show only new issues if it's a pull request. The default value is `false`.
Expand Down
11 changes: 10 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# see https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
# https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml

run:
skip-dirs:
Expand All @@ -23,16 +23,22 @@ linters-settings:

govet:
check-shadowing: true

lll:
line-length: 140

misspell:
locale: US

nolintlint:
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped

interfacebloat:
max: 12

linters:
enable-all: true
disable:
Expand All @@ -59,6 +65,7 @@ linters:
# - bidichk # Checks for dangerous unicode character sequences
# - decorder # check declaration order and count of types, constants, variables and functions
# - depguard # Go linter that checks if package imports are in a list of acceptable packages
# - dupword # checks for duplicate words in the source code
# - durationcheck # check for two durations multiplied together
# - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
# - exportloopref # checks for pointers to enclosing loop variables
Expand All @@ -83,6 +90,7 @@ linters:
# - rowserrcheck # checks whether Err of rows is checked successfully
# - sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed.
# - staticcheck # (megacheck): Staticcheck is a go vet on steroids, applying a ton of static analysis checks
# - testableexamples # linter checks if examples are testable (have an expected output)
# - tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
# - tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes
# - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
Expand Down Expand Up @@ -171,6 +179,7 @@ linters:

- prealloc # Finds slice declarations that could potentially be preallocated


issues:
max-issues-per-linter: 0
max-same-issues: 10
Expand Down
2 changes: 1 addition & 1 deletion pkg/acquisition/modules/cloudwatch/cloudwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func (cw *CloudwatchSource) WatchLogGroupForStreams(out chan LogStreamTailConfig
Limit: cw.Config.DescribeLogStreamsLimit,
},
func(page *cloudwatchlogs.DescribeLogStreamsOutput, lastPage bool) bool {
cw.logger.Tracef("in helper of of DescribeLogStreamsPagesWithContext")
cw.logger.Tracef("in helper of DescribeLogStreamsPagesWithContext")
for _, event := range page.LogStreams {
startFrom = page.NextToken
//we check if the stream has been written to recently enough to be monitored
Expand Down
2 changes: 1 addition & 1 deletion pkg/csconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func DefaultConfigPath(elem ...string) string {
return filepath.Join(elem...)
}

// DefaultDataPath returns the the default path for a data resource.
// DefaultDataPath returns the default path for a data resource.
// "elem" parameters are path components relative to the default data directory.
func DefaultDataPath(elem ...string) string {
elem = append([]string{defaultDataDir}, elem...)
Expand Down
2 changes: 1 addition & 1 deletion pkg/leakybucket/reset_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
// ResetFilter allows to kill the bucket (without overflowing), if a particular condition is met.
// An example would be a scenario to detect aggressive crawlers that *do not* fetch any static resources :
// type : leaky
// filter: filter: "evt.Meta.log_type == 'http_access-log'
// filter: "evt.Meta.log_type == 'http_access-log'
// reset_filter: evt.Parsed.request endswith '.css'
// ....
// Thus, if the bucket receives a request that matches fetching a static resource (here css), it cancels itself
Expand Down

0 comments on commit 02d2eab

Please sign in to comment.