vorteil/direktiv

View on GitHub
.golangci.yaml

Summary

Maintainability
Test Coverage
run:
  timeout: 10m
  go: 1.22.0
  issues-exit-code: 1
  tests: false

linters-settings:
  tagliatelle:
    # Check the struck tag name case.
    case:
      # Use the struct field name to check the name of the struct tag.
      # Default: false
      use-field-name: true
      rules:
        json: snake
        yaml: snake

  nlreturn:
    # Size of the block (including return statement that is still "OK")
    # so no return split required.
    # Default: 1
    block-size: 2

  sloglint:
    # Enforce not using global loggers.
    # Values:
    # - "": disabled
    # - "all": report all global loggers
    # - "default": report only the default slog logger
    # Default: ""
    # no-global: "all"

linters:
  enable-all: true
  disable:
    - depguard
    - exhaustruct
    - wsl
    - lll
    - varnamelen
    - wrapcheck
    - nolintlint # must fix before release.
    - ireturn
    - funlen
    - gochecknoglobals
    - cyclop
    - godox # must fix before release.

    - exhaustivestruct
    - structcheck
    - ifshort
    - maligned
    - interfacer
    - nosnakecase
    - golint
    - varcheck
    - scopelint
    - gomnd
    - tagliatelle
    - musttag
    - prealloc
    - spancheck # TODO: Alan, enable this one as it helps you fixing some telemetry bugs.
    - err113 # TODO: This ensures no dynamic errors.
    - mnd

issues:
  exclude-files: [ ".pb.go" ]
  exclude-rules:
    - path: '(pkg|cmd)\/(model|sidecar|exec|util|jqer|flow|api)\/.*'
      linters:
        - paralleltest
        - forbidigo
        - protogetter
        - perfsprint
        - nlreturn
        - nonamedreturns
        - stylecheck
        - tagliatelle
        - wastedassign
        - gomnd
        - testpackage
        - asasalint
        - predeclared
        - maintidx
        - interfacebloat
        - forcetypeassert
        - exhaustive
        - contextcheck
        - unparam
        - promlinter
        - prealloc
        - nestif
        - makezero
        - dogsled
        - dupl
        - gochecknoinits
        - gocognit
        - gosec
        - gocritic
        - rowserrcheck
        - nakedret
        - gocyclo

    - text: "do not define dynamic errors, use wrapped static errors instead:"
      linters:
        - goerr113
    - text: "ifElseChain: rewrite if-else to switch statement"
      linters:
        - gocritic
    - text: "Rollback` is not checked"
      linters:
        - errcheck
    - text: "encoding/json.Encoder"
      linters:
        - errchkjson
    - text: "encoding/json.Marshal"
      linters:
        - errchkjson
    - text: "SA1029: should not use built-in type string as key for value"
      linters:
        - staticcheck
    - text: "unused-parameter:"
      linters:
        - revive
    - text: "empty-block:"
      linters:
        - revive
    - text: "var-naming:"
      linters:
        - revive
    - text: "context-as-argument:"
      linters:
        - revive
    - text: "context-keys-type: should not use basic type string"
      linters:
        - revive
    - text: "fmt.Errorf can be replaced"
      linters:
        - perfsprint
    - text: "fmt.Sprintf can be replaced"
      linters:
        - perfsprint
    - text: "don't use `init` function"
      linters:
        - init

    # gateway plugins need to user init() function
    - path: 'pkg/refactor/gateway2/plugins/.*'
      linters:
        - gochecknoinits