version: "2"
linters:
  default: none
  enable:
    - bidichk
    - depguard
    - dupl
    - errcheck
    - gocritic
    - govet
    - ineffassign
    - misspell
    - nakedret
    - nolintlint
    - revive
    - staticcheck
    - unconvert
    - unused
    - usetesting
    - wastedassign
  settings:
    depguard:
      rules:
        main:
          deny:
            - pkg: io/ioutil
              desc: use os or io instead
    gocritic:
      disabled-checks:
        - ifElseChain
        - singleCaseSwitch
    nakedret:
      max-func-lines: 0
    revive:
      confidence: 0.8
      severity: warning
      rules:
        - name: blank-imports
        - name: context-as-argument
        - name: context-keys-type
        - name: dot-imports
        - name: error-return
        - name: error-strings
        - name: error-naming
        - name: exported
        - name: if-return
        - name: increment-decrement
        - name: var-naming
          arguments: [[], [], [{ skipPackageNameChecks: true }]]
        - name: var-declaration
        - name: package-comments
        - name: range
        - name: receiver-naming
        - name: time-naming
        - name: unexported-return
        - name: indent-error-flow
        - name: errorf
        - name: duplicated-imports
        - name: modifies-value-receiver
    staticcheck:
      checks:
        - all
        - -ST1003
        - -ST1005
  exclusions:
    generated: lax
    presets:
      - comments
      - common-false-positives
      - legacy
      - std-error-handling
    rules:
      - linters:
          - dupl
          - errcheck
          - gocyclo
          - gosec
          - staticcheck
          - unparam
        path: _test\.go
      - linters:
          - dupl
          - errcheck
          - gocyclo
          - gosec
        path: models/migrations/v
      - linters:
          - dupl
        text: webhook
      - linters:
          - gocritic
        text: '`ID'' should not be capitalized'
      - linters:
          - gocritic
        path: modules/templates/helper.go
      - linters:
          - unused
        text: swagger
      - linters:
          - errcheck
        path: contrib/pr/checkout.go
      - linters:
          - errcheck
        path: models/issue.go
      - linters:
          - errcheck
        path: models/migrations/
      - linters:
          - errcheck
        path: modules/log/
      - linters:
          - dupl
        path: routers/api/v1/repo/issue_subscription.go
      - linters:
          - dupl
        path: routers/repo/view.go
      - linters:
          - unused
        path: models/migrations/
      - linters:
          - staticcheck
        text: argument x is overwritten before first use
      - linters:
          - staticcheck
        path: modules/httplib/httplib.go
      - linters:
          - dupl
        path: models/issue_comment_list.go
      - linters:
          - misspell
        text: '`Unknwon` is a misspelling of `Unknown`'
      - linters:
          - unused
        path: models/update.go
      - linters:
          - dupl
        path: cmd/dump.go
      - linters:
          - gocritic
        text: 'commentFormatting: put a space between `//` and comment text'
      - linters:
          - gocritic
        text: 'exitAfterDefer:'
      - linters:
          - staticcheck
        path: modules/graceful/manager_windows.go
        text: 'svc.IsAnInteractiveSession is deprecated: Use IsWindowsService instead.'
      - linters:
          - golint
        path: models/user/openid.go
    paths:
      - third_party$
      - builtin$
      - examples$
formatters:
  enable:
    - gofmt
    - gofumpt
  settings:
    gofumpt:
      extra-rules: true
  exclusions:
    generated: lax
    paths:
      - third_party$
      - builtin$
      - examples$
