github.com/crossplane/upjet@v1.3.0/.golangci.yml (about) 1 # SPDX-FileCopyrightText: 2023 The Crossplane Authors <https://crossplane.io> 2 # 3 # SPDX-License-Identifier: CC0-1.0 4 5 run: 6 timeout: 10m 7 8 skip-files: 9 - "zz_generated\\..+\\.go$" 10 11 output: 12 # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" 13 format: colored-line-number 14 15 linters-settings: 16 errcheck: 17 # report about not checking of errors in type assetions: `a := b.(MyStruct)`; 18 # default is false: such cases aren't reported by default. 19 check-type-assertions: false 20 21 # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; 22 # default is false: such cases aren't reported by default. 23 check-blank: false 24 25 # [deprecated] comma-separated list of pairs of the form pkg:regex 26 # the regex is used to ignore names within pkg. (default "fmt:.*"). 27 # see https://github.com/kisielk/errcheck#the-deprecated-method for details 28 ignore: fmt:.*,io/ioutil:^Read.* 29 30 govet: 31 # report about shadowed variables 32 check-shadowing: false 33 34 revive: 35 # confidence for issues, default is 0.8 36 confidence: 0.8 37 38 gofmt: 39 # simplify code: gofmt with `-s` option, true by default 40 simplify: true 41 42 gci: 43 custom-order: true 44 sections: 45 - standard 46 - default 47 - prefix(github.com/crossplane/upjet) 48 - blank 49 - dot 50 51 gocyclo: 52 # minimal code complexity to report, 30 by default (but we recommend 10-20) 53 min-complexity: 10 54 55 maligned: 56 # print struct with more effective memory layout or not, false by default 57 suggest-new: true 58 59 dupl: 60 # tokens count to trigger issue, 150 by default 61 threshold: 100 62 63 goconst: 64 # minimal length of string constant, 3 by default 65 min-len: 3 66 # minimal occurrences count to trigger, 3 by default 67 min-occurrences: 5 68 69 lll: 70 # tab width in spaces. Default to 1. 71 tab-width: 1 72 73 unused: 74 # treat code as a program (not a library) and report unused exported identifiers; default is false. 75 # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: 76 # if it's called for subdir of a project it can't find funcs usages. All text editor integrations 77 # with golangci-lint call it on a directory with the changed file. 78 check-exported: false 79 80 unparam: 81 # Inspect exported functions, default is false. Set to true if no external program/library imports your code. 82 # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: 83 # if it's called for subdir of a project it can't find external interfaces. All text editor integrations 84 # with golangci-lint call it on a directory with the changed file. 85 check-exported: false 86 87 nakedret: 88 # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 89 max-func-lines: 30 90 91 prealloc: 92 # XXX: we don't recommend using this linter before doing performance profiling. 93 # For most programs usage of prealloc will be a premature optimization. 94 95 # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. 96 # True by default. 97 simple: true 98 range-loops: true # Report preallocation suggestions on range loops, true by default 99 for-loops: false # Report preallocation suggestions on for loops, false by default 100 101 gocritic: 102 # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks. 103 # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". 104 enabled-tags: 105 - performance 106 107 settings: # settings passed to gocritic 108 captLocal: # must be valid enabled check name 109 paramsOnly: true 110 rangeValCopy: 111 sizeThreshold: 32 112 113 nolintlint: 114 require-explanation: false 115 require-specific: true 116 117 linters: 118 enable: 119 - megacheck 120 - govet 121 - gocyclo 122 - gocritic 123 - goconst 124 - gci 125 - gofmt # We enable this as well as goimports for its simplify mode. 126 - prealloc 127 - revive 128 - unconvert 129 - misspell 130 - nakedret 131 - nolintlint 132 133 disable: 134 # These linters are all deprecated as of golangci-lint v1.49.0. We disable 135 # them explicitly to avoid the linter logging deprecation warnings. 136 - deadcode 137 - varcheck 138 - scopelint 139 - structcheck 140 - interfacer 141 142 presets: 143 - bugs 144 - unused 145 fast: false 146 147 issues: 148 # Excluding configuration per-path and per-linter 149 exclude-rules: 150 # Exclude some linters from running on tests files. 151 - path: _test(ing)?\.go 152 linters: 153 - gocyclo 154 - errcheck 155 - dupl 156 - gosec 157 - scopelint 158 - unparam 159 160 # Ease some gocritic warnings on test files. 161 - path: _test\.go 162 text: "(unnamedResult|exitAfterDefer)" 163 linters: 164 - gocritic 165 166 # These are performance optimisations rather than style issues per se. 167 # They warn when function arguments or range values copy a lot of memory 168 # rather than using a pointer. 169 - text: "(hugeParam|rangeValCopy):" 170 linters: 171 - gocritic 172 173 # This "TestMain should call os.Exit to set exit code" warning is not clever 174 # enough to notice that we call a helper method that calls os.Exit. 175 - text: "SA3000:" 176 linters: 177 - staticcheck 178 179 - text: "k8s.io/api/core/v1" 180 linters: 181 - goimports 182 183 # This is a "potential hardcoded credentials" warning. It's triggered by 184 # any variable with 'secret' in the same, and thus hits a lot of false 185 # positives in Kubernetes land where a Secret is an object type. 186 - text: "G101:" 187 linters: 188 - gosec 189 - gas 190 191 # This is an 'errors unhandled' warning that duplicates errcheck. 192 - text: "G104:" 193 linters: 194 - gosec 195 - gas 196 197 # Some k8s dependencies do not have JSON tags on all fields in structs. 198 - path: k8s.io/ 199 linters: 200 - musttag 201 202 # Independently from option `exclude` we use default exclude patterns, 203 # it can be disabled by this option. To list all 204 # excluded by default patterns execute `golangci-lint run --help`. 205 # Default value for this option is true. 206 exclude-use-default: false 207 208 # Show only new issues: if there are unstaged changes or untracked files, 209 # only those changes are analyzed, else only changes in HEAD~ are analyzed. 210 # It's a super-useful option for integration of golangci-lint into existing 211 # large codebase. It's not practical to fix all existing issues at the moment 212 # of integration: much better don't allow issues in new code. 213 # Default is false. 214 new: false 215 216 # Maximum issues count per one linter. Set to 0 to disable. Default is 50. 217 max-per-linter: 0 218 219 # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. 220 max-same-issues: 0