github.com/khulnasoft-lab/khulnasoft@v26.0.1-0.20240328202558-330a6f959fe0+incompatible/.golangci.yml (about)

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