github.com/panekj/cli@v0.0.0-20230304125325-467dd2f3797e/.golangci.yml (about)

     1  linters:
     2    enable:
     3      - bodyclose
     4      - depguard
     5      - dogsled
     6      - gocyclo
     7      - gofumpt
     8      - goimports
     9      - gosec
    10      - gosimple
    11      - govet
    12      - ineffassign
    13      - lll
    14      - megacheck
    15      - misspell
    16      - nakedret
    17      - revive
    18      - staticcheck
    19      - typecheck
    20      - unconvert
    21      - unparam
    22      - unused
    23  
    24    disable:
    25      - errcheck
    26  
    27  run:
    28    timeout: 5m
    29    skip-files:
    30      - cli/compose/schema/bindata.go
    31      - .*generated.*
    32  
    33  linters-settings:
    34    depguard:
    35      list-type: blacklist
    36      include-go-root: true
    37      packages:
    38        # The io/ioutil package has been deprecated.
    39        # https://go.dev/doc/go1.16#ioutil
    40        - io/ioutil
    41    gocyclo:
    42      min-complexity: 16
    43    govet:
    44      check-shadowing: false
    45    lll:
    46      line-length: 200
    47    nakedret:
    48      command: nakedret
    49      pattern: ^(?P<path>.*?\\.go):(?P<line>\\d+)\\s*(?P<message>.*)$
    50  
    51  issues:
    52    # The default exclusion rules are a bit too permissive, so copying the relevant ones below
    53    exclude-use-default: false
    54  
    55    exclude:
    56      - parameter .* always receives
    57  
    58    exclude-rules:
    59      # We prefer to use an "exclude-list" so that new "default" exclusions are not
    60      # automatically inherited. We can decide whether or not to follow upstream
    61      # defaults when updating golang-ci-lint versions.
    62      # Unfortunately, this means we have to copy the whole exclusion pattern, as
    63      # (unlike the "include" option), the "exclude" option does not take exclusion
    64      # ID's.
    65      #
    66      # These exclusion patterns are copied from the default excluses at:
    67      # https://github.com/golangci/golangci-lint/blob/v1.44.0/pkg/config/issues.go#L10-L104
    68  
    69      # EXC0001
    70      - text: "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*print(f|ln)?|os\\.(Un)?Setenv). is not checked"
    71        linters:
    72          - errcheck
    73      # EXC0003
    74      - text: "func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this"
    75        linters:
    76          - revive
    77      # EXC0006
    78      - text: "Use of unsafe calls should be audited"
    79        linters:
    80          - gosec
    81      # EXC0007
    82      - text: "Subprocess launch(ed with variable|ing should be audited)"
    83        linters:
    84          - gosec
    85      # EXC0008
    86      # TODO: evaluate these and fix where needed: G307: Deferring unsafe method "*os.File" on type "Close" (gosec)
    87      - text: "(G104|G307)"
    88        linters:
    89          - gosec
    90      # EXC0009
    91      - text: "(Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)"
    92        linters:
    93          - gosec
    94      # EXC0010
    95      - text: "Potential file inclusion via variable"
    96        linters:
    97          - gosec
    98  
    99      # G113 Potential uncontrolled memory consumption in Rat.SetString (CVE-2022-23772)
   100      # only affects gp < 1.16.14. and go < 1.17.7
   101      - text: "(G113)"
   102        linters:
   103          - gosec
   104  
   105      # Looks like the match in "EXC0007" above doesn't catch this one
   106      # TODO: consider upstreaming this to golangci-lint's default exclusion rules
   107      - text: "G204: Subprocess launched with a potential tainted input or cmd arguments"
   108        linters:
   109          - gosec
   110      # Looks like the match in "EXC0009" above doesn't catch this one
   111      # TODO: consider upstreaming this to golangci-lint's default exclusion rules
   112      - text: "G306: Expect WriteFile permissions to be 0600 or less"
   113        linters:
   114          - gosec
   115  
   116      # TODO: make sure all packages have a description. Currently, there's 67 packages without.
   117      - text: "package-comments: should have a package comment"
   118        linters:
   119          - revive
   120  
   121      # Exclude some linters from running on tests files.
   122      - path: _test\.go
   123        linters:
   124          - errcheck
   125          - gosec
   126  
   127    # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
   128    max-issues-per-linter: 0
   129  
   130    # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
   131    max-same-issues: 0