# This file contains all available configuration options
# with their default values.

# options for analysis running
run:
  # default concurrency is a available CPU number
  #concurrency: 4

  # timeout for analysis, e.g. 30s, 5m, default is 1m
  deadline: 30m

  # include test files or not, default is true
  tests: false

  # which dirs to skip: they won't be analyzed;
  # can use regexp here: generated.*, regexp is applied on full path;
  # default value is empty list, but next dirs are always skipped independently
  # from this option's value:
  #		vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
  skip-dirs:
    - bin$
    - api$
    - build$
    - configs$
    - deployments$
    - docs$
    - githooks$
    - init$
    - third_party$
    - tools$
    - vendor$
    - \.git$

  # which files to skip: they will be analyzed, but issues from them
  # won't be reported. Default value is empty list, but there is
  # no need to include all autogenerated files, we confidently recognize
  # autogenerated files. If it's not please let us know.
  skip-files:
    - "_easyjson.go"
#    - "_rpc.go"
#    - ".pb.go"

# all available settings of specific linters
linters-settings:
  errcheck:
    # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
    # default is false: such cases aren't reported by default.
    check-blank: true

  govet:
    # report about shadowed variables
    check-shadowing: true

  golint:
    # minimal confidence for issues, default is 0.8
    min-confidence: 0.3
  gocyclo:
    # minimal code complexity to report, 30 by default (but we recommend 10-20)
    min-complexity: 15
  gocognit:
    # minimal code complexity to report, 30 by default (but we recommend 10-20)
    min-complexity: 20
  dupl:
    # tokens count to trigger issue, 150 by default
    threshold: 200
  lll:
    # max line length, lines longer will be reported. Default is 120.
    # '\t' is counted as 1 character by default, and can be changed with the tab-width option
    line-length: 120
  nakedret:
    # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
    max-func-lines: 30
  funlen:
    lines: 80
    statements: 50
  godox:
    # report any comments starting with keywords, this is useful for TODO or FIXME comments that
    # might be left in the code accidentally and should be resolved before merging
    keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting
      - TODO
      - BUG
      - FIXME
      - HACK
  dogsled:
    # checks assignments with too many blank identifiers; default is 2
    max-blank-identifiers: 2
  whitespace:
    multi-if: false   # Enforces newlines (or comments) after every multi-line if statement
    multi-func: false # Enforces newlines (or comments) after every multi-line function signature
  wsl:
    # If true append is only allowed to be cuddled if appending value is
    # matching variables, fields or types on line above. Default is true.
    strict-append: true
    # Allow calls and assignments to be cuddled as long as the lines have any
    # matching variables, fields or types. Default is true.
    allow-assign-and-call: true
    # Allow multiline assignments to be cuddled. Default is true.
    allow-multiline-assign: true
    # Allow declarations (var) to be cuddled.
    allow-cuddle-declarations: false
    # Allow trailing comments in ending of blocks
    allow-trailing-comment: false
    # Force newlines in end of case at this limit (0 = never).
    force-case-trailing-whitespace: 0

linters:
  disable-all: true
  enable:
    - bodyclose
    - deadcode
    - depguard
    - dupl
    - errcheck
    - goconst
    - gocritic
    - gocyclo
    #- godox
    - golint
    - gosec
    - gosimple
    - govet
    - ineffassign
    - interfacer
    - lll
    - misspell
    - nakedret
    - prealloc
    - scopelint
    - staticcheck
    - structcheck
    - stylecheck
    - typecheck
    - unconvert
    - unparam
    - unused
    - varcheck
  #disable:
  #  - goimports        # not needed
  #  - maligned         # not critical for us
  #  - gochecknoglobals # we are using this
  #  - gochecknoinits   # and this
  #  - dogsled          # it is not clear how to fix problems from this linter
  #  - gofmt            # buggy linter and we have script check
  #
  # # new
  #  - gomnd            # supported from 1.22.2
  #  - funlen           # dupl of gocyclo
  #  - gocognit         # the same
  #  - wsl              # imho, useless as linter, needed autoformat tool
  #  - whitespace       # the same
  fast: false

issues:
  max-issues-per-linter: 0
  max-same-issues: 0
  exclude:
    - "should have comment"
    - "always receives"
    - "parameter .* is always"
    - "comment on exported .* should be of the form"
    - "Use of weak cryptographic primitive"
    - "can be `fmt.Stringer`"
    - "can be `github.com/gogo/protobuf/proto.Message`"
    - 'ST1016: methods on the same type should have the same receiver name \(seen \d+x "[^"]+", 4x "v"\)'
    - 'ST1016: methods on the same type should have the same receiver name \(seen 4x "v", \d+x "[^"]+"\)'
    - 'ST1016: methods on the same type should have the same receiver name \(seen \d+x "[^"]+", \d+x "srv"\)'
    - 'ST1016: methods on the same type should have the same receiver name \(seen \d+x "srv", \d+x "[^"]+"\)'

  exclude-rules:
    # Exclude lll issues for long lines with go:generate
    - linters:
        - lll
      source: "^//go:generate "

output:
  format: tab
