diff --git a/.github/workflows/ci_golangci-lint.yml b/.github/workflows/ci_golangci-lint.yml index 050f22ee1..d45b42eb5 100644 --- a/.github/workflows/ci_golangci-lint.yml +++ b/.github/workflows/ci_golangci-lint.yml @@ -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`. diff --git a/.golangci.yml b/.golangci.yml index 9f1713dad..c09c15772 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -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: @@ -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: @@ -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 @@ -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 @@ -171,6 +179,7 @@ linters: - prealloc # Finds slice declarations that could potentially be preallocated + issues: max-issues-per-linter: 0 max-same-issues: 10 diff --git a/pkg/acquisition/modules/cloudwatch/cloudwatch.go b/pkg/acquisition/modules/cloudwatch/cloudwatch.go index 0efc847e7..e7981863e 100644 --- a/pkg/acquisition/modules/cloudwatch/cloudwatch.go +++ b/pkg/acquisition/modules/cloudwatch/cloudwatch.go @@ -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 diff --git a/pkg/csconfig/config.go b/pkg/csconfig/config.go index 484cbdf11..68b84b945 100644 --- a/pkg/csconfig/config.go +++ b/pkg/csconfig/config.go @@ -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...) diff --git a/pkg/leakybucket/reset_filter.go b/pkg/leakybucket/reset_filter.go index c7430c3e8..0d50294e9 100644 --- a/pkg/leakybucket/reset_filter.go +++ b/pkg/leakybucket/reset_filter.go @@ -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