github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/engine/hack/validate/golangci-lint.yml (about)

     1  linters:
     2    enable:
     3      - goimports
     4      - gosec
     5      - gosimple
     6      - govet
     7      - ineffassign
     8      - misspell
     9      - revive
    10      - staticcheck
    11      - typecheck
    12      - unconvert
    13      - unused
    14  
    15    disable:
    16      - errcheck
    17  
    18    run:
    19      concurrency: 2
    20      modules-download-mode: vendor
    21  
    22      skip-dirs:
    23        - docs
    24  
    25  linters-settings:
    26    govet:
    27      check-shadowing: false
    28    revive:
    29      rules:
    30        # FIXME make sure all packages have a description. Currently, there's many packages without.
    31        - name: package-comments
    32          disabled: true
    33  issues:
    34    # The default exclusion rules are a bit too permissive, so copying the relevant ones below
    35    exclude-use-default: false
    36  
    37    exclude-rules:
    38      # We prefer to use an "exclude-list" so that new "default" exclusions are not
    39      # automatically inherited. We can decide whether or not to follow upstream
    40      # defaults when updating golang-ci-lint versions.
    41      # Unfortunately, this means we have to copy the whole exclusion pattern, as
    42      # (unlike the "include" option), the "exclude" option does not take exclusion
    43      # ID's.
    44      #
    45      # These exclusion patterns are copied from the default excluses at:
    46      # https://github.com/golangci/golangci-lint/blob/v1.46.2/pkg/config/issues.go#L10-L104
    47  
    48      # EXC0001
    49      - text: "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*print(f|ln)?|os\\.(Un)?Setenv). is not checked"
    50        linters:
    51          - errcheck
    52      # EXC0006
    53      - text: "Use of unsafe calls should be audited"
    54        linters:
    55          - gosec
    56      # EXC0007
    57      - text: "Subprocess launch(ed with variable|ing should be audited)"
    58        linters:
    59          - gosec
    60      # EXC0008
    61      # TODO: evaluate these and fix where needed: G307: Deferring unsafe method "*os.File" on type "Close" (gosec)
    62      - text: "(G104|G307)"
    63        linters:
    64          - gosec
    65      # EXC0009
    66      - text: "(Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)"
    67        linters:
    68          - gosec
    69      # EXC0010
    70      - text: "Potential file inclusion via variable"
    71        linters:
    72          - gosec
    73  
    74      # Looks like the match in "EXC0007" above doesn't catch this one
    75      # TODO: consider upstreaming this to golangci-lint's default exclusion rules
    76      - text: "G204: Subprocess launched with a potential tainted input or cmd arguments"
    77        linters:
    78          - gosec
    79      # Looks like the match in "EXC0009" above doesn't catch this one
    80      # TODO: consider upstreaming this to golangci-lint's default exclusion rules
    81      - text: "G306: Expect WriteFile permissions to be 0600 or less"
    82        linters:
    83          - gosec
    84  
    85      # Exclude some linters from running on tests files.
    86      - path: _test\.go
    87        linters:
    88          - errcheck
    89          - gosec
    90  
    91      # Suppress golint complaining about generated types in api/types/
    92      - text: "type name will be used as (container|volume)\\.(Container|Volume).* by other packages, and that stutters; consider calling this"
    93        path: "api/types/(volume|container)/"
    94        linters:
    95          - revive
    96      # FIXME: evaluate these and fix where needed: G307: Deferring unsafe method "*os.File" on type "Close" (gosec)
    97      - text: "G307: Deferring unsafe method"
    98        linters:
    99          - gosec
   100      # FIXME temporarily suppress these. See #39924
   101      - text: "SA1019: .*\\.Xattrs is deprecated: Use PAXRecords instead"
   102        linters:
   103          - staticcheck
   104      # FIXME temporarily suppress these. See #39926
   105      - text: "SA1019: httputil.NewClientConn"
   106        linters:
   107          - staticcheck
   108      # FIXME temporarily suppress these (related to the ones above)
   109      - text: "SA1019: httputil.ErrPersistEOF"
   110        linters:
   111          - staticcheck
   112  
   113    # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
   114    max-issues-per-linter: 0
   115  
   116    # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
   117    max-same-issues: 0