github.com/pawelgaczynski/gain@v0.4.0-alpha.0.20230821120126-41f1e60a18da/.golangci.yaml (about)

     1  run:
     2    timeout: 3m
     3  
     4    modules-download-mode: readonly
     5    go: "1.18"
     6  
     7  linters-settings:
     8    cyclop:
     9      max-complexity: 30
    10      package-average: 10.0
    11    
    12    exhaustive:
    13      default-signifies-exhaustive: true
    14  
    15    errcheck:
    16      check-type-assertions: true
    17  
    18    funlen:
    19      lines: 100
    20      statements: 50
    21  
    22    gocognit:
    23      min-complexity: 30
    24  
    25    gocritic:
    26      settings:
    27        captLocal:
    28          paramsOnly: false
    29        underef:
    30          skipRecvDeref: false
    31  
    32    godot:
    33      scope: declarations
    34  
    35    gomnd:
    36      ignored-functions:
    37        - os.Chmod
    38        - os.Mkdir
    39        - os.MkdirAll
    40        - os.OpenFile
    41        - os.WriteFile
    42        - prometheus.ExponentialBuckets
    43        - prometheus.ExponentialBucketsRange
    44        - prometheus.LinearBuckets
    45        - strconv.FormatFloat
    46        - strconv.FormatInt
    47        - strconv.FormatUint
    48        - strconv.ParseFloat
    49        - strconv.ParseInt
    50        - strconv.ParseUint
    51        - doubleSize
    52  
    53    gomodguard:
    54      blocked:
    55        modules:
    56          - github.com/golang/protobuf:
    57              recommendations:
    58                - google.golang.org/protobuf
    59              reason: "see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules"
    60          - github.com/satori/go.uuid:
    61              recommendations:
    62                - github.com/google/uuid
    63              reason: "satori's package is not maintained"
    64          - github.com/gofrs/uuid:
    65              recommendations:
    66                - github.com/google/uuid
    67              reason: "see recommendation from dev-infra team: https://confluence.gtforge.com/x/gQI6Aw"
    68  
    69    govet:
    70      enable-all: true
    71      disable:
    72        - fieldalignment
    73      settings:
    74        shadow:
    75          strict: true
    76  
    77    nakedret:
    78      max-func-lines: 0
    79  
    80    nestif:
    81      min-complexity: 8
    82  
    83    rowserrcheck:
    84      packages:
    85        - github.com/jmoiron/sqlx
    86  
    87    tenv:
    88      all: true
    89  
    90    varnamelen:
    91      ignore-names:
    92        - fd
    93        - err
    94        - vm
    95        - gc
    96        - wg
    97        - lb
    98        - ip
    99        - i
   100      ignore-decls:
   101        - n int
   102        - n uint32
   103        - i int
   104        - ip net.IP
   105        - ln *listener
   106        - c gain.Conn
   107  
   108    wrapcheck:
   109      ignoreSigs:
   110      - .Errorf(
   111      - os.NewSyscallError(
   112      - syscall.Errno(
   113      - unix.Socket(
   114      - ErrIsEmpty
   115      - .Wrapf(
   116  
   117      ignoreSigRegexps:
   118      - errors.Error.*\(
   119  
   120    wsl:
   121      allow-cuddle-declarations: false
   122      force-err-cuddling: true
   123      force-case-trailing-whitespace: 2
   124      allow-assign-and-anything: true
   125  
   126  linters:
   127    disable-all: true
   128  
   129    enable:
   130      - errcheck # errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases [fast: false, auto-fix: false]
   131      - gosimple # (megacheck) Linter for Go source code that specializes in simplifying code [fast: false, auto-fix: false]
   132      - govet # (vet, vetshadow) Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: false, auto-fix: false]
   133      - ineffassign # Detects when assignments to existing variables are not used [fast: true, auto-fix: false]
   134      - staticcheck # (megacheck) It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint. [fast: false, auto-fix: false]
   135      - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code [fast: false, auto-fix: false]
   136      - unused # (megacheck) Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]
   137      - asasalint # check for pass []any as any in variadic func(...any) [fast: false, auto-fix: false]
   138      - asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers [fast: true, auto-fix: false]
   139      - bidichk # Checks for dangerous unicode character sequences [fast: true, auto-fix: false]
   140      - bodyclose # checks whether HTTP response body is closed successfully [fast: false, auto-fix: false]
   141      - containedctx # containedctx is a linter that detects struct contained context.Context field [fast: true, auto-fix: false]
   142      - contextcheck # check whether the function uses a non-inherited context [fast: false, auto-fix: false]
   143      - cyclop # checks function and package cyclomatic complexity [fast: false, auto-fix: false]
   144      - decorder # check declaration order and count of types, constants, variables and functions [fast: true, auto-fix: false]
   145      - dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]
   146      - dupl # Tool for code clone detection [fast: true, auto-fix: false]
   147      - dupword # checks for duplicate words in the source code [fast: true, auto-fix: true]
   148      - durationcheck # check for two durations multiplied together [fast: false, auto-fix: false]
   149      - errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted. [fast: false, auto-fix: false]
   150      - errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`. [fast: false, auto-fix: false]
   151      - errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. [fast: false, auto-fix: false]
   152      - execinquery # execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds [fast: false, auto-fix: false]
   153      - exhaustive # check exhaustiveness of enum switch statements [fast: false, auto-fix: false]
   154      - exportloopref # checks for pointers to enclosing loop variables [fast: false, auto-fix: false]
   155      - forbidigo # Forbids identifiers [fast: false, auto-fix: false]
   156      - forcetypeassert # finds forced type assertions [fast: true, auto-fix: false]
   157      - funlen # Tool for detection of long functions [fast: true, auto-fix: false]
   158      - gci # Gci controls Go package import order and makes it always deterministic. [fast: true, auto-fix: false]
   159      - ginkgolinter # enforces standards of using ginkgo and gomega [fast: false, auto-fix: false]
   160      - gocheckcompilerdirectives # Checks that go compiler directive comments (//go:) are valid. [fast: true, auto-fix: false]
   161      - gochecknoinits # Checks that no init functions are present in Go code [fast: true, auto-fix: false]
   162      - gocognit # Computes and checks the cognitive complexity of functions [fast: true, auto-fix: false]
   163      - goconst # Finds repeated strings that could be replaced by a constant [fast: true, auto-fix: false]
   164      - gocritic # Provides diagnostics that check for bugs, performance and style issues. [fast: false, auto-fix: false]
   165      - gocyclo # Computes and checks the cyclomatic complexity of functions [fast: true, auto-fix: false]
   166      - godot # Check if comments end in a period [fast: true, auto-fix: true]
   167      - godox # Tool for detection of FIXME, TODO and other comment keywords [fast: true, auto-fix: false]
   168      - goerr113 # Go linter to check the errors handling expressions [fast: false, auto-fix: false]
   169      - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true]
   170      - gofumpt # Gofumpt checks whether code was gofumpt-ed. [fast: true, auto-fix: true]
   171      - goheader # Checks is file header matches to pattern [fast: true, auto-fix: false]
   172      - goimports # Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode. [fast: true, auto-fix: true]
   173      - gomnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false]
   174      - gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. [fast: true, auto-fix: false]
   175      - gomodguard # Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations. [fast: true, auto-fix: false]
   176      - goprintffuncname # Checks that printf-like functions are named with `f` at the end [fast: true, auto-fix: false]
   177      - gosec # (gas) Inspects source code for security problems [fast: false, auto-fix: false]
   178      - grouper # An analyzer to analyze expression groups. [fast: true, auto-fix: false]
   179      - importas # Enforces consistent import aliases [fast: false, auto-fix: false]
   180      - interfacebloat # A linter that checks the number of methods inside an interface. [fast: true, auto-fix: false]
   181      - lll # Reports long lines [fast: true, auto-fix: false]
   182      - loggercheck # (logrlint) Checks key value pairs for common logger libraries (kitlog,klog,logr,zap). [fast: false, auto-fix: false]
   183      - maintidx # maintidx measures the maintainability index of each function. [fast: true, auto-fix: false]
   184      - makezero # Finds slice declarations with non-zero initial length [fast: false, auto-fix: false]
   185      - mirror # Reports wrong mirror patterns of bytes/strings usage
   186      - misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true]
   187      - musttag # enforce field tags in (un)marshaled structs [fast: false, auto-fix: false]
   188      - nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]
   189      - nestif # Reports deeply nested if statements [fast: true, auto-fix: false]
   190      - nilerr # Finds the code that returns nil even if it checks that the error is not nil. [fast: false, auto-fix: false]
   191      - nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value. [fast: false, auto-fix: false]
   192      - nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity [fast: true, auto-fix: false]
   193      - noctx # noctx finds sending http request without context.Context [fast: false, auto-fix: false]
   194      - nonamedreturns # Reports all named returns [fast: false, auto-fix: false]
   195      - nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL. [fast: true, auto-fix: false]
   196      - prealloc # Finds slice declarations that could potentially be pre-allocated [fast: true, auto-fix: false]
   197      - predeclared # find code that shadows one of Go's predeclared identifiers [fast: true, auto-fix: false]
   198      - promlinter # Check Prometheus metrics naming via promlint [fast: true, auto-fix: false]
   199      - reassign # Checks that package variables are not reassigned [fast: false, auto-fix: false]
   200      - revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. [fast: false, auto-fix: false]
   201      - rowserrcheck # checks whether Err of rows is checked successfully [fast: false, auto-fix: false]
   202      - sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed. [fast: false, auto-fix: false]
   203      - stylecheck # Stylecheck is a replacement for golint [fast: false, auto-fix: false]
   204      - tagliatelle # Checks the struct tags. [fast: true, auto-fix: false]
   205      - tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 [fast: false, auto-fix: false]
   206      - testableexamples # linter checks if examples are testable (have an expected output) [fast: true, auto-fix: false]
   207      - thelper # thelper detects Go test helpers without t.Helper() call and checks the consistency of test helpers [fast: false, auto-fix: false]
   208      - tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes [fast: false, auto-fix: false]
   209      - unconvert # Remove unnecessary type conversions [fast: false, auto-fix: false]
   210      - unparam # Reports unused function parameters [fast: false, auto-fix: false]
   211      - usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library. [fast: true, auto-fix: false]
   212      - varnamelen # checks that the length of a variable's name matches its scope [fast: false, auto-fix: false]
   213      - wastedassign # wastedassign finds wasted assignment statements. [fast: false, auto-fix: false]
   214      - whitespace # Tool for detection of leading and trailing whitespace [fast: true, auto-fix: true]
   215      - wrapcheck # Checks that errors returned from external packages are wrapped [fast: false, auto-fix: false]
   216      - wsl # Whitespace Linter - Forces you to use empty lines! [fast: true, auto-fix: false]
   217  
   218  issues:
   219    max-same-issues: 50
   220  
   221    exclude-rules:
   222      - source: "^//\\s*go:generate\\s"
   223        linters: [ lll ]
   224      - source: "(noinspection|TODO)"
   225        linters: [ godot ]
   226      - source: "//noinspection"
   227        linters: [ gocritic ]
   228      - source: "^\\s+if _, ok := err\\.\\([^.]+\\.InternalError\\); ok {"
   229        linters: [ errorlint ]
   230      - path: "_test\\.go"
   231        linters: [ wrapcheck, goerr113, funlen, cognitive, gocognit, nestif, makezero, unparam ]
   232      - linters:
   233          - typecheck
   234        text: "could not load export data"