version: "2"
formatters:
  enable:
    - gci
    - gofumpt
  settings:
    gci:
      sections:
        - standard
        - default
        - prefix(github.com/shirou)
issues:
  max-same-issues: 0
linters:
  enable:
    - asciicheck
    - contextcheck
    - durationcheck
    - errorlint
    - fatcontext
    - gocritic
    - gomodguard
    - gosec
    - govet
    - importas
    - ineffassign
    - misspell
    - nakedret
    - nilnesserr
    - noctx
    - nolintlint
    - perfsprint
    - predeclared
    - revive
    - staticcheck
    - testifylint
    - thelper
    - unparam
    - usetesting
  disable:
    - errcheck
    - unused
  settings:
    gocritic:
      disabled-checks:
        - captLocal
        - commentedOutCode
        - deferInLoop
        - hexLiteral
        - hugeParam
        - tooManyResultsChecker
        - unnamedResult
      enable-all: true
    gomodguard:
      blocked:
        modules:
          - io/ioutil:
              recommendations:
                - io
                - os
    gosec:
      excludes:
        - G115
    govet:
      disable:
        - copylocks
        - fieldalignment
        - testinggoroutine
      enable-all: true
    perfsprint:
      # Optimizes even if it requires an int or uint type cast.
      int-conversion: true
      # Optimizes into `err.Error()` even if it is only equivalent for non-nil errors.
      err-error: true
      # Optimizes `fmt.Errorf`.
      errorf: true
      # Optimizes `fmt.Sprintf` with only one argument.
      sprintf1: true
      # Optimizes into strings concatenation.
      strconcat: true
    revive:
      rules:
        - name: blank-imports
        - name: context-as-argument
          arguments:
            - allowTypesBefore: "*testing.T"
        - name: context-keys-type
        - name: dot-imports
        - name: duplicated-imports
        - name: early-return
          arguments:
            - "preserveScope"
        - name: empty-block
          disabled: true
        - name: error-naming
        - name: error-return
        - name: error-strings
        - name: exported
          disabled: true
        - name: errorf
        - name: increment-decrement
        - name: indent-error-flow
          arguments:
            - "preserveScope"
        - name: range
        - name: receiver-naming
        - name: redefines-builtin-id
        - name: redundant-import-alias
        - name: superfluous-else
          arguments:
            - "preserveScope"
        - name: time-date
        - name: time-equal
        - name: time-naming
        - name: unexported-return
        - name: unnecessary-stmt
        - name: unreachable-code
        - name: unused-parameter
        - name: unused-receiver
        - name: use-any
        - name: var-declaration
        - name: var-naming
          arguments:
            - ["ID"] # AllowList
            - ["VM"] # DenyList
            - - upperCaseConst: true # Extra parameter (upperCaseConst|skipPackageNameChecks)
                skipPackageNameChecks: true
    staticcheck:
      checks:
        - all
        - -SA1019 # Using a deprecated function, variable, constant or field
        - -SA2002 # Called testing.T.FailNow or SkipNow in a goroutine, which isn’t allowed
        - -SA4003 # Comparing unsigned values against negative values is pointless
        - -SA4004 # The loop exits unconditionally after one iteration
        - -SA4008 # The variable in the loop condition never changes, are you incrementing the wrong variable?
        - -SA5003 # Defers in infinite loops will never execute
        - -SA9003 # Empty body in an if or else branch
        - -ST1003 # Poorly chosen identifier
    testifylint:
      enable-all: true
    usetesting:
      os-create-temp: false
      os-mkdir-temp: false
  exclusions:
    generated: lax
    presets:
      - comments
      - common-false-positives
      - legacy
      - std-error-handling
    rules:
      - text: 'shadow: declaration of "err" shadows declaration at line'
        linters:
          - govet
    warn-unused: true
output:
  show-stats: false
run:
  timeout: 5m
