github.com/rawahars/moby@v24.0.4+incompatible/hack/validate/golangci-lint.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      list-type: blacklist
    44      include-go-root: true
    45      packages:
    46        # The io/ioutil package has been deprecated.
    47        # https://go.dev/doc/go1.16#ioutil
    48        - io/ioutil
    49    revive:
    50      rules:
    51        # FIXME make sure all packages have a description. Currently, there's many packages without.
    52        - name: package-comments
    53          disabled: true
    54  issues:
    55    # The default exclusion rules are a bit too permissive, so copying the relevant ones below
    56    exclude-use-default: false
    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.46.2/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      # EXC0006
    74      - text: "Use of unsafe calls should be audited"
    75        linters:
    76          - gosec
    77      # EXC0007
    78      - text: "Subprocess launch(ed with variable|ing should be audited)"
    79        linters:
    80          - gosec
    81      # EXC0008
    82      # TODO: evaluate these and fix where needed: G307: Deferring unsafe method "*os.File" on type "Close" (gosec)
    83      - text: "(G104|G307)"
    84        linters:
    85          - gosec
    86      # EXC0009
    87      - text: "(Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)"
    88        linters:
    89          - gosec
    90      # EXC0010
    91      - text: "Potential file inclusion via variable"
    92        linters:
    93          - gosec
    94  
    95      # Looks like the match in "EXC0007" above doesn't catch this one
    96      # TODO: consider upstreaming this to golangci-lint's default exclusion rules
    97      - text: "G204: Subprocess launched with a potential tainted input or cmd arguments"
    98        linters:
    99          - gosec
   100      # Looks like the match in "EXC0009" above doesn't catch this one
   101      # TODO: consider upstreaming this to golangci-lint's default exclusion rules
   102      - text: "G306: Expect WriteFile permissions to be 0600 or less"
   103        linters:
   104          - gosec
   105  
   106      # Exclude some linters from running on tests files.
   107      - path: _test\.go
   108        linters:
   109          - errcheck
   110          - gosec
   111  
   112      # Suppress golint complaining about generated types in api/types/
   113      - text: "type name will be used as (container|volume)\\.(Container|Volume).* by other packages, and that stutters; consider calling this"
   114        path: "api/types/(volume|container)/"
   115        linters:
   116          - revive
   117      # FIXME temporarily suppress these. See #39924
   118      - text: "SA1019: .*\\.Xattrs has been deprecated since Go 1.10: Use PAXRecords instead"
   119        linters:
   120          - staticcheck
   121      # FIXME temporarily suppress these. See #39926
   122      - text: "SA1019: httputil.NewClientConn"
   123        linters:
   124          - staticcheck
   125      # FIXME temporarily suppress these (related to the ones above)
   126      - text: "SA1019: httputil.ErrPersistEOF"
   127        linters:
   128          - staticcheck
   129  
   130    # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
   131    max-issues-per-linter: 0
   132  
   133    # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
   134    max-same-issues: 0