github.com/openimsdk/tools@v0.0.49/.golangci.yml (about) 1 # Copyright © 2023 OpenIMSDK open source community. All rights reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 # This file contains all available configuration options 16 # with their default values. 17 18 # options for analysis running 19 run: 20 # default concurrency is a available CPU number 21 concurrency: 4 22 23 # timeout for analysis, e.g. 30s, 5m, default is 1m 24 timeout: 5m 25 26 # exit code when at least one issue was found, default is 1 27 issues-exit-code: 1 28 29 # include test files or not, default is true 30 tests: true 31 32 # list of build tags, all linters use it. Default is empty list. 33 build-tags: 34 - mytag 35 36 # default is true. Enables skipping of directories: 37 # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ 38 skip-dirs-use-default: true 39 40 # which files to skip: they will be analyzed, but issues from them 41 # won't be reported. Default value is empty list, but there is 42 # no need to include all autogenerated files, we confidently recognize 43 # autogenerated files. If it's not please let us know. 44 # "/" will be replaced by current OS file path separator to properly work 45 # on Windows. 46 47 # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules": 48 # If invoked with -mod=readonly, the go command is disallowed from the implicit 49 # automatic updating of go.mod described above. Instead, it fails when any changes 50 # to go.mod are needed. This setting is most useful to check that go.mod does 51 # not need updates, such as in a continuous integration and testing system. 52 # If invoked with -mod=vendor, the go command assumes that the vendor 53 # directory holds the correct copies of dependencies and ignores 54 # the dependency descriptions in go.mod. 55 #modules-download-mode: release|readonly|vendor 56 57 # Allow multiple parallel golangci-lint instances running. 58 # If false (default) - golangci-lint acquires file lock on start. 59 allow-parallel-runners: true 60 61 62 # output configuration options 63 output: 64 # print lines of code with issue, default is true 65 print-issued-lines: true 66 67 # print linter name in the end of issue text, default is true 68 print-linter-name: true 69 70 # make issues output unique by line, default is true 71 uniq-by-line: true 72 73 # add a prefix to the output file references; default is no prefix 74 path-prefix: "" 75 76 # sorts results by: filepath, line and column 77 sort-results: true 78 79 # all available settings of specific linters 80 linters-settings: 81 bidichk: 82 # The following configurations check for all mentioned invisible unicode 83 # runes. It can be omitted because all runes are enabled by default. 84 left-to-right-embedding: true 85 right-to-left-embedding: true 86 pop-directional-formatting: true 87 left-to-right-override: true 88 right-to-left-override: true 89 left-to-right-isolate: true 90 right-to-left-isolate: true 91 first-strong-isolate: true 92 pop-directional-isolate: true 93 94 dupl: 95 # tokens count to trigger issue, 150 by default 96 threshold: 200 97 errcheck: 98 # report about not checking of errors in type assertions: `a := b.(MyStruct)`; 99 # default is false: such cases aren't reported by default. 100 check-type-assertions: false 101 102 # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; 103 # default is false: such cases aren't reported by default. 104 check-blank: false 105 106 # [deprecated] comma-separated list of pairs of the form pkg:regex 107 # the regex is used to ignore names within pkg. (default "fmt:.*"). 108 # see https://github.com/kisielk/errcheck#the-deprecated-method for details 109 #ignore: GenMarkdownTree,os:.*,BindPFlags,WriteTo,Help 110 #ignore: (os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv 111 112 # path to a file containing a list of functions to exclude from checking 113 # see https://github.com/kisielk/errcheck#excluding-functions for details 114 # exclude: errcheck.txt 115 116 errorlint: 117 # Check whether fmt.Errorf uses the %w verb for formatting errors. See the readme for caveats 118 errorf: true 119 # Check for plain type assertions and type switches 120 asserts: true 121 # Check for plain error comparisons 122 comparison: true 123 124 exhaustive: 125 # check switch statements in generated files also 126 check-generated: false 127 # indicates that switch statements are to be considered exhaustive if a 128 # 'default' case is present, even if all enum members aren't listed in the 129 # switch 130 default-signifies-exhaustive: false 131 # enum members matching the supplied regex do not have to be listed in 132 # switch statements to satisfy exhaustiveness 133 ignore-enum-members: "" 134 # consider enums only in package scopes, not in inner scopes 135 package-scope-only: false 136 137 forbidigo: 138 # # Forbid the following identifiers (identifiers are written using regexp): 139 forbid: 140 # - ^print.*$ 141 - 'fmt\.Print.*' 142 - fmt.Println.* # too much log noise 143 - ^unsafe\..*$ 144 - ^init$ 145 - ^fmt.Print.*$ 146 - ^fmt.Println.*$ 147 - ^panic$ 148 - painc 149 - errors.* 150 - ^errors$ 151 # - ginkgo\\.F.* # these are used just for local development 152 # # Exclude godoc examples from forbidigo checks. Default is true. 153 # exclude_godoc_examples: false 154 funlen: 155 lines: 220 156 statements: 80 157 158 gocognit: 159 # minimal code complexity to report, 30 by default (but we recommend 10-20) 160 min-complexity: 30 161 162 goconst: 163 # minimal length of string constant, 3 by default 164 min-len: 3 165 # minimal occurrences count to trigger, 3 by default 166 min-occurrences: 3 167 # ignore test files, false by default 168 ignore-tests: false 169 # look for existing constants matching the values, true by default 170 match-constant: true 171 # search also for duplicated numbers, false by default 172 numbers: false 173 # minimum value, only works with goconst.numbers, 3 by default 174 min: 3 175 # maximum value, only works with goconst.numbers, 3 by default 176 max: 3 177 # ignore when constant is not used as function argument, true by default 178 ignore-calls: true 179 180 gocritic: 181 # Which checks should be enabled; can't be combined with 'disabled-checks'; 182 # See https://go-critic.github.io/overview#checks-overview 183 # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run` 184 # By default list of stable checks is used. 185 186 # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty 187 disabled-checks: 188 - regexpMust 189 - ifElseChain 190 #- exitAfterDefer 191 192 # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks. 193 # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". 194 enabled-tags: 195 - performance 196 disabled-tags: 197 - experimental 198 199 # Settings passed to gocritic. 200 # The settings key is the name of a supported gocritic checker. 201 # The list of supported checkers can be find in https://go-critic.github.io/overview. 202 settings: 203 captLocal: # must be valid enabled check name 204 # whether to restrict checker to params only (default true) 205 paramsOnly: true 206 elseif: 207 # whether to skip balanced if-else pairs (default true) 208 skipBalanced: true 209 hugeParam: 210 # size in bytes that makes the warning trigger (default 80) 211 sizeThreshold: 80 212 rangeExprCopy: 213 # size in bytes that makes the warning trigger (default 512) 214 sizeThreshold: 512 215 # whether to check test functions (default true) 216 skipTestFuncs: true 217 rangeValCopy: 218 # size in bytes that makes the warning trigger (default 128) 219 sizeThreshold: 32 220 # whether to check test functions (default true) 221 skipTestFuncs: true 222 underef: 223 # whether to skip (*x).method() calls where x is a pointer receiver (default true) 224 skipRecvDeref: true 225 226 gocyclo: 227 # minimal code complexity to report, 30 by default (but we recommend 10-20) 228 min-complexity: 30 229 cyclop: 230 # the maximal code complexity to report 231 max-complexity: 50 232 # the maximal average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0) 233 package-average: 0.0 234 # should ignore tests (default false) 235 skip-tests: false 236 godot: 237 # comments to be checked: `declarations`, `toplevel`, or `all` 238 scope: declarations 239 # list of regexps for excluding particular comment lines from check 240 exclude: 241 # example: exclude comments which contain numbers 242 - '[0-9]+' 243 - 'func\s+\w+' 244 - 'FIXME:' 245 - '.*func.*' 246 # check that each sentence starts with a capital letter 247 capital: true 248 godox: 249 # report any comments starting with keywords, this is useful for TODO or FIXME comments that 250 # might be left in the code accidentally and should be resolved before merging 251 keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting 252 #- TODO 253 - BUG 254 - FIXME 255 #- NOTE 256 - OPTIMIZE # marks code that should be optimized before merging 257 - HACK # marks hack-arounds that should be removed before merging 258 gofmt: 259 # simplify code: gofmt with `-s` option, true by default 260 simplify: true 261 262 gofumpt: 263 # Select the Go version to target. The default is `1.18`. 264 lang-version: "1.20" 265 266 # Choose whether or not to use the extra rules that are disabled 267 # by default 268 extra-rules: false 269 270 # goheader: 271 # values: 272 # const: 273 # define here const type values in format k:v, for example: 274 # COMPANY: MY COMPANY 275 # regexp: 276 # define here regexp type values, for example 277 # AUTHOR: .*@mycompany\.com 278 # template: # |- 279 # put here copyright header template for source code files, for example: 280 # Note: {{ YEAR }} is a builtin value that returns the year relative to the current machine time. 281 # 282 # {{ AUTHOR }} {{ COMPANY }} {{ YEAR }} 283 # SPDX-License-Identifier: Apache-2.0 284 285 # Licensed under the Apache License, Version 2.0 (the "License"); 286 # you may not use this file except in compliance with the License. 287 # You may obtain a copy of the License at: 288 289 # http://www.apache.org/licenses/LICENSE-2.0 290 291 # Unless required by applicable law or agreed to in writing, software 292 # distributed under the License is distributed on an "AS IS" BASIS, 293 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 294 # See the License for the specific language governing permissions and 295 # limitations under the License. 296 # template-path: 297 # also as alternative of directive 'template' you may put the path to file with the template source 298 299 goimports: 300 # put imports beginning with prefix after 3rd-party packages; 301 # it's a comma-separated list of prefixes 302 local-prefixes: github.com/openimsdk/open-im-server 303 304 gomnd: 305 settings: 306 mnd: 307 # the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. 308 # checks: 309 # ignored-numbers: 1000 310 ignored-files: magic_.*.go, test_.*.go, .*_test.go 311 ignored-functions: math.* 312 313 gomoddirectives: 314 # Allow local `replace` directives. Default is false. 315 replace-local: true 316 # List of allowed `replace` directives. Default is empty. 317 replace-allow-list: 318 - google.golang.org/grpc 319 320 # Allow to not explain why the version has been retracted in the `retract` directives. Default is false. 321 retract-allow-no-explanation: false 322 # Forbid the use of the `exclude` directives. Default is false. 323 exclude-forbidden: false 324 325 gomodguard: 326 allowed: 327 modules: 328 - gorm.io/gen # List of allowed modules 329 - gorm.io/gorm 330 - gorm.io/driver/mysql 331 - k8s.io/klog 332 - github.com/allowed/module 333 - go.mongodb.org/mongo-driver/mongo 334 # - gopkg.in/yaml.v2 335 domains: # List of allowed module domains 336 - google.golang.org 337 - gopkg.in 338 - golang.org 339 - github.com 340 - go.mongodb.org 341 - go.uber.org 342 - openim.io 343 - go.etcd.io 344 blocked: 345 versions: 346 - github.com/MakeNowJust/heredoc: 347 version: "> 2.0.9" 348 reason: "use the latest version" 349 local_replace_directives: false # Set to true to raise lint issues for packages that are loaded from a local path via replace directive 350 351 gosec: 352 # To select a subset of rules to run. 353 # Available rules: https://github.com/securego/gosec#available-rules 354 includes: 355 - G401 356 - G306 357 - G101 358 # To specify a set of rules to explicitly exclude. 359 # Available rules: https://github.com/securego/gosec#available-rules 360 excludes: 361 - G204 362 # Exclude generated files 363 exclude-generated: true 364 # Filter out the issues with a lower severity than the given value. Valid options are: low, medium, high. 365 severity: "low" 366 # Filter out the issues with a lower confidence than the given value. Valid options are: low, medium, high. 367 confidence: "low" 368 # To specify the configuration of rules. 369 # The configuration of rules is not fully documented by gosec: 370 # https://github.com/securego/gosec#configuration 371 # https://github.com/securego/gosec/blob/569328eade2ccbad4ce2d0f21ee158ab5356a5cf/rules/rulelist.go#L60-L102 372 config: 373 G306: "0600" 374 G101: 375 pattern: "(?i)example" 376 ignore_entropy: false 377 entropy_threshold: "80.0" 378 per_char_threshold: "3.0" 379 truncate: "32" 380 381 gosimple: 382 # Select the Go version to target. The default is '1.13'. 383 go: "1.20" 384 # https://staticcheck.io/docs/options#checks 385 checks: [ "all" ] 386 387 govet: 388 # report about shadowed variables 389 check-shadowing: false 390 391 # settings per analyzer 392 settings: 393 printf: # analyzer name, run `go tool vet help` to see all analyzers 394 funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer 395 - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof 396 - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf 397 - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf 398 - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf 399 400 # enable or disable analyzers by name 401 enable: 402 - atomicalign 403 enable-all: false 404 disable: 405 - shadow 406 disable-all: false 407 # depguard: 408 # list-type: blacklist 409 # include-go-root: false 410 # packages: 411 # - github.com/Sirupsen/logrus 412 # packages-with-error-message: 413 # # specify an error message to output when a blacklisted package is used 414 # - github.com/Sirupsen/logrus: "logging is allowed only by logutils.Log" 415 416 importas: 417 # if set to `true`, force to use alias. 418 no-unaliased: true 419 # List of aliases 420 alias: 421 # using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package 422 - pkg: knative.dev/serving/pkg/apis/serving/v1 423 alias: servingv1 424 - pkg: gopkg.in/yaml.v2 425 alias: yaml 426 # using `autoscalingv1alpha1` alias for `knative.dev/serving/pkg/apis/autoscaling/v1alpha1` package 427 - pkg: knative.dev/serving/pkg/apis/autoscaling/v1alpha1 428 alias: autoscalingv1alpha1 429 # You can specify the package path by regular expression, 430 # and alias by regular expression expansion syntax like below. 431 # see https://github.com/julz/importas#use-regular-expression for details 432 - pkg: knative.dev/serving/pkg/apis/(\w+)/(v[\w\d]+) 433 alias: $1$2 434 435 ireturn: 436 # ireturn allows using `allow` and `reject` settings at the same time. 437 # Both settings are lists of the keywords and regular expressions matched to interface or package names. 438 # keywords: 439 # - `empty` for `any` 440 # - `error` for errors 441 # - `stdlib` for standard library 442 # - `anon` for anonymous interfaces 443 444 # By default, it allows using errors, empty interfaces, anonymous interfaces, 445 # and interfaces provided by the standard library. 446 allow: 447 - anon 448 - error 449 - empty 450 - stdlib 451 # You can specify idiomatic endings for interface 452 - (or|er)$ 453 454 # Reject patterns 455 reject: 456 - github.com\/user\/package\/v4\.Type 457 458 lll: 459 # max line length, lines longer will be reported. Default is 250. 460 # '\t' is counted as 1 character by default, and can be changed with the tab-width option 461 line-length: 250 462 # tab width in spaces. Default to 1. 463 tab-width: 4 464 maligned: 465 # print struct with more effective memory layout or not, false by default 466 suggest-new: true 467 misspell: 468 # Correct spellings using locale preferences for US or UK. 469 # Default is to use a neutral variety of English. 470 # Setting locale to US will correct the British spelling of 'colour' to 'color'. 471 locale: US 472 ignore-words: 473 - someword 474 nakedret: 475 # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 476 max-func-lines: 30 477 478 nestif: 479 # minimal complexity of if statements to report, 5 by default 480 min-complexity: 4 481 482 nilnil: 483 # By default, nilnil checks all returned types below. 484 checked-types: 485 - ptr 486 - func 487 - iface 488 - map 489 - chan 490 491 nlreturn: 492 # size of the block (including return statement that is still "OK") 493 # so no return split required. 494 block-size: 1 495 496 nolintlint: 497 # Disable to ensure that all nolint directives actually have an effect. Default is true. 498 allow-unused: false 499 # Exclude following linters from requiring an explanation. Default is []. 500 allow-no-explanation: [ ] 501 # Enable to require an explanation of nonzero length after each nolint directive. Default is false. 502 require-explanation: false 503 # Enable to require nolint directives to mention the specific linter being suppressed. Default is false. 504 require-specific: true 505 506 prealloc: 507 # XXX: we don't recommend using this linter before doing performance profiling. 508 # For most programs usage of prealloc will be a premature optimization. 509 510 # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. 511 # True by default. 512 simple: true 513 range-loops: true # Report preallocation suggestions on range loops, true by default 514 for-loops: false # Report preallocation suggestions on for loops, false by default 515 516 promlinter: 517 # Promlinter cannot infer all metrics name in static analysis. 518 # Enable strict mode will also include the errors caused by failing to parse the args. 519 strict: false 520 # Please refer to https://github.com/yeya24/promlinter#usage for detailed usage. 521 disabled-linters: 522 - "Help" 523 - "MetricUnits" 524 - "Counter" 525 - "HistogramSummaryReserved" 526 - "MetricTypeInName" 527 - "ReservedChars" 528 - "CamelCase" 529 530 predeclared: 531 # comma-separated list of predeclared identifiers to not report on 532 ignore: "" 533 # include method names and field names (i.e., qualified names) in checks 534 q: false 535 rowserrcheck: 536 packages: 537 - github.com/jmoiron/sqlx 538 539 revive: 540 # see https://github.com/mgechev/revive#available-rules for details. 541 ignore-generated-header: true 542 severity: warning 543 rules: 544 - name: indent-error-flow 545 severity: warning 546 547 staticcheck: 548 # Select the Go version to target. The default is '1.13'. 549 go: "1.20" 550 # https://staticcheck.io/docs/options#checks 551 checks: [ "all" ] 552 553 stylecheck: 554 # Select the Go version to target. The default is '1.13'. 555 go: "1.20" 556 557 # https://staticcheck.io/docs/options#checks 558 checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ] 559 # https://staticcheck.io/docs/options#dot_import_whitelist 560 dot-import-whitelist: 561 - fmt 562 # https://staticcheck.io/docs/options#initialisms 563 initialisms: [ "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS" ] 564 # https://staticcheck.io/docs/options#http_status_code_whitelist 565 http-status-code-whitelist: [ "200", "400", "404", "500" ] 566 567 568 tagliatelle: 569 # check the struck tag name case 570 case: 571 # use the struct field name to check the name of the struct tag 572 use-field-name: true 573 rules: 574 # any struct tag type can be used. 575 # support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower` 576 json: camel 577 yaml: camel 578 xml: camel 579 bson: camel 580 avro: snake 581 mapstructure: kebab 582 583 testpackage: 584 # regexp pattern to skip files 585 skip-regexp: (id|export|internal)_test\.go 586 thelper: 587 # The following configurations enable all checks. It can be omitted because all checks are enabled by default. 588 # You can enable only required checks deleting unnecessary checks. 589 test: 590 first: true 591 name: true 592 begin: true 593 benchmark: 594 first: true 595 name: true 596 begin: true 597 tb: 598 first: true 599 name: true 600 begin: true 601 602 tenv: 603 # The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures. 604 # By default, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked. 605 all: false 606 607 unparam: 608 # Inspect exported functions, default is false. Set to true if no external program/library imports your code. 609 # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: 610 # if it's called for subdir of a project it can't find external interfaces. All text editor integrations 611 # with golangci-lint call it on a directory with the changed file. 612 check-exported: false 613 # unused: 614 # treat code as a program (not a library) and report unused exported identifiers; default is false. 615 # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: 616 # if it's called for subdir of a project it can't find funcs usages. All text editor integrations 617 # with golangci-lint call it on a directory with the changed file. 618 whitespace: 619 multi-if: false # Enforces newlines (or comments) after every multi-line if statement 620 multi-func: false # Enforces newlines (or comments) after every multi-line function signature 621 622 wrapcheck: 623 # An array of strings that specify substrings of signatures to ignore. 624 # If this set, it will override the default set of ignored signatures. 625 # See https://github.com/tomarrell/wrapcheck#configuration for more information. 626 ignoreSigs: 627 - .Errorf( 628 - errors.New( 629 - errors.Unwrap( 630 - .Wrap( 631 - .WrapMsg( 632 - .Wrapf( 633 - .WithMessage( 634 - .WithMessagef( 635 - .WithStack( 636 ignorePackageGlobs: 637 - encoding/* 638 - github.com/pkg/* 639 - github.com/openimsdk/* 640 - github.com/OpenIMSDK/* 641 642 wsl: 643 # If true append is only allowed to be cuddled if appending value is 644 # matching variables, fields or types on line above. Default is true. 645 strict-append: true 646 # Allow calls and assignments to be cuddled as long as the lines have any 647 # matching variables, fields or types. Default is true. 648 allow-assign-and-call: true 649 # Allow assignments to be cuddled with anything. Default is false. 650 allow-assign-and-anything: false 651 # Allow multiline assignments to be cuddled. Default is true. 652 allow-multiline-assign: true 653 # Allow declarations (var) to be cuddled. 654 allow-cuddle-declarations: false 655 # Allow trailing comments in ending of blocks 656 allow-trailing-comment: false 657 # Force newlines in end of case at this limit (0 = never). 658 force-case-trailing-whitespace: 0 659 # Force cuddling of err checks with err var assignment 660 force-err-cuddling: false 661 # Allow leading comments to be separated with empty liens 662 allow-separated-leading-comment: false 663 makezero: 664 # Allow only slices initialized with a length of zero. Default is false. 665 always: false 666 667 # The custom section can be used to define linter plugins to be loaded at runtime. See README doc 668 # for more info. 669 #custom: 670 # Each custom linter should have a unique name. 671 #example: 672 # The path to the plugin *.so. Can be absolute or local. Required for each custom linter 673 #path: /path/to/example.so 674 # The description of the linter. Optional, just for documentation purposes. 675 #description: This is an example usage of a plugin linter. 676 # Intended to point to the repo location of the linter. Optional, just for documentation purposes. 677 #original-url: github.com/golangci/example-linter 678 679 linters: 680 # please, do not use `enable-all`: it's deprecated and will be removed soon. 681 # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint 682 # enable-all: true 683 disable-all: true 684 enable: 685 - typecheck # Basic type checking 686 - gofmt # Format check 687 - govet # Go's standard linting tool 688 - gosimple # Suggestions for simplifying code 689 - decorder 690 - ineffassign 691 - reassign 692 - tparallel 693 - unconvert 694 - dupl 695 - dupword 696 - gci 697 - goprintffuncname 698 - gomnd 699 - goconst 700 - gosec 701 - misspell # Spelling mistakes 702 # - staticcheck # Static analysis 703 # - goimports # Checks if imports are correctly sorted and formatted 704 - godot # Checks for comment punctuation 705 - bodyclose # Ensures HTTP response body is closed 706 - stylecheck # Style checker for Go code 707 fast: true 708 709 issues: 710 # List of regexps of issue texts to exclude, empty list by default. 711 # But independently from this option we use default exclude patterns, 712 # it can be disabled by `exclude-use-default: false`. To list all 713 # excluded by default patterns execute `golangci-lint run --help` 714 exclude: 715 - tools/.* 716 - test/.* 717 - components/* 718 - third_party/.* 719 720 # which dirs to skip: issues from them won't be reported; 721 # can use regexp here: generated.*, regexp is applied on full path; 722 # default value is empty list, but default dirs are skipped independently 723 # from this option's value (see skip-dirs-use-default). 724 # "/" will be replaced by current OS file path separator to properly work 725 # on Windows. 726 exclude-dirs: 727 - ".*\\.my\\.go$" 728 - _test.go 729 - ".*_test.go" 730 - "mocks/" 731 - ".github/" 732 - "logs/" 733 - "_output/" 734 - "components/" 735 - components 736 - docs 737 - util 738 - .*~ 739 - api/swagger/docs 740 - server/docs 741 - components/mnt/config/certs 742 - logs 743 744 # Excluding configuration per-path, per-linter, per-text and per-source 745 exclude-rules: 746 - linters: 747 - revive 748 path: (log/.*)\.go 749 750 - linters: 751 - wrapcheck 752 path: (cmd/.*|pkg/.*)\.go 753 754 - linters: 755 - typecheck 756 #path: (pkg/storage/.*)\.go 757 path: (internal/.*|pkg/.*)\.go 758 759 - path: (cmd/.*|test/.*|tools/.*|internal/pump/pumps/.*)\.go 760 linters: 761 - forbidigo 762 763 - path: (cmd/[a-z]*/.*|store/.*)\.go 764 linters: 765 - dupl 766 767 - linters: 768 - gocritic 769 text: (hugeParam:|rangeValCopy:) 770 771 - path: (cmd/[a-z]*/.*)\.go 772 linters: 773 - lll 774 775 - path: (validator/.*|code/.*|validator/.*|watcher/watcher/.*) 776 linters: 777 - gochecknoinits 778 779 - path: (internal/.*/options|internal/pump|pkg/log/options.go|internal/authzserver|tools/) 780 linters: 781 - tagliatelle 782 783 - path: (pkg/app/.*)\.go 784 linters: 785 - unused 786 - forbidigo 787 788 # Exclude some staticcheck messages 789 - linters: 790 - staticcheck 791 text: "SA9003:" 792 793 # Exclude lll issues for long lines with go:generate 794 - linters: 795 - lll 796 source: "^//go:generate " 797 798 - text: ".*[\u4e00-\u9fa5]+.*" 799 linters: 800 - golint 801 source: "^//.*$" 802 803 # Independently from option `exclude` we use default exclude patterns, 804 # it can be disabled by this option. To list all 805 # excluded by default patterns execute `golangci-lint run --help`. 806 # Default value for this option is true. 807 exclude-use-default: true 808 809 # The default value is false. If set to true exclude and exclude-rules 810 # regular expressions become case sensitive. 811 exclude-case-sensitive: false 812 813 # The list of ids of default excludes to include or disable. By default it's empty. 814 include: 815 - EXC0002 # disable excluding of issues about comments from golint 816 817 # Maximum issues count per one linter. Set to 0 to disable. Default is 50. 818 max-issues-per-linter: 0 819 820 # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. 821 max-same-issues: 0 822 823 # Show only new issues: if there are unstaged changes or untracked files, 824 # only those changes are analyzed, else only changes in HEAD~ are analyzed. 825 # It's a super-useful option for integration of golangci-lint into existing 826 # large codebase. It's not practical to fix all existing issues at the moment 827 # of integration: much better don't allow issues in new code. 828 # Default is false. 829 new: false 830 831 # Show only new issues created after git revision `REV` 832 # new-from-rev: REV 833 834 # Show only new issues created in git patch with set file path. 835 #new-from-patch: path/to/patch/file 836 837 # Fix found issues (if it's supported by the linter) 838 fix: true 839 840 severity: 841 # Default value is empty string. 842 # Set the default severity for issues. If severity rules are defined and the issues 843 # do not match or no severity is provided to the rule this will be the default 844 # severity applied. Severities should match the supported severity names of the 845 # selected out format. 846 # - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity 847 # - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity 848 # - Github: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message 849 default-severity: error 850 851 # The default value is false. 852 # If set to true severity-rules regular expressions become case sensitive. 853 case-sensitive: false 854 855 # Default value is empty list. 856 # When a list of severity rules are provided, severity information will be added to lint 857 # issues. Severity rules have the same filtering capability as exclude rules except you 858 # are allowed to specify one matcher per severity rule. 859 # Only affects out formats that support setting severity information. 860 rules: 861 - linters: 862 - dupl 863 severity: info