github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/.golangci.yml (about)

     1  linters:
     2    enable-all: false
     3    disable-all: true
     4    enable:
     5      - revive
     6      - asciicheck
     7      - bodyclose
     8      - dogsled
     9      - dupl
    10      - durationcheck
    11      - errcheck
    12      - exportloopref
    13      - gci
    14      - gocritic
    15      - gofmt
    16      - goheader
    17      - gochecksumtype
    18      - goimports
    19      - gomoddirectives
    20      - goprintffuncname
    21      - gosec
    22      - gosimple
    23      - govet
    24      - importas
    25      - intrange
    26      - ineffassign
    27      - misspell
    28      - nolintlint
    29      - perfsprint
    30      - prealloc
    31      - protogetter
    32      - reassign
    33      - staticcheck
    34      - testifylint
    35      - testpackage
    36      - typecheck
    37      - unconvert
    38      - unparam
    39      - unused
    40      - whitespace
    41  
    42  # See: https://golangci-lint.run/usage/linters/
    43  
    44  linters-settings:
    45    revive:
    46      ignore-generated-header: true
    47      severity: warning
    48      rules:
    49        # name: import-shadowing
    50        # name: unhandled-error
    51        # name: line-length-limit
    52        # name: dot-imports
    53        - name: blank-imports
    54        - name: context-as-argument
    55        - name: context-keys-type
    56        - name: early-return
    57        - name: error-naming
    58        - name: error-strings
    59        - name: exported
    60        - name: if-return
    61        - name: imports-blacklist
    62        - name: increment-decrement
    63        - name: indent-error-flow
    64        - name: modifies-value-receiver
    65        - name: package-comments
    66        - name: range
    67        - name: receiver-naming
    68        - name: redefines-builtin-id
    69        - name: string-of-int
    70        - name: superfluous-else
    71        - name: time-naming
    72        - name: var-naming
    73        - name: var-declaration
    74        - name: unconditional-recursion
    75        - name: unexported-naming
    76        - name: unexported-return
    77        - name: unnecessary-stmt
    78        - name: unreachable-code
    79        - name: unused-parameter
    80        - name: unused-receiver
    81        - name: waitgroup-by-value
    82    gci:
    83      skip-generated: true
    84    govet:
    85      enable-all: true
    86      disable:
    87        - fieldalignment # TODO: Enable, for now reports a lot of problems.
    88        - shadow # Reports a lot of false-positives and conflicts with other linters.
    89    golint:
    90      min-confidence: 0
    91    errcheck:
    92      check-blank: true
    93      check-type-assertions: false
    94    gocritic:
    95      enabled-tags:
    96        - performance
    97        - style
    98      disabled-checks:
    99        - ifElseChain
   100        - unnamedResult
   101    gosec:
   102      excludes:
   103        - G401
   104        - G402
   105        - G404
   106        - G501
   107    prealloc:
   108      simple: true # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them
   109      range-loops: true # Report preallocation suggestions on range loops, true by default
   110      for-loops: true # Report preallocation suggestions on for loops, false by default
   111    misspell:
   112      # Correct spellings using locale preferences for US or UK.
   113      # Default is to use a neutral variety of English.
   114      # Setting locale to US will correct the British spelling of 'colour' to 'color'.
   115      locale: US
   116  
   117  issues:
   118    # use default exclude rules
   119    exclude-use-default: true
   120  
   121    # additional exclude rules
   122    exclude-rules:
   123      - linters: errcheck
   124        text: "Error return value of" # ignores 'error return value of ... is unchecked'
   125  
   126      - linters: golint
   127        text: "and that stutters; consider calling this"
   128  
   129      - linters: golint
   130        text: "don't use an underscore in package name"
   131  
   132      - linters: revive
   133        text: "or a comment on this block"
   134  
   135      - linters: unused
   136        text: "`noCopy` is unused"
   137  
   138      - linters: gocritic
   139        text: "importShadow: shadow of imported"
   140  
   141      - linters: gocritic
   142        text: "builtinShadow: shadowing of predeclared identifier: new"
   143  
   144      - linters: [gocritic, gofmt, goimports]
   145        source: "///" # commentFormatting
   146  
   147      - linters: [gocritic, gofmt, goimports]
   148        source: "//==" # commentFormatting
   149  
   150      - linters: staticcheck
   151        text: "SA5011:" # produces a lot of false-positives; hopefully in the future we could enable it!
   152  
   153      - linters: interfacer
   154        text: "k8s.io/client-go/rest.HTTPClient" # suggests to change `*http.Client` to `rest.HTTPClient`...
   155  
   156      - linters: staticcheck
   157        text: "SA3000: TestMain should call os.Exit to set exit code" # This is not true for Go1.15 or later.
   158  
   159      - linters: gocritic
   160        text: "block doesn't have definitions" # Sometimes blocks are useful for better readability.
   161  
   162      - linters: golint
   163        source: "embed" # Justification for `import _ "embed"` is not needed.
   164  
   165    # Set to 0 to disable limit
   166    max-same-issues: 0
   167    max-per-linter: 0
   168  
   169  run:
   170    go: '1.22'
   171    tests: true # enable linting test files
   172  
   173    build-tags:
   174      - hrw aws azure gcp # Build hrw and backend providers so that staticcheck doesn't complain about unused export functions.
   175  
   176    concurrency: 4
   177    deadline: 6m