github.com/neilotoole/jsoncolor@v0.6.0/.golangci.yml (about) 1 # This is a derivative of the .golangci.example.yml as of 9/2021. 2 3 # This file contains all available configuration options 4 # with their default values. 5 6 # options for analysis running 7 run: 8 # exit code when at least one issue was found, default is 1 9 issues-exit-code: 1 10 11 # include test files or not, default is true 12 tests: false 13 14 15 # all available settings of specific linters 16 linters-settings: 17 18 cyclop: 19 # the maximal code complexity to report 20 max-complexity: 80 21 # the maximal average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0) 22 package-average: 0.0 23 # should ignore tests (default false) 24 skip-tests: true 25 26 dogsled: 27 # checks assignments with too many blank identifiers; default is 2 28 max-blank-identifiers: 2 29 30 dupl: 31 # tokens count to trigger issue, 150 by default 32 threshold: 100 33 34 errcheck: 35 # report about not checking of errors in type assertions: `a := b.(MyStruct)`; 36 # default is false: such cases aren't reported by default. 37 check-type-assertions: false 38 39 # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; 40 # default is false: such cases aren't reported by default. 41 check-blank: false 42 43 # [deprecated] comma-separated list of pairs of the form pkg:regex 44 # the regex is used to ignore names within pkg. (default "fmt:.*"). 45 # see https://github.com/kisielk/errcheck#the-deprecated-method for details 46 ignore: fmt:.*,io/ioutil:^Read.* 47 48 49 # list of functions to exclude from checking, where each entry is a single function to exclude. 50 # see https://github.com/kisielk/errcheck#excluding-functions for details 51 exclude-functions: 52 - io/ioutil.ReadFile 53 - io.Copy(*bytes.Buffer) 54 - io.Copy(os.Stdout) 55 56 errorlint: 57 # Check whether fmt.Errorf uses the %w verb for formatting errors. See the readme for caveats 58 errorf: true 59 # Check for plain type assertions and type switches 60 asserts: true 61 # Check for plain error comparisons 62 comparison: true 63 64 exhaustive: 65 # check switch statements in generated files also 66 check-generated: false 67 # indicates that switch statements are to be considered exhaustive if a 68 # 'default' case is present, even if all enum members aren't listed in the 69 # switch 70 default-signifies-exhaustive: false 71 72 exhaustivestruct: 73 # Struct Patterns is list of expressions to match struct packages and names 74 # The struct packages have the form example.com/package.ExampleStruct 75 # The matching patterns can use matching syntax from https://pkg.go.dev/path#Match 76 # If this list is empty, all structs are tested. 77 struct-patterns: 78 - '*.Test' 79 - 'example.com/package.ExampleStruct' 80 81 forbidigo: 82 # Forbid the following identifiers (identifiers are written using regexp): 83 forbid: 84 # - ^print.*$ 85 - 'fmt\.Print.*' 86 # Exclude godoc examples from forbidigo checks. Default is true. 87 exclude_godoc_examples: false 88 89 funlen: 90 lines: 100 91 statements: 120 92 93 gci: 94 # put imports beginning with prefix after 3rd-party packages; 95 # only support one prefix 96 # if not set, use goimports.local-prefixes 97 local-prefixes: github.com/org/project 98 99 gocognit: 100 # minimal code complexity to report, 30 by default (but we recommend 10-20) 101 min-complexity: 80 102 103 goconst: 104 # minimal length of string constant, 3 by default 105 min-len: 3 106 # minimum occurrences of constant string count to trigger issue, 3 by default 107 min-occurrences: 3 108 # ignore test files, false by default 109 ignore-tests: false 110 # look for existing constants matching the values, true by default 111 match-constant: true 112 # search also for duplicated numbers, false by default 113 numbers: false 114 # minimum value, only works with goconst.numbers, 3 by default 115 min: 3 116 # maximum value, only works with goconst.numbers, 3 by default 117 max: 3 118 # ignore when constant is not used as function argument, true by default 119 ignore-calls: true 120 121 gocritic: 122 # Which checks should be enabled; can't be combined with 'disabled-checks'; 123 # See https://go-critic.github.io/overview#checks-overview 124 # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run` 125 # By default list of stable checks is used. 126 enabled-checks: 127 # - rangeValCopy 128 129 # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty 130 disabled-checks: 131 - regexpMust 132 - assignOp 133 134 # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks. 135 # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". 136 enabled-tags: 137 - performance 138 disabled-tags: 139 - experimental 140 141 # Settings passed to gocritic. 142 # The settings key is the name of a supported gocritic checker. 143 # The list of supported checkers can be find in https://go-critic.github.io/overview. 144 settings: 145 captLocal: # must be valid enabled check name 146 # whether to restrict checker to params only (default true) 147 paramsOnly: true 148 elseif: 149 # whether to skip balanced if-else pairs (default true) 150 skipBalanced: true 151 hugeParam: 152 # size in bytes that makes the warning trigger (default 80) 153 sizeThreshold: 80 154 # nestingReduce: 155 # # min number of statements inside a branch to trigger a warning (default 5) 156 # bodyWidth: 5 157 rangeExprCopy: 158 # size in bytes that makes the warning trigger (default 512) 159 sizeThreshold: 512 160 # whether to check test functions (default true) 161 skipTestFuncs: true 162 rangeValCopy: 163 # size in bytes that makes the warning trigger (default 128) 164 sizeThreshold: 32 165 # whether to check test functions (default true) 166 skipTestFuncs: true 167 # ruleguard: 168 # # path to a gorules file for the ruleguard checker 169 # rules: '' 170 # truncateCmp: 171 # # whether to skip int/uint/uintptr types (default true) 172 # skipArchDependent: true 173 underef: 174 # whether to skip (*x).method() calls where x is a pointer receiver (default true) 175 skipRecvDeref: true 176 # unnamedResult: 177 # # whether to check exported functions 178 # checkExported: true 179 180 gocyclo: 181 # minimal code complexity to report, 30 by default (but we recommend 10-20) 182 min-complexity: 80 183 184 godot: 185 # comments to be checked: `declarations`, `toplevel`, or `all` 186 scope: declarations 187 # list of regexps for excluding particular comment lines from check 188 exclude: 189 # example: exclude comments which contain numbers 190 # - '[0-9]+' 191 # check that each sentence starts with a capital letter 192 capital: false 193 194 godox: 195 # report any comments starting with keywords, this is useful for TODO or FIXME comments that 196 # might be left in the code accidentally and should be resolved before merging 197 keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting 198 - NOTE 199 - OPTIMIZE # marks code that should be optimized before merging 200 - HACK # marks hack-arounds that should be removed before merging 201 202 gofmt: 203 # simplify code: gofmt with `-s` option, true by default 204 simplify: true 205 206 gofumpt: 207 # Select the Go version to target. The default is `1.15`. 208 lang-version: "1.16" 209 210 # Choose whether or not to use the extra rules that are disabled 211 # by default 212 extra-rules: false 213 214 goheader: 215 values: 216 const: 217 # define here const type values in format k:v, for example: 218 # COMPANY: MY COMPANY 219 regexp: 220 # define here regexp type values, for example 221 # AUTHOR: .*@mycompany\.com 222 template: # |- 223 # put here copyright header template for source code files, for example: 224 # Note: {{ YEAR }} is a builtin value that returns the year relative to the current machine time. 225 # 226 # {{ AUTHOR }} {{ COMPANY }} {{ YEAR }} 227 # SPDX-License-Identifier: Apache-2.0 228 229 # Licensed under the Apache License, Version 2.0 (the "License"); 230 # you may not use this file except in compliance with the License. 231 # You may obtain a copy of the License at: 232 233 # http://www.apache.org/licenses/LICENSE-2.0 234 235 # Unless required by applicable law or agreed to in writing, software 236 # distributed under the License is distributed on an "AS IS" BASIS, 237 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 238 # See the License for the specific language governing permissions and 239 # limitations under the License. 240 template-path: 241 # also as alternative of directive 'template' you may put the path to file with the template source 242 243 goimports: 244 # put imports beginning with prefix after 3rd-party packages; 245 # it's a comma-separated list of prefixes 246 local-prefixes: github.com/org/project 247 248 golint: 249 # minimal confidence for issues, default is 0.8 250 min-confidence: 0.8 251 252 gomnd: 253 settings: 254 mnd: 255 # the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. 256 checks: argument,case,condition,operation,return,assign 257 # ignored-numbers: 1000 258 # ignored-files: magic_.*.go 259 # ignored-functions: math.* 260 261 gomoddirectives: 262 # Allow local `replace` directives. Default is false. 263 replace-local: false 264 # List of allowed `replace` directives. Default is empty. 265 replace-allow-list: 266 - launchpad.net/gocheck 267 # Allow to not explain why the version has been retracted in the `retract` directives. Default is false. 268 retract-allow-no-explanation: false 269 # Forbid the use of the `exclude` directives. Default is false. 270 exclude-forbidden: false 271 272 gomodguard: 273 allowed: 274 modules: # List of allowed modules 275 # - gopkg.in/yaml.v2 276 domains: # List of allowed module domains 277 # - golang.org 278 blocked: 279 modules: # List of blocked modules 280 # - github.com/uudashr/go-module: # Blocked module 281 # recommendations: # Recommended modules that should be used instead (Optional) 282 # - golang.org/x/mod 283 # reason: "`mod` is the official go.mod parser library." # Reason why the recommended module should be used (Optional) 284 versions: # List of blocked module version constraints 285 # - github.com/mitchellh/go-homedir: # Blocked module with version constraint 286 # version: "< 1.1.0" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons 287 # reason: "testing if blocked version constraint works." # Reason why the version constraint exists. (Optional) 288 local_replace_directives: false # Set to true to raise lint issues for packages that are loaded from a local path via replace directive 289 290 gosec: 291 # To select a subset of rules to run. 292 # Available rules: https://github.com/securego/gosec#available-rules 293 includes: 294 - G401 295 - G306 296 - G101 297 # To specify a set of rules to explicitly exclude. 298 # Available rules: https://github.com/securego/gosec#available-rules 299 excludes: 300 - G204 301 # To specify the configuration of rules. 302 # The configuration of rules is not fully documented by gosec: 303 # https://github.com/securego/gosec#configuration 304 # https://github.com/securego/gosec/blob/569328eade2ccbad4ce2d0f21ee158ab5356a5cf/rules/rulelist.go#L60-L102 305 config: 306 G306: "0600" 307 G101: 308 pattern: "(?i)example" 309 ignore_entropy: false 310 entropy_threshold: "80.0" 311 per_char_threshold: "3.0" 312 truncate: "32" 313 314 gosimple: 315 # Select the Go version to target. The default is '1.13'. 316 go: "1.16" 317 # https://staticcheck.io/docs/options#checks 318 checks: [ "all" ] 319 320 govet: 321 # report about shadowed variables 322 check-shadowing: false 323 324 # settings per analyzer 325 settings: 326 printf: # analyzer name, run `go tool vet help` to see all analyzers 327 funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer 328 - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof 329 - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf 330 - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf 331 - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf 332 333 # enable or disable analyzers by name 334 # run `go tool vet help` to see all analyzers 335 enable: 336 - atomicalign 337 enable-all: false 338 disable: 339 - shadow 340 disable-all: false 341 342 depguard: 343 list-type: blacklist 344 include-go-root: false 345 packages: 346 - github.com/sirupsen/logrus 347 packages-with-error-message: 348 # specify an error message to output when a blacklisted package is used 349 - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log" 350 351 ifshort: 352 # Maximum length of variable declaration measured in number of lines, after which linter won't suggest using short syntax. 353 # Has higher priority than max-decl-chars. 354 max-decl-lines: 1 355 # Maximum length of variable declaration measured in number of characters, after which linter won't suggest using short syntax. 356 max-decl-chars: 30 357 358 importas: 359 # if set to `true`, force to use alias. 360 no-unaliased: true 361 # List of aliases 362 alias: 363 # using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package 364 - pkg: knative.dev/serving/pkg/apis/serving/v1 365 alias: servingv1 366 # using `autoscalingv1alpha1` alias for `knative.dev/serving/pkg/apis/autoscaling/v1alpha1` package 367 - pkg: knative.dev/serving/pkg/apis/autoscaling/v1alpha1 368 alias: autoscalingv1alpha1 369 # You can specify the package path by regular expression, 370 # and alias by regular expression expansion syntax like below. 371 # see https://github.com/julz/importas#use-regular-expression for details 372 - pkg: knative.dev/serving/pkg/apis/(\w+)/(v[\w\d]+) 373 alias: $1$2 374 375 ireturn: 376 # ireturn allows using `allow` and `reject` settings at the same time. 377 # Both settings are lists of the keywords and regular expressions matched to interface or package names. 378 # keywords: 379 # - `empty` for `interface{}` 380 # - `error` for errors 381 # - `stdlib` for standard library 382 # - `anon` for anonymous interfaces 383 384 # By default, it allows using errors, empty interfaces, anonymous interfaces, 385 # and interfaces provided by the standard library. 386 allow: 387 - anon 388 - error 389 - empty 390 - stdlib 391 # You can specify idiomatic endings for interface 392 - (or|er)$ 393 394 # Reject patterns 395 reject: 396 - github.com\/user\/package\/v4\.Type 397 398 lll: 399 # max line length, lines longer will be reported. Default is 120. 400 # '\t' is counted as 1 character by default, and can be changed with the tab-width option 401 line-length: 120 402 # tab width in spaces. Default to 1. 403 tab-width: 1 404 405 makezero: 406 # Allow only slices initialized with a length of zero. Default is false. 407 always: false 408 409 maligned: 410 # print struct with more effective memory layout or not, false by default 411 suggest-new: true 412 413 misspell: 414 # Correct spellings using locale preferences for US or UK. 415 # Default is to use a neutral variety of English. 416 # Setting locale to US will correct the British spelling of 'colour' to 'color'. 417 locale: US 418 ignore-words: 419 - someword 420 421 nakedret: 422 # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 423 max-func-lines: 30 424 425 nestif: 426 # minimal complexity of if statements to report, 5 by default 427 min-complexity: 4 428 429 nilnil: 430 # By default, nilnil checks all returned types below. 431 checked-types: 432 - ptr 433 - func 434 - iface 435 - map 436 - chan 437 438 nlreturn: 439 # size of the block (including return statement that is still "OK") 440 # so no return split required. 441 block-size: 1 442 443 nolintlint: 444 # Enable to ensure that nolint directives are all used. Default is true. 445 allow-unused: false 446 # Disable to ensure that nolint directives don't have a leading space. Default is true. 447 allow-leading-space: true 448 # Exclude following linters from requiring an explanation. Default is []. 449 allow-no-explanation: [ ] 450 # Enable to require an explanation of nonzero length after each nolint directive. Default is false. 451 require-explanation: true 452 # Enable to require nolint directives to mention the specific linter being suppressed. Default is false. 453 require-specific: true 454 455 prealloc: 456 # XXX: we don't recommend using this linter before doing performance profiling. 457 # For most programs usage of prealloc will be a premature optimization. 458 459 # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. 460 # True by default. 461 simple: true 462 range-loops: true # Report preallocation suggestions on range loops, true by default 463 for-loops: false # Report preallocation suggestions on for loops, false by default 464 465 promlinter: 466 # Promlinter cannot infer all metrics name in static analysis. 467 # Enable strict mode will also include the errors caused by failing to parse the args. 468 strict: false 469 # Please refer to https://github.com/yeya24/promlinter#usage for detailed usage. 470 disabled-linters: 471 # - "Help" 472 # - "MetricUnits" 473 # - "Counter" 474 # - "HistogramSummaryReserved" 475 # - "MetricTypeInName" 476 # - "ReservedChars" 477 # - "CamelCase" 478 # - "lintUnitAbbreviations" 479 480 predeclared: 481 # comma-separated list of predeclared identifiers to not report on 482 ignore: "" 483 # include method names and field names (i.e., qualified names) in checks 484 q: false 485 486 rowserrcheck: 487 packages: 488 - github.com/jmoiron/sqlx 489 490 revive: 491 # see https://github.com/mgechev/revive#available-rules for details. 492 ignore-generated-header: true 493 severity: warning 494 rules: 495 - name: indent-error-flow 496 severity: warning 497 - name: add-constant 498 severity: warning 499 arguments: 500 - maxLitCount: "3" 501 allowStrs: '""' 502 allowInts: "0,1,2" 503 allowFloats: "0.0,0.,1.0,1.,2.0,2." 504 505 staticcheck: 506 # Select the Go version to target. The default is '1.13'. 507 go: "1.16" 508 # https://staticcheck.io/docs/options#checks 509 checks: [ "all", "-SA1019", "-SA4003","-SA4016" ] 510 511 stylecheck: 512 # Select the Go version to target. The default is '1.13'. 513 go: "1.16" 514 # https://staticcheck.io/docs/options#checks 515 checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ] 516 # https://staticcheck.io/docs/options#dot_import_whitelist 517 dot-import-whitelist: 518 - fmt 519 # https://staticcheck.io/docs/options#initialisms 520 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" ] 521 # https://staticcheck.io/docs/options#http_status_code_whitelist 522 http-status-code-whitelist: [ "200", "400", "404", "500" ] 523 524 tagliatelle: 525 # check the struck tag name case 526 case: 527 # use the struct field name to check the name of the struct tag 528 use-field-name: true 529 rules: 530 # any struct tag type can be used. 531 # support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower` 532 json: camel 533 yaml: camel 534 xml: camel 535 bson: camel 536 avro: snake 537 mapstructure: kebab 538 539 testpackage: 540 # regexp pattern to skip files 541 skip-regexp: (export|internal)_test\.go 542 543 thelper: 544 # The following configurations enable all checks. It can be omitted because all checks are enabled by default. 545 # You can enable only required checks deleting unnecessary checks. 546 test: 547 first: true 548 name: true 549 begin: true 550 benchmark: 551 first: true 552 name: true 553 begin: true 554 tb: 555 first: true 556 name: true 557 begin: true 558 559 unparam: 560 # Inspect exported functions, default is false. Set to true if no external program/library imports your code. 561 # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: 562 # if it's called for subdir of a project it can't find external interfaces. All text editor integrations 563 # with golangci-lint call it on a directory with the changed file. 564 check-exported: false 565 566 unused: 567 # Select the Go version to target. The default is '1.13'. 568 go: "1.16" 569 570 whitespace: 571 multi-if: false # Enforces newlines (or comments) after every multi-line if statement 572 multi-func: false # Enforces newlines (or comments) after every multi-line function signature 573 574 wrapcheck: 575 # An array of strings that specify substrings of signatures to ignore. 576 # If this set, it will override the default set of ignored signatures. 577 # See https://github.com/tomarrell/wrapcheck#configuration for more information. 578 ignoreSigs: 579 - .Errorf( 580 - errors.New( 581 - errors.Unwrap( 582 - .Wrap( 583 - .Wrapf( 584 - .WithMessage( 585 - .WithMessagef( 586 - .WithStack( 587 ignorePackageGlobs: 588 - encoding/* 589 - github.com/pkg/* 590 591 wsl: 592 # See https://github.com/bombsimon/wsl/blob/master/doc/configuration.md for 593 # documentation of available settings. These are the defaults for 594 # `golangci-lint`. 595 allow-assign-and-anything: false 596 allow-assign-and-call: true 597 allow-cuddle-declarations: false 598 allow-multiline-assign: true 599 allow-separated-leading-comment: false 600 allow-trailing-comment: false 601 force-case-trailing-whitespace: 0 602 force-err-cuddling: false 603 force-short-decl-cuddling: false 604 strict-append: true 605 606 607 608 linters: 609 # disable-all: true 610 # enable: 611 # - megacheck 612 # - govet 613 enable-all: true 614 disable: 615 - deadcode 616 - dupl 617 - errorlint 618 - exhaustive 619 - forcetypeassert 620 - funlen 621 - gci 622 - gochecknoglobals 623 - gochecknoinits 624 - gocritic 625 - godox 626 - goerr113 627 - gofmt 628 - gofumpt 629 - gomnd 630 - ifshort 631 - interfacer 632 - lll 633 - maligned 634 - nakedret 635 - nestif 636 - nilerr 637 - nlreturn 638 - predeclared 639 - revive 640 - scopelint 641 - structcheck 642 - unconvert 643 - unparam 644 - unused 645 - whitespace 646 - wrapcheck 647 - wsl 648 649 # to be re-enabled 650 - golint 651 # presets: 652 # - bugs 653 # - unused 654 # fast: false 655