github.com/tonistiigi/docker@v0.10.1-0.20240229224939-974013b0dc6a/.golangci.yml (about)

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