github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/.golangci.yml (about)

     1  run:
     2    go: "1.21"
     3    build-tags:
     4      - intest
     5  linters:
     6    enable:
     7      - unconvert
     8      - unparam
     9      - revive
    10      - depguard
    11      - misspell
    12      - ineffassign
    13      - typecheck
    14      - unused
    15      - gosimple
    16      - errcheck
    17      - staticcheck
    18      - stylecheck
    19      - gosec
    20      - asciicheck
    21      - exportloopref
    22      - makezero
    23      - tparallel
    24      - rowserrcheck
    25      - sqlclosecheck
    26      - noctx
    27      - bodyclose
    28      - misspell
    29  
    30  linters-settings:
    31    revive:
    32      ignore-generated-header: false
    33      severity: error
    34      confidence: 0.8
    35      error-code: -1
    36      warning-code: -1
    37      rules:
    38        - name: blank-imports
    39        - name: context-as-argument
    40        - name: dot-imports
    41        - name: error-return
    42        - name: error-strings
    43        - name: error-naming
    44        - name: exported
    45        - name: if-return
    46        - name: var-naming
    47        - name: package-comments
    48        - name: range
    49        - name: receiver-naming
    50        - name: indent-error-flow
    51        - name: superfluous-else
    52        - name: modifies-parameter
    53        - name: unreachable-code
    54  
    55    depguard:
    56      list-type: denylist
    57      include-go-root: true
    58      packages:
    59        - log
    60        - github.com/juju/errors
    61      packages-with-error-message:
    62        # specify an error message to output when a blacklisted package is used
    63        - log: "logging is allowed only by pingcap/log"
    64        - github.com/juju/errors: "error handling is allowed only by pingcap/errors"
    65      additional-guards:
    66        - list-type: denylist
    67          include-go-root: true
    68          packages:
    69            - errors
    70            - github.com/pingcap/errors
    71          packages-with-error-message:
    72            - errors: "error handling is allowed only by github.com/pingcap/tiflow/pkg/errors"
    73            - github.com/pingcap/errors: "error handling is allowed only by github.com/pingcap/tiflow/pkg/errors"
    74          ignore-file-rules:
    75            - "!**/tiflow/engine/**"
    76            - "**/engine/pkg/rpcutil/*.go"
    77    staticcheck:
    78      checks:
    79        [
    80          "S1002",
    81          "S1004",
    82          "S1007",
    83          "S1009",
    84          "S1010",
    85          "S1012",
    86          "S1019",
    87          "S1020",
    88          "S1021",
    89          "S1024",
    90          "S1030",
    91          "SA2*",
    92          "SA3*",
    93          "SA4009",
    94          "SA5*",
    95          "SA6000",
    96          "SA6001",
    97          "SA6005",
    98          "-SA2002",
    99        ]
   100    stylecheck:
   101      checks: ["-ST1003"]
   102    gosec:
   103      excludes:
   104        - G404
   105        - G601
   106        - G108
   107        - G114
   108  
   109  issues:
   110    exclude-rules:
   111      - path: _test\.go
   112        linters:
   113          - errcheck
   114          - gosec
   115          - makezero
   116      # G113 Potential uncontrolled memory consumption in Rat.SetString (CVE-2022-23772)
   117      # only affects gp < 1.16.14. and go < 1.17.7
   118      - text: "(G113)"
   119        linters:
   120          - gosec
   121    include:
   122      - EXC0012 # exported (.+) should have comment( \(or a comment on this block\))? or be unexported)
   123      - EXC0014 # comment on exported (.+) should be of the form "(.+)..."