...

Text file src/sigs.k8s.io/controller-runtime/.golangci.yml

Documentation: sigs.k8s.io/controller-runtime

     1linters:
     2  disable-all: true
     3  enable:
     4    - asasalint
     5    - asciicheck
     6    - bidichk
     7    - bodyclose
     8    - dogsled
     9    - dupl
    10    - errcheck
    11    - errchkjson
    12    - errorlint
    13    - exhaustive
    14    - exportloopref
    15    - ginkgolinter
    16    - goconst
    17    - gocritic
    18    - gocyclo
    19    - gofmt
    20    - goimports
    21    - goprintffuncname
    22    - gosec
    23    - gosimple
    24    - govet
    25    - importas
    26    - ineffassign
    27    - makezero
    28    - misspell
    29    - nakedret
    30    - nilerr
    31    - nolintlint
    32    - prealloc
    33    - revive
    34    - staticcheck
    35    - stylecheck
    36    - tagliatelle
    37    - typecheck
    38    - unconvert
    39    - unparam
    40    - unused
    41    - whitespace
    42
    43linters-settings:
    44  govet:
    45    enable-all: true
    46    disable:
    47      - fieldalignment
    48      - shadow
    49  importas:
    50    no-unaliased: true
    51    alias:
    52      # Kubernetes
    53      - pkg: k8s.io/api/core/v1
    54        alias: corev1
    55      - pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
    56        alias: apiextensionsv1
    57      - pkg: k8s.io/apimachinery/pkg/apis/meta/v1
    58        alias: metav1
    59      - pkg: k8s.io/apimachinery/pkg/api/errors
    60        alias: apierrors
    61      - pkg: k8s.io/apimachinery/pkg/util/errors
    62        alias: kerrors
    63      # Controller Runtime
    64      - pkg: sigs.k8s.io/controller-runtime
    65        alias: ctrl
    66  revive:
    67    rules:
    68      # The following rules are recommended https://github.com/mgechev/revive#recommended-configuration
    69      - name: blank-imports
    70      - name: context-as-argument
    71      - name: context-keys-type
    72      - name: dot-imports
    73      - name: error-return
    74      - name: error-strings
    75      - name: error-naming
    76      - name: exported
    77      - name: if-return
    78      - name: increment-decrement
    79      - name: var-naming
    80      - name: var-declaration
    81      - name: range
    82      - name: receiver-naming
    83      - name: time-naming
    84      - name: unexported-return
    85      - name: indent-error-flow
    86      - name: errorf
    87      - name: superfluous-else
    88      - name: unreachable-code
    89      - name: redefines-builtin-id
    90      #
    91      # Rules in addition to the recommended configuration above.
    92      #
    93      - name: bool-literal-in-expr
    94      - name: constant-logical-expr
    95
    96issues:
    97  max-same-issues: 0
    98  max-issues-per-linter: 0
    99  # We are disabling default golangci exclusions because we want to help reviewers to focus on reviewing the most relevant
   100  # changes in PRs and avoid nitpicking.
   101  exclude-use-default: false
   102  # List of regexps of issue texts to exclude, empty list by default.
   103  exclude:
   104    # The following are being worked on to remove their exclusion. This list should be reduced or go away all together over time.
   105    # If it is decided they will not be addressed they should be moved above this comment.
   106    - Subprocess launch(ed with variable|ing should be audited)
   107    - (G204|G104|G307)
   108    - "ST1000: at least one file in a package should have a package comment"
   109  exclude-files:
   110    - "zz_generated.*\\.go$"
   111    - ".*conversion.*\\.go$"
   112  exclude-rules:
   113    - linters:
   114        - gosec
   115      text: "G108: Profiling endpoint is automatically exposed on /debug/pprof"
   116    - linters:
   117        - revive
   118      text: "exported: exported method .*\\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported"
   119    - linters:
   120        - errcheck
   121      text: Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
   122    - linters:
   123        - staticcheck
   124      text: "SA1019: .*The component config package has been deprecated and will be removed in a future release."
   125    # With Go 1.16, the new embed directive can be used with an un-named import,
   126    # revive (previously, golint) only allows these to be imported in a main.go, which wouldn't work for us.
   127    # This directive allows the embed package to be imported with an underscore everywhere.
   128    - linters:
   129        - revive
   130      source: _ "embed"
   131    # Exclude some packages or code to require comments, for example test code, or fake clients.
   132    - linters:
   133        - revive
   134      text: exported (method|function|type|const) (.+) should have comment or be unexported
   135      source: (func|type).*Fake.*
   136    - linters:
   137        - revive
   138      text: exported (method|function|type|const) (.+) should have comment or be unexported
   139      path: fake_\.go
   140    # Disable unparam "always receives" which might not be really
   141    # useful when building libraries.
   142    - linters:
   143        - unparam
   144      text: always receives
   145    # Dot imports for gomega and ginkgo are allowed
   146    # within test files.
   147    - path: _test\.go
   148      text: should not use dot imports
   149    - path: _test\.go
   150      text: cyclomatic complexity
   151    - path: _test\.go
   152      text: "G107: Potential HTTP request made with variable url"
   153    # Append should be able to assign to a different var/slice.
   154    - linters:
   155        - gocritic
   156      text: "appendAssign: append result not assigned to the same slice"
   157    - linters:
   158        - gocritic
   159      text: "singleCaseSwitch: should rewrite switch statement to if statement"
   160    # It considers all file access to a filename that comes from a variable problematic,
   161    # which is naiv at best.
   162    - linters:
   163        - gosec
   164      text: "G304: Potential file inclusion via variable"
   165    - linters:
   166        - dupl
   167      path: _test\.go
   168
   169run:
   170  go: "1.22"
   171  timeout: 10m
   172  allow-parallel-runners: true

View as plain text