---
linters-settings:
  dupl:
    threshold: 100
  exhaustive:
    default-signifies-exhaustive: false
  funlen:
    lines: 200
    statements: 150
  goconst:
    min-len: 3
    min-occurrences: 3
  gocritic:
    enabled-tags:
      - diagnostic
      - experimental
      - opinionated
      - performance
      - style
    disabled-checks:
      - dupImport   # https://github.com/go-critic/go-critic/issues/845
      - ifElseChain
      - octalLiteral
      - whyNoLint
      - wrapperFunc
  gocyclo:
    min-complexity: 15
  golint:
    min-confidence: 0
  gomnd:
    settings:
      mnd:
        # don't include the "operation" and "assign"
        checks: [argument,case,condition,return]
  govet:
    check-shadowing: true
    fieldalignment:
    settings:
      printf:
        funcs:
          - (github.com/jenkins-x/jx-logging/pkg/log/Logger()).Debugf
          - (github.com/jenkins-x/jx-logging/pkg/log/Logger()).Infof
          - (github.com/jenkins-x/jx-logging/pkg/log/Logger()).Warnf
          - (github.com/jenkins-x/jx-logging/pkg/log/Logger()).Errorf
          - (github.com/jenkins-x/jx-logging/pkg/log/Logger()).Fatalf
  lll:
    line-length: 140
  maligned:
    suggest-new: true
  misspell:
    locale: US
  nolintlint:
    allow-leading-space: true   # don't require machine-readable nolint directives (i.e. with no leading space)
    allow-unused: false         # report any unused nolint directives
    require-explanation: false  # don't require an explanation for nolint directives
    require-specific: false     # don't require nolint directives to be specific about which linter is being skipped
linters:
  # please, do not use `enable-all`: it's deprecated and will be removed soon.
  # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
  disable-all: true
  enable:
    - asciicheck
    - dogsled
    - errcheck
    - funlen
    # - gocognit
    - goconst
    # - gocyclo
    # - godot
    - gofmt
    - goimports
    # - golint
    - goprintffuncname
    - gosec
    - gosimple
    - ineffassign
    # - interfacer # deprecated since 1.38.0
    # - lll
    # - maligned  # deprecated since 1.38.0
    - misspell
    - nakedret
    - nolintlint
    # Disabled until fixed for go1.18 - https://github.com/golangci/golangci-lint/issues/2649
    # - rowserrcheck
    # Disabled until fixed for go1.18 - https://github.com/golangci/golangci-lint/issues/2649
    #- structcheck
    # - stylecheck
    - typecheck
    - unconvert
    - unparam
    - unused
    # - whitespace
issues:
  exclude-dirs:
    - test/testdata_etc
    - internal/cache
    - internal/renameio
    - internal/robustio
  # Excluding configuration per-path, per-linter, per-text and per-source
  exclude-rules:
    - path: _test\.go
      linters:
        - gomnd
        - funlen
    - path: _expansion_test\.go
      linters:
        - testpackage
    # https://github.com/go-critic/go-critic/issues/926
    - linters:
        - gocritic
      text: "unnecessaryDefer:"
run:
  timeout: 5m

