From 3f0a8460db20dc141d9999d2dec393fea175d801 Mon Sep 17 00:00:00 2001 From: mschfh <37435502+mschfh@users.noreply.github.com> Date: Wed, 8 May 2024 09:25:15 +0000 Subject: [PATCH] update config --- .golangci.yml | 70 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 65694cae..64ebba50 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,14 +1,76 @@ +run: + go: "1.22" + timeout: 3m + linters-settings: + cyclop: + # The maximal code complexity to report. + # Default: 10 + max-complexity: 10 + # The maximal average package complexity. + # If it's higher than 0.0 (float) the check is enabled + # Default: 0.0 + package-average: 10.0 + + errcheck: + # Report about not checking of errors in type assertions: `a := b.(MyStruct)`. + # Such cases aren't reported by default. + # Default: false + check-type-assertions: true + + gocritic: + # Settings passed to gocritic. + # The settings key is the name of a supported gocritic checker. + # The list of supported checkers can be find in https://go-critic.github.io/overview. + settings: + captLocal: + # Whether to restrict checker to params only. + # Default: true + paramsOnly: false + underef: + # Whether to skip (*x).method() calls where x is a pointer receiver. + # Default: true + skipRecvDeref: false + govet: enable: - shadow + varcheck: + # Check usage of exported fields and variables. + # Default: false + exported-fields: true + linters: + disable-all: true enable: - - govet - - revive + ## enabled by default + - unused # Finds unused code - gofmt - - goimports +# - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases +# - gosimple # Linter for Go source code that specializes in simplifying a code + - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string + - ineffassign # Detects when assignments to existing variables are not used +# - staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks +# - structcheck # Finds unused struct fields + - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code +# - unused # Checks Go code for unused constants, variables, functions and types +# - varcheck # Finds unused global variables and constants + # ## disabled by default +# - contextcheck # check the function whether use a non-inherited context +# - cyclop # checks function and package cyclomatic complexity +# - errname # Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error. +# - gocritic # Provides diagnostics that check for bugs, performance and style issues. +# - gocyclo # Computes and checks the cyclomatic complexity of functions +# - nestif # Reports deeply nested if statements + - revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. +# - sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed +# - stylecheck # Stylecheck is a replacement for golint +# - wastedassign # wastedassign finds wasted assignment statements. +# - whitespace # Tool for detection of leading and trailing whitespace + issues: - exclude-use-default: false + exclude-rules: + - text: 'shadow: declaration of "(err|ctx)" shadows declaration at' + linters: [ govet ] \ No newline at end of file