open-cluster-management.io/governance-policy-propagator@v0.13.0/build/common/config/.golangci.yml (about)

     1  run:
     2    # timeout for analysis, e.g. 30s, 5m, default is 1m
     3    deadline: 20m
     4    timeout: 20m
     5  
     6    # which dirs to skip: they won't be analyzed;
     7    # can use regexp here: generated.*, regexp is applied on full path;
     8    # default value is empty list, but next dirs are always skipped independently
     9    # from this option's value:
    10    #   	vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
    11    skip-dirs:
    12      - genfiles$
    13      - vendor$
    14      - vbh$
    15  
    16    # which files to skip: they will be analyzed, but issues from them
    17    # won't be reported. Default value is empty list, but there is
    18    # no need to include all autogenerated files, we confidently recognize
    19    # autogenerated files. If it's not please let us know.
    20    skip-files:
    21      - ".*\\.pb\\.go"
    22      - ".*\\.gen\\.go"
    23  
    24  linters:
    25    enable-all: true
    26    disable:
    27      - bodyclose
    28      - contextcheck # New linter to consider
    29      - cyclop
    30      - depguard
    31      - dupl
    32      - funlen
    33      - exhaustruct
    34      - exhaustivestruct
    35      - forcetypeassert
    36      - gci # disable until it's more configurable
    37      - gochecknoglobals
    38      - gochecknoinits
    39      - gocognit
    40      - goconst
    41      - gocyclo
    42      - godot
    43      - goerr113
    44      - golint # replaced by revive
    45      - gomnd
    46      - gomoddirectives
    47      - gosec
    48      - ifshort
    49      - interfacer
    50      - ireturn # New linter to consider
    51      - maintidx # New linter to consider
    52      - maligned
    53      - nakedret
    54      - nestif
    55      - nilnil # New linter to consider
    56      - nonamedreturns # New linter to consider
    57      - paralleltest
    58      - prealloc
    59      - scopelint
    60      - testpackage
    61      - varnamelen # New linter to consider
    62      - wrapcheck
    63    fast: false
    64  
    65  linters-settings:
    66    errcheck:
    67      # report about not checking of errors in type assetions: `a := b.(MyStruct)`;
    68      # default is false: such cases aren't reported by default.
    69      check-type-assertions: false
    70  
    71      # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
    72      # default is false: such cases aren't reported by default.
    73      check-blank: false
    74    govet:
    75      # report about shadowed variables
    76      check-shadowing: false
    77    gci:
    78      sections:
    79        - prefix(open-cluster-management.io/governance-policy-propagator)
    80    golint:
    81      # minimal confidence for issues, default is 0.8
    82      min-confidence: 0.0
    83    gofmt:
    84      # simplify code: gofmt with `-s` option, true by default
    85      simplify: true
    86    maligned:
    87      # print struct with more effective memory layout or not, false by default
    88      suggest-new: true
    89    misspell:
    90      # Correct spellings using locale preferences for US or UK.
    91      # Default is to use a neutral variety of English.
    92      # Setting locale to US will correct the British spelling of 'colour' to 'color'.
    93      locale: US
    94      ignore-words:
    95      - cancelled
    96    lll:
    97      # max line length, lines longer will be reported. Default is 120.
    98      # '\t' is counted as 1 character by default, and can be changed with the tab-width option
    99      line-length: 120
   100      # tab width in spaces. Default to 1.
   101      tab-width: 4
   102    unused:
   103      # treat code as a program (not a library) and report unused exported identifiers; default is false.
   104      # XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
   105      # if it's called for subdir of a project it can't find funcs usages. All text editor integrations
   106      # with golangci-lint call it on a directory with the changed file.
   107      check-exported: false
   108    unparam:
   109      # call graph construction algorithm (cha, rta). In general, use cha for libraries,
   110      # and rta for programs with main packages. Default is cha.
   111      algo: cha
   112  
   113      # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
   114      # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
   115      # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
   116      # with golangci-lint call it on a directory with the changed file.
   117      check-exported: false
   118    gocritic:
   119      enabled-checks:
   120        - appendCombine
   121        - argOrder
   122        - assignOp
   123        - badCond
   124        - boolExprSimplify
   125        - builtinShadow
   126        - captLocal
   127        - caseOrder
   128        - codegenComment
   129        - commentedOutCode
   130        - commentedOutImport
   131        - defaultCaseOrder
   132        - deprecatedComment
   133        - docStub
   134        - dupArg
   135        - dupBranchBody
   136        - dupCase
   137        - dupSubExpr
   138        - elseif
   139        - emptyFallthrough
   140        - equalFold
   141        - flagDeref
   142        - flagName
   143        - hexLiteral
   144        - indexAlloc
   145        - initClause
   146        - methodExprCall
   147        - nilValReturn
   148        - octalLiteral
   149        - offBy1
   150        - rangeExprCopy
   151        - regexpMust
   152        - sloppyLen
   153        - stringXbytes
   154        - switchTrue
   155        - typeAssertChain
   156        - typeSwitchVar
   157        - typeUnparen
   158        - underef
   159        - unlambda
   160        - unnecessaryBlock
   161        - unslice
   162        - valSwap
   163        - weakCond
   164  
   165        # Unused
   166        # - yodaStyleExpr
   167        # - appendAssign
   168        # - commentFormatting
   169        # - emptyStringTest
   170        # - exitAfterDefer
   171        # - ifElseChain
   172        # - hugeParam
   173        # - importShadow
   174        # - nestingReduce
   175        # - paramTypeCombine
   176        # - ptrToRefParam
   177        # - rangeValCopy
   178        # - singleCaseSwitch
   179        # - sloppyReassign
   180        # - unlabelStmt
   181        # - unnamedResult
   182        # - wrapperFunc
   183  
   184  issues:
   185    # List of regexps of issue texts to exclude, empty list by default.
   186    # But independently from this option we use default exclude patterns,
   187    # it can be disabled by `exclude-use-default: false`. To list all
   188    # excluded by default patterns execute `golangci-lint run --help`
   189    exclude:
   190      - composite literal uses unkeyed fields
   191      - return statements should not be cuddled if block has more than two lines
   192      - declarations should never be cuddled
   193      - don't use leading k in Go names
   194  
   195    exclude-rules:
   196      # Allow dot imports in the tests.
   197      - path: _test\.go$|^test/
   198        linters:
   199          - gci
   200          - golint
   201          - revive
   202          - stylecheck
   203        source: \. "github\.com/onsi/(gomega|ginkgo/v2)"
   204      # Allow printing in the tests.
   205      - path: _test\.go$|^test/
   206        linters:
   207          - forbidgo
   208        source: fmt\.Print
   209      # Add exceptions to API level tagliatelle violations. Can't use nolint comments since
   210      # that affects the CRD descriptions of the fields.
   211      - path: ^api/
   212        linters:
   213          - tagliatelle
   214        source: json:"policy-templates|"extra_vars|"violation_message
   215      # Don't enforce max line length for kubebuilder markers
   216      - linters:
   217          - lll
   218        source: \/\/ ?\+kubebuilder
   219      # Don't enforce max line length on comments that start with a URL
   220      - linters:
   221          - lll
   222        source: \/\/ ?https?:\/\/
   223      # Disable the lint failure about the name "stuttering"
   224      - linters:
   225          - revive
   226        source: type (PolicyStatusReconciler|ComplianceDBSecretReconciler) struct
   227  
   228    # Independently from option `exclude` we use default exclude patterns,
   229    # it can be disabled by this option. To list all
   230    # excluded by default patterns execute `golangci-lint run --help`.
   231    # Default value for this option is true.
   232    exclude-use-default: true
   233  
   234    # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
   235    max-per-linter: 0
   236  
   237    # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
   238    max-same-issues: 0