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