diff --git a/.golangci.reference.yml b/.golangci.reference.yml index 8418f3d70e81..44d371c498c9 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -4,7 +4,6 @@ # This file is not a configuration example, # it contains the exhaustive configuration with explanations of the options. - linters: # Disable all linters. # Default: false @@ -64,6 +63,7 @@ linters: - gosmopolitan - govet - grouper + - iface - importas - inamedparam - ineffassign @@ -94,6 +94,7 @@ linters: - promlinter - protogetter - reassign + - recvcheck - revive - rowserrcheck - sloglint @@ -178,6 +179,7 @@ linters: - gosmopolitan - govet - grouper + - iface - importas - inamedparam - ineffassign @@ -208,6 +210,7 @@ linters: - promlinter - protogetter - reassign + - recvcheck - revive - rowserrcheck - sloglint @@ -287,7 +290,7 @@ linters-settings: ignore-test: true bidichk: - # The following configurations check for all mentioned invisible unicode runes. + # The following configurations check for all mentioned invisible Unicode runes. # All runes are enabled by default. left-to-right-embedding: false right-to-left-embedding: false @@ -649,6 +652,15 @@ linters-settings: # Default: false forbid-spec-pollution: true + # Force using the Succeed matcher for error functions, and the HaveOccurred matcher for non-function error values. + # Default: false + force-succeed: true + + gochecksumtype: + # Presence of `default` case in switch statements satisfies exhaustiveness, if all members are not listed. + # Default: true + default-signifies-exhaustive: false + gocognit: # Minimal code complexity to report. # Default: 30 (but we recommend 10-20) @@ -695,10 +707,324 @@ linters-settings: # sloppyTypeAssert, switchTrue, typeSwitchVar, underef, unlambda, unslice, valSwap, wrapperFunc # To see which checks are enabled run `GL_DEBUG=gocritic golangci-lint run --enable=gocritic`. enabled-checks: + # Detects suspicious append result assignments. + # https://go-critic.com/overview.html#appendAssign + - appendAssign + # Detects `append` chains to the same slice that can be done in a single `append` call. + # https://go-critic.com/overview.html#appendCombine + - appendCombine + # Detects suspicious arguments order. + # https://go-critic.com/overview.html#argOrder + - argOrder + # Detects assignments that can be simplified by using assignment operators. + # https://go-critic.com/overview.html#assignOp + - assignOp + # Detects suspicious function calls. + # https://go-critic.com/overview.html#badCall + - badCall + # Detects suspicious condition expressions. + # https://go-critic.com/overview.html#badCond + - badCond + # Detects suspicious mutex lock/unlock operations. + # https://go-critic.com/overview.html#badLock + - badLock + # Detects suspicious regexp patterns. + # https://go-critic.com/overview.html#badRegexp + - badRegexp + # Detects bad usage of sort package. + # https://go-critic.com/overview.html#badSorting + - badSorting + # Detects bad usage of sync.OnceFunc. + # https://go-critic.com/overview.html#badSyncOnceFunc + - badSyncOnceFunc + # Detects bool expressions that can be simplified. + # https://go-critic.com/overview.html#boolExprSimplify + - boolExprSimplify + # Detects when predeclared identifiers are shadowed in assignments. + # https://go-critic.com/overview.html#builtinShadow + - builtinShadow + # Detects top-level declarations that shadow the predeclared identifiers. + # https://go-critic.com/overview.html#builtinShadowDecl + - builtinShadowDecl + # Detects capitalized names for local variables. + # https://go-critic.com/overview.html#captLocal + - captLocal + # Detects erroneous case order inside switch statements. + # https://go-critic.com/overview.html#caseOrder + - caseOrder + # Detects malformed 'code generated' file comments. + # https://go-critic.com/overview.html#codegenComment + - codegenComment + # Detects comments with non-idiomatic formatting. + # https://go-critic.com/overview.html#commentFormatting + - commentFormatting + # Detects commented-out code inside function bodies. + # https://go-critic.com/overview.html#commentedOutCode + - commentedOutCode + # Detects commented-out imports. + # https://go-critic.com/overview.html#commentedOutImport + - commentedOutImport + # Detects when default case in switch isn't on 1st or last position. + # https://go-critic.com/overview.html#defaultCaseOrder + - defaultCaseOrder + # Detects loops inside functions that use defer. + # https://go-critic.com/overview.html#deferInLoop + - deferInLoop + # Detects deferred function literals that can be simplified. + # https://go-critic.com/overview.html#deferUnlambda + - deferUnlambda + # Detects malformed 'deprecated' doc-comments. + # https://go-critic.com/overview.html#deprecatedComment + - deprecatedComment + # Detects comments that silence go lint complaints about doc-comment. + # https://go-critic.com/overview.html#docStub + - docStub + # Detects suspicious duplicated arguments. + # https://go-critic.com/overview.html#dupArg + - dupArg + # Detects duplicated branch bodies inside conditional statements. + # https://go-critic.com/overview.html#dupBranchBody + - dupBranchBody + # Detects duplicated case clauses inside switch or select statements. + # https://go-critic.com/overview.html#dupCase + - dupCase + # Detects multiple imports of the same package under different aliases. + # https://go-critic.com/overview.html#dupImport + - dupImport + # Detects suspicious duplicated sub-expressions. + # https://go-critic.com/overview.html#dupSubExpr + - dupSubExpr + # Detects suspicious formatting strings usage. + # https://go-critic.com/overview.html#dynamicFmtString + - dynamicFmtString + # Detects else with nested if statement that can be replaced with else-if. + # https://go-critic.com/overview.html#elseif + - elseif + # Detects suspicious empty declarations blocks. + # https://go-critic.com/overview.html#emptyDecl + - emptyDecl + # Detects fallthrough that can be avoided by using multi case values. + # https://go-critic.com/overview.html#emptyFallthrough + - emptyFallthrough + # Detects empty string checks that can be written more idiomatically. + # https://go-critic.com/overview.html#emptyStringTest + - emptyStringTest + # Detects unoptimal strings/bytes case-insensitive comparison. + # https://go-critic.com/overview.html#equalFold + - equalFold + # Detects unwanted dependencies on the evaluation order. + # https://go-critic.com/overview.html#evalOrder + - evalOrder + # Detects calls to exit/fatal inside functions that use defer. + # https://go-critic.com/overview.html#exitAfterDefer + - exitAfterDefer + # Detects exposed methods from sync.Mutex and sync.RWMutex. + # https://go-critic.com/overview.html#exposedSyncMutex + - exposedSyncMutex + # Detects suspicious reassignment of error from another package. + # https://go-critic.com/overview.html#externalErrorReassign + - externalErrorReassign + # Detects problems in filepath.Join() function calls. + # https://go-critic.com/overview.html#filepathJoin + - filepathJoin + # Detects immediate dereferencing of `flag` package pointers. + # https://go-critic.com/overview.html#flagDeref + - flagDeref + # Detects suspicious flag names. + # https://go-critic.com/overview.html#flagName + - flagName + # Detects hex literals that have mixed case letter digits. + # https://go-critic.com/overview.html#hexLiteral + - hexLiteral + # Detects nil usages in http.NewRequest calls, suggesting http.NoBody as an alternative. + # https://go-critic.com/overview.html#httpNoBody + - httpNoBody + # Detects params that incur excessive amount of copying. + # https://go-critic.com/overview.html#hugeParam + - hugeParam + # Detects repeated if-else statements and suggests to replace them with switch statement. + # https://go-critic.com/overview.html#ifElseChain + - ifElseChain + # Detects when imported package names shadowed in the assignments. + # https://go-critic.com/overview.html#importShadow + - importShadow + # Detects strings.Index calls that may cause unwanted allocs. + # https://go-critic.com/overview.html#indexAlloc + - indexAlloc + # Detects non-assignment statements inside if/switch init clause. + # https://go-critic.com/overview.html#initClause + - initClause + # Detects suspicious map literal keys. + # https://go-critic.com/overview.html#mapKey + - mapKey + # Detects method expression call that can be replaced with a method call. + # https://go-critic.com/overview.html#methodExprCall + - methodExprCall + # Finds where nesting level could be reduced. + # https://go-critic.com/overview.html#nestingReduce - nestingReduce - - unnamedResult + # Detects immediate dereferencing of `new` expressions. + # https://go-critic.com/overview.html#newDeref + - newDeref + # Detects return statements those results evaluate to nil. + # https://go-critic.com/overview.html#nilValReturn + - nilValReturn + # Detects old-style octal literals. + # https://go-critic.com/overview.html#octalLiteral + - octalLiteral + # Detects various off-by-one kind of errors. + # https://go-critic.com/overview.html#offBy1 + - offBy1 + # Detects if function parameters could be combined by type and suggest the way to do it. + # https://go-critic.com/overview.html#paramTypeCombine + - paramTypeCombine + # Detects expressions like []rune(s)[0] that may cause unwanted rune slice allocation. + # https://go-critic.com/overview.html#preferDecodeRune + - preferDecodeRune + # Detects concatenation with os.PathSeparator which can be replaced with filepath.Join. + # https://go-critic.com/overview.html#preferFilepathJoin + - preferFilepathJoin + # Detects fmt.Sprint(f/ln) calls which can be replaced with fmt.Fprint(f/ln). + # https://go-critic.com/overview.html#preferFprint + - preferFprint + # Detects w.Write or io.WriteString calls which can be replaced with w.WriteString. + # https://go-critic.com/overview.html#preferStringWriter + - preferStringWriter + # Detects WriteRune calls with rune literal argument that is single byte and reports to use WriteByte instead. + # https://go-critic.com/overview.html#preferWriteByte + - preferWriteByte + # Detects input and output parameters that have a type of pointer to referential type. + # https://go-critic.com/overview.html#ptrToRefParam + - ptrToRefParam + # Detects append all its data while range it. + # https://go-critic.com/overview.html#rangeAppendAll + - rangeAppendAll + # Detects expensive copies of `for` loop range expressions. + # https://go-critic.com/overview.html#rangeExprCopy + - rangeExprCopy + # Detects loops that copy big objects during each iteration. + # https://go-critic.com/overview.html#rangeValCopy + - rangeValCopy + # Detects redundant fmt.Sprint calls. + # https://go-critic.com/overview.html#redundantSprint + - redundantSprint + # Detects `regexp.Compile*` that can be replaced with `regexp.MustCompile*`. + # https://go-critic.com/overview.html#regexpMust + - regexpMust + # Detects suspicious regexp patterns. + # https://go-critic.com/overview.html#regexpPattern + - regexpPattern + # Detects regexp patterns that can be simplified. + # https://go-critic.com/overview.html#regexpSimplify + - regexpSimplify + # Detects suspicious http.Error call without following return. + # https://go-critic.com/overview.html#returnAfterHttpError + - returnAfterHttpError + # Runs user-defined rules using ruleguard linter. + # https://go-critic.com/overview.html#ruleguard - ruleguard + # Detects switch statements that could be better written as if statement. + # https://go-critic.com/overview.html#singleCaseSwitch + - singleCaseSwitch + # Detects slice clear loops, suggests an idiom that is recognized by the Go compiler. + # https://go-critic.com/overview.html#sliceClear + - sliceClear + # Detects usage of `len` when result is obvious or doesn't make sense. + # https://go-critic.com/overview.html#sloppyLen + - sloppyLen + # Detects suspicious/confusing re-assignments. + # https://go-critic.com/overview.html#sloppyReassign + - sloppyReassign + # Detects redundant type assertions. + # https://go-critic.com/overview.html#sloppyTypeAssert + - sloppyTypeAssert + # Detects suspicious sort.Slice calls. + # https://go-critic.com/overview.html#sortSlice + - sortSlice + # Detects "%s" formatting directives that can be replaced with %q. + # https://go-critic.com/overview.html#sprintfQuotedString + - sprintfQuotedString + # Detects issue in Query() and Exec() calls. + # https://go-critic.com/overview.html#sqlQuery + - sqlQuery + # Detects string concat operations that can be simplified. + # https://go-critic.com/overview.html#stringConcatSimplify + - stringConcatSimplify + # Detects redundant conversions between string and []byte. + # https://go-critic.com/overview.html#stringXbytes + - stringXbytes + # Detects strings.Compare usage. + # https://go-critic.com/overview.html#stringsCompare + - stringsCompare + # Detects switch-over-bool statements that use explicit `true` tag value. + # https://go-critic.com/overview.html#switchTrue + - switchTrue + # Detects sync.Map load+delete operations that can be replaced with LoadAndDelete. + # https://go-critic.com/overview.html#syncMapLoadAndDelete + - syncMapLoadAndDelete + # Detects manual conversion to milli- or microseconds. + # https://go-critic.com/overview.html#timeExprSimplify + - timeExprSimplify + # Detects TODO comments without detail/assignee. + # https://go-critic.com/overview.html#todoCommentWithoutDetail + - todoCommentWithoutDetail + # Detects function with too many results. + # https://go-critic.com/overview.html#tooManyResultsChecker + - tooManyResultsChecker + # Detects potential truncation issues when comparing ints of different sizes. + # https://go-critic.com/overview.html#truncateCmp - truncateCmp + # Detects repeated type assertions and suggests to replace them with type switch statement. + # https://go-critic.com/overview.html#typeAssertChain + - typeAssertChain + # Detects method declarations preceding the type definition itself. + # https://go-critic.com/overview.html#typeDefFirst + - typeDefFirst + # Detects type switches that can benefit from type guard clause with variable. + # https://go-critic.com/overview.html#typeSwitchVar + - typeSwitchVar + # Detects unneeded parenthesis inside type expressions and suggests to remove them. + # https://go-critic.com/overview.html#typeUnparen + - typeUnparen + # Detects unchecked errors in if statements. + # https://go-critic.com/overview.html#uncheckedInlineErr + - uncheckedInlineErr + # Detects dereference expressions that can be omitted. + # https://go-critic.com/overview.html#underef + - underef + # Detects redundant statement labels. + # https://go-critic.com/overview.html#unlabelStmt + - unlabelStmt + # Detects function literals that can be simplified. + # https://go-critic.com/overview.html#unlambda + - unlambda + # Detects unnamed results that may benefit from names. + # https://go-critic.com/overview.html#unnamedResult + - unnamedResult + # Detects unnecessary braced statement blocks. + # https://go-critic.com/overview.html#unnecessaryBlock + - unnecessaryBlock + # Detects redundantly deferred calls. + # https://go-critic.com/overview.html#unnecessaryDefer + - unnecessaryDefer + # Detects slice expressions that can be simplified to sliced expression itself. + # https://go-critic.com/overview.html#unslice + - unslice + # Detects value swapping code that are not using parallel assignment. + # https://go-critic.com/overview.html#valSwap + - valSwap + # Detects conditions that are unsafe due to not being exhaustive. + # https://go-critic.com/overview.html#weakCond + - weakCond + # Ensures that `//nolint` comments include an explanation. + # https://go-critic.com/overview.html#whyNoLint + - whyNoLint + # Detects function calls that can be replaced with convenience wrappers. + # https://go-critic.com/overview.html#wrapperFunc + - wrapperFunc + # Detects Yoda style expressions and suggests to replace them. + # https://go-critic.com/overview.html#yodaStyleExpr + - yodaStyleExpr # Enable all checks. # Default: false @@ -706,7 +1032,112 @@ linters-settings: # Which checks should be disabled; can't be combined with 'enabled-checks'. # Default: [] disabled-checks: + - appendAssign + - appendCombine + - argOrder + - assignOp + - badCall + - badCond + - badLock + - badRegexp + - badSorting + - badSyncOnceFunc + - boolExprSimplify + - builtinShadow + - builtinShadowDecl + - captLocal + - caseOrder + - codegenComment + - commentFormatting + - commentedOutCode + - commentedOutImport + - defaultCaseOrder + - deferInLoop + - deferUnlambda + - deprecatedComment + - docStub + - dupArg + - dupBranchBody + - dupCase + - dupImport + - dupSubExpr + - dynamicFmtString + - elseif + - emptyDecl + - emptyFallthrough + - emptyStringTest + - equalFold + - evalOrder + - exitAfterDefer + - exposedSyncMutex + - externalErrorReassign + - filepathJoin + - flagDeref + - flagName + - hexLiteral + - httpNoBody + - hugeParam + - ifElseChain + - importShadow + - indexAlloc + - initClause + - mapKey + - methodExprCall + - nestingReduce + - newDeref + - nilValReturn + - octalLiteral + - offBy1 + - paramTypeCombine + - preferDecodeRune + - preferFilepathJoin + - preferFprint + - preferStringWriter + - preferWriteByte + - ptrToRefParam + - rangeAppendAll + - rangeExprCopy + - rangeValCopy + - redundantSprint - regexpMust + - regexpPattern + - regexpSimplify + - returnAfterHttpError + - ruleguard + - singleCaseSwitch + - sliceClear + - sloppyLen + - sloppyReassign + - sloppyTypeAssert + - sortSlice + - sprintfQuotedString + - sqlQuery + - stringConcatSimplify + - stringXbytes + - stringsCompare + - switchTrue + - syncMapLoadAndDelete + - timeExprSimplify + - todoCommentWithoutDetail + - tooManyResultsChecker + - truncateCmp + - typeAssertChain + - typeDefFirst + - typeSwitchVar + - typeUnparen + - uncheckedInlineErr + - underef + - unlabelStmt + - unlambda + - unnamedResult + - unnecessaryBlock + - unnecessaryDefer + - unslice + - valSwap + - weakCond + - whyNoLint + - wrapperFunc + - yodaStyleExpr # Enable multiple checks by tags in addition to default checks. # Run `GL_DEBUG=gocritic golangci-lint run --enable=gocritic` to see all tags and checks. @@ -971,7 +1402,112 @@ linters-settings: gosimple: # Sxxxx checks in https://staticcheck.dev/docs/configuration/options/#checks # Default: ["*"] - checks: [ "all" ] + checks: + # Use plain channel send or receive instead of single-case select. + # https://staticcheck.dev/docs/checks/#S1000 + - S1000 + # Replace for loop with call to copy. + # https://staticcheck.dev/docs/checks/#S1001 + - S1001 + # Omit comparison with boolean constant. + # https://staticcheck.dev/docs/checks/#S1002 + - S1002 + # Replace call to 'strings.Index' with 'strings.Contains'. + # https://staticcheck.dev/docs/checks/#S1003 + - S1003 + # Replace call to 'bytes.Compare' with 'bytes.Equal'. + # https://staticcheck.dev/docs/checks/#S1004 + - S1004 + # Drop unnecessary use of the blank identifier. + # https://staticcheck.dev/docs/checks/#S1005 + - S1005 + # Use "for { ... }" for infinite loops. + # https://staticcheck.dev/docs/checks/#S1006 + - S1006 + # Simplify regular expression by using raw string literal. + # https://staticcheck.dev/docs/checks/#S1007 + - S1007 + # Simplify returning boolean expression. + # https://staticcheck.dev/docs/checks/#S1008 + - S1008 + # Omit redundant nil check on slices, maps, and channels. + # https://staticcheck.dev/docs/checks/#S1009 + - S1009 + # Omit default slice index. + # https://staticcheck.dev/docs/checks/#S1010 + - S1010 + # Use a single 'append' to concatenate two slices. + # https://staticcheck.dev/docs/checks/#S1011 + - S1011 + # Replace 'time.Now().Sub(x)' with 'time.Since(x)'. + # https://staticcheck.dev/docs/checks/#S1012 + - S1012 + # Use a type conversion instead of manually copying struct fields. + # https://staticcheck.dev/docs/checks/#S1016 + - S1016 + # Replace manual trimming with 'strings.TrimPrefix'. + # https://staticcheck.dev/docs/checks/#S1017 + - S1017 + # Use "copy" for sliding elements. + # https://staticcheck.dev/docs/checks/#S1018 + - S1018 + # Simplify "make" call by omitting redundant arguments. + # https://staticcheck.dev/docs/checks/#S1019 + - S1019 + # Omit redundant nil check in type assertion. + # https://staticcheck.dev/docs/checks/#S1020 + - S1020 + # Merge variable declaration and assignment. + # https://staticcheck.dev/docs/checks/#S1021 + - S1021 + # Omit redundant control flow. + # https://staticcheck.dev/docs/checks/#S1023 + - S1023 + # Replace 'x.Sub(time.Now())' with 'time.Until(x)'. + # https://staticcheck.dev/docs/checks/#S1024 + - S1024 + # Don't use 'fmt.Sprintf("%s", x)' unnecessarily. + # https://staticcheck.dev/docs/checks/#S1025 + - S1025 + # Simplify error construction with 'fmt.Errorf'. + # https://staticcheck.dev/docs/checks/#S1028 + - S1028 + # Range over the string directly. + # https://staticcheck.dev/docs/checks/#S1029 + - S1029 + # Use 'bytes.Buffer.String' or 'bytes.Buffer.Bytes'. + # https://staticcheck.dev/docs/checks/#S1030 + - S1030 + # Omit redundant nil check around loop. + # https://staticcheck.dev/docs/checks/#S1031 + - S1031 + # Use 'sort.Ints(x)', 'sort.Float64s(x)', and 'sort.Strings(x)'. + # https://staticcheck.dev/docs/checks/#S1032 + - S1032 + # Unnecessary guard around call to "delete". + # https://staticcheck.dev/docs/checks/#S1033 + - S1033 + # Use result of type assertion to simplify cases. + # https://staticcheck.dev/docs/checks/#S1034 + - S1034 + # Redundant call to 'net/http.CanonicalHeaderKey' in method call on 'net/http.Header'. + # https://staticcheck.dev/docs/checks/#S1035 + - S1035 + # Unnecessary guard around map access. + # https://staticcheck.dev/docs/checks/#S1036 + - S1036 + # Elaborate way of sleeping. + # https://staticcheck.dev/docs/checks/#S1037 + - S1037 + # Unnecessarily complex way of printing formatted string. + # https://staticcheck.dev/docs/checks/#S1038 + - S1038 + # Unnecessary use of 'fmt.Sprint'. + # https://staticcheck.dev/docs/checks/#S1039 + - S1039 + # Type assertion to current type. + # https://staticcheck.dev/docs/checks/#S1040 + - S1040 gosec: # To select a subset of rules to run. @@ -1203,45 +1739,87 @@ linters-settings: # Run `GL_DEBUG=govet golangci-lint run --enable=govet` to see default, all available analyzers, and enabled analyzers. # Default: [] enable: + # Check for missing values after append. - appends + # Report mismatches between assembly files and Go declarations. - asmdecl + # Check for useless assignments. - assign + # Check for common mistakes using the sync/atomic package. - atomic + # Check for non-64-bits-aligned arguments to sync/atomic functions. - atomicalign + # Check for common mistakes involving boolean operators. - bools + # Check //go:build and // +build directives. - buildtag + # Detect some violations of the cgo pointer passing rules. - cgocall + # Check for unkeyed composite literals. - composites + # Check for locks erroneously passed by value. - copylocks + # Check for calls of reflect.DeepEqual on error values. - deepequalerrors + # Report common mistakes in defer statements. - defers + # Check Go toolchain directives such as //go:debug. - directive + # Report passing non-pointer or non-error values to errors.As. - errorsas + # Find structs that would use less memory if their fields were sorted. - fieldalignment + # Find calls to a particular function. - findcall + # Report assembly that clobbers the frame pointer before saving it. - framepointer + # Check for mistakes using HTTP responses. - httpresponse + # Detect impossible interface-to-interface type assertions. - ifaceassert + # Check references to loop variables from within nested functions. - loopclosure + # Check cancel func returned by context.WithCancel is called. - lostcancel + # Check for useless comparisons between functions and nil. - nilfunc + # Check for redundant or impossible nil comparisons. - nilness + # Check consistency of Printf format strings and arguments. - printf + # Check for comparing reflect.Value values with == or reflect.DeepEqual. - reflectvaluecompare + # Check for possible unintended shadowing of variables. - shadow + # Check for shifts that equal or exceed the width of the integer. - shift + # Check for unbuffered channel of os.Signal. - sigchanyzer + # Check for invalid structured logging calls. - slog + # Check the argument type of sort.Slice. - sortslice + # Check signature of methods of well-known interfaces. - stdmethods + # Check for string(int) conversions. - stringintconv + # Check that struct field tags conform to reflect.StructTag.Get. - structtag + # Report calls to (*testing.T).Fatal from goroutines started by a test. - testinggoroutine + # Check for common mistaken usages of tests and examples. - tests + # Check for calls of (time.Time).Format or time.Parse with 2006-02-01. + - timeformat + # Report passing non-pointer or non-interface values to unmarshal. - unmarshal + # Check for unreachable code. - unreachable + # Check for invalid conversions of uintptr to unsafe.Pointer. - unsafeptr + # Check for unused results of calls to some functions. - unusedresult + # Checks for unused writes. - unusedwrite # Enable all analyzers. @@ -1290,6 +1868,7 @@ linters-settings: - structtag - testinggoroutine - tests + - timeformat - unmarshal - unreachable - unsafeptr @@ -1355,6 +1934,20 @@ linters-settings: # Default: false var-require-grouping: true + iface: + # List of analyzers. + # Default: ["identical"] + enable: + - identical # Identifies interfaces in the same package that have identical method sets. + - unused # Identifies interfaces that are not used anywhere in the same package where the interface is defined. + - opaque # Identifies functions that return interfaces, but the actual returned value is always a single concrete implementation. + settings: + unused: + # List of packages path to exclude from the check. + # Default: [] + exclude: + - github.com/example/log + importas: # Do not allow unaliased imports of aliased packages. # Default: false @@ -1546,14 +2139,17 @@ linters-settings: min-complexity: 4 nilnil: + # In addition, detect opposite situation (simultaneous return of non-nil error and valid value). + # Default: false + detect-opposite: true # List of return types to check. - # Default: ["ptr", "func", "iface", "map", "chan", "uintptr", "unsafeptr"] + # Default: ["chan", "func", "iface", "map", "ptr", "uintptr", "unsafeptr"] checked-types: - - ptr + - chan - func - iface - map - - chan + - ptr - uintptr - unsafeptr @@ -1638,15 +2234,24 @@ linters-settings: # Please refer to https://github.com/yeya24/promlinter#usage for detailed usage. # Default: [] disabled-linters: + # Help detects issues related to the help text for a metric. - Help + # MetricUnits detects issues with metric unit names. - MetricUnits + # Counter detects issues specific to counters, as well as patterns that should only be used with counters. - Counter + # HistogramSummaryReserved detects when other types of metrics use names or labels reserved for use by histograms and/or summaries. - HistogramSummaryReserved + # MetricTypeInName detects when metric types are included in the metric name. - MetricTypeInName + # ReservedChars detects colons in metric names. - ReservedChars + # CamelCase detects metric names and label names written in camelCase. - CamelCase + # UnitAbbreviations detects abbreviated units in the metric name. - UnitAbbreviations + protogetter: # Skip files generated by specified generators from the checking. # Checks only the file's initial comment, which must follow the format: "// Code generated by ". @@ -1891,9 +2496,10 @@ linters-settings: disabled: false exclude: [""] arguments: - - "preserveScope" - "checkPrivateReceivers" - - "sayRepetitiveInsteadOfStutters" + - "disableStutteringCheck" + - "checkPublicInterface" + - "disableChecksOnFunctions" # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#file-header - name: file-header severity: warning @@ -1901,6 +2507,22 @@ linters-settings: exclude: [""] arguments: - This is the text that must appear at the top of source files. + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#file-length-limit + - name: file-length-limit + severity: warning + disabled: false + exclude: [""] + arguments: + - max: 100 + skipComments: true + skipBlankLines: true + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#filename-format + - name: filename-format + severity: warning + disabled: false + exclude: [""] + arguments: + - "^[_a-z][_a-z0-9]*.go$" # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#flag-parameter - name: flag-parameter severity: warning @@ -2028,6 +2650,8 @@ linters-settings: severity: warning disabled: false exclude: [""] + arguments: + - maxLength: 2 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redefines-builtin-id - name: redefines-builtin-id severity: warning @@ -2254,13 +2878,296 @@ linters-settings: - "github.com/user/repo/telemetry/trace.Start:opentelemetry" staticcheck: # SAxxxx checks in https://staticcheck.dev/docs/configuration/options/#checks + # Example (to disable some checks): [ "all", "-SA1000", "-SA1001"] # Default: ["*"] - checks: [ "all" ] + checks: + # Invalid regular expression. + # https://staticcheck.dev/docs/checks/#SA1000 + - SA1000 + # Invalid template. + # https://staticcheck.dev/docs/checks/#SA1001 + - SA1001 + # Invalid format in 'time.Parse'. + # https://staticcheck.dev/docs/checks/#SA1002 + - SA1002 + # Unsupported argument to functions in 'encoding/binary'. + # https://staticcheck.dev/docs/checks/#SA1003 + - SA1003 + # Suspiciously small untyped constant in 'time.Sleep'. + # https://staticcheck.dev/docs/checks/#SA1004 + - SA1004 + # Invalid first argument to 'exec.Command'. + # https://staticcheck.dev/docs/checks/#SA1005 + - SA1005 + # 'Printf' with dynamic first argument and no further arguments. + # https://staticcheck.dev/docs/checks/#SA1006 + - SA1006 + # Invalid URL in 'net/url.Parse'. + # https://staticcheck.dev/docs/checks/#SA1007 + - SA1007 + # Non-canonical key in 'http.Header' map. + # https://staticcheck.dev/docs/checks/#SA1008 + - SA1008 + # '(*regexp.Regexp).FindAll' called with 'n == 0', which will always return zero results. + # https://staticcheck.dev/docs/checks/#SA1010 + - SA1010 + # Various methods in the "strings" package expect valid UTF-8, but invalid input is provided. + # https://staticcheck.dev/docs/checks/#SA1011 + - SA1011 + # A nil 'context.Context' is being passed to a function, consider using 'context.TODO' instead. + # https://staticcheck.dev/docs/checks/#SA1012 + - SA1012 + # 'io.Seeker.Seek' is being called with the whence constant as the first argument, but it should be the second. + # https://staticcheck.dev/docs/checks/#SA1013 + - SA1013 + # Non-pointer value passed to 'Unmarshal' or 'Decode'. + # https://staticcheck.dev/docs/checks/#SA1014 + - SA1014 + # Using 'time.Tick' in a way that will leak. Consider using 'time.NewTicker', and only use 'time.Tick' in tests, commands and endless functions. + # https://staticcheck.dev/docs/checks/#SA1015 + - SA1015 + # Trapping a signal that cannot be trapped. + # https://staticcheck.dev/docs/checks/#SA1016 + - SA1016 + # Channels used with 'os/signal.Notify' should be buffered. + # https://staticcheck.dev/docs/checks/#SA1017 + - SA1017 + # 'strings.Replace' called with 'n == 0', which does nothing. + # https://staticcheck.dev/docs/checks/#SA1018 + - SA1018 + # Using a deprecated function, variable, constant or field. + # https://staticcheck.dev/docs/checks/#SA1019 + - SA1019 + # Using an invalid host:port pair with a 'net.Listen'-related function. + # https://staticcheck.dev/docs/checks/#SA1020 + - SA1020 + # Using 'bytes.Equal' to compare two 'net.IP'. + # https://staticcheck.dev/docs/checks/#SA1021 + - SA1021 + # Modifying the buffer in an 'io.Writer' implementation. + # https://staticcheck.dev/docs/checks/#SA1023 + - SA1023 + # A string cutset contains duplicate characters. + # https://staticcheck.dev/docs/checks/#SA1024 + - SA1024 + # It is not possible to use '(*time.Timer).Reset''s return value correctly. + # https://staticcheck.dev/docs/checks/#SA1025 + - SA1025 + # Cannot marshal channels or functions. + # https://staticcheck.dev/docs/checks/#SA1026 + - SA1026 + # Atomic access to 64-bit variable must be 64-bit aligned. + # https://staticcheck.dev/docs/checks/#SA1027 + - SA1027 + # 'sort.Slice' can only be used on slices. + # https://staticcheck.dev/docs/checks/#SA1028 + - SA1028 + # Inappropriate key in call to 'context.WithValue'. + # https://staticcheck.dev/docs/checks/#SA1029 + - SA1029 + # Invalid argument in call to a 'strconv' function. + # https://staticcheck.dev/docs/checks/#SA1030 + - SA1030 + # Overlapping byte slices passed to an encoder. + # https://staticcheck.dev/docs/checks/#SA1031 + - SA1031 + # Wrong order of arguments to 'errors.Is'. + # https://staticcheck.dev/docs/checks/#SA1032 + - SA1032 + # 'sync.WaitGroup.Add' called inside the goroutine, leading to a race condition. + # https://staticcheck.dev/docs/checks/#SA2000 + - SA2000 + # Empty critical section, did you mean to defer the unlock?. + # https://staticcheck.dev/docs/checks/#SA2001 + - SA2001 + # Called 'testing.T.FailNow' or 'SkipNow' in a goroutine, which isn't allowed. + # https://staticcheck.dev/docs/checks/#SA2002 + - SA2002 + # Deferred 'Lock' right after locking, likely meant to defer 'Unlock' instead. + # https://staticcheck.dev/docs/checks/#SA2003 + - SA2003 + # 'TestMain' doesn't call 'os.Exit', hiding test failures. + # https://staticcheck.dev/docs/checks/#SA3000 + - SA3000 + # Assigning to 'b.N' in benchmarks distorts the results. + # https://staticcheck.dev/docs/checks/#SA3001 + - SA3001 + # Binary operator has identical expressions on both sides. + # https://staticcheck.dev/docs/checks/#SA4000 + - SA4000 + # '&*x' gets simplified to 'x', it does not copy 'x'. + # https://staticcheck.dev/docs/checks/#SA4001 + - SA4001 + # Comparing unsigned values against negative values is pointless. + # https://staticcheck.dev/docs/checks/#SA4003 + - SA4003 + # The loop exits unconditionally after one iteration. + # https://staticcheck.dev/docs/checks/#SA4004 + - SA4004 + # Field assignment that will never be observed. Did you mean to use a pointer receiver?. + # https://staticcheck.dev/docs/checks/#SA4005 + - SA4005 + # A value assigned to a variable is never read before being overwritten. Forgotten error check or dead code?. + # https://staticcheck.dev/docs/checks/#SA4006 + - SA4006 + # The variable in the loop condition never changes, are you incrementing the wrong variable?. + # https://staticcheck.dev/docs/checks/#SA4008 + - SA4008 + # A function argument is overwritten before its first use. + # https://staticcheck.dev/docs/checks/#SA4009 + - SA4009 + # The result of 'append' will never be observed anywhere. + # https://staticcheck.dev/docs/checks/#SA4010 + - SA4010 + # Break statement with no effect. Did you mean to break out of an outer loop?. + # https://staticcheck.dev/docs/checks/#SA4011 + - SA4011 + # Comparing a value against NaN even though no value is equal to NaN. + # https://staticcheck.dev/docs/checks/#SA4012 + - SA4012 + # Negating a boolean twice ('!!b') is the same as writing 'b'. This is either redundant, or a typo. + # https://staticcheck.dev/docs/checks/#SA4013 + - SA4013 + # An if/else if chain has repeated conditions and no side-effects; if the condition didn't match the first time, it won't match the second time, either. + # https://staticcheck.dev/docs/checks/#SA4014 + - SA4014 + # Calling functions like 'math.Ceil' on floats converted from integers doesn't do anything useful. + # https://staticcheck.dev/docs/checks/#SA4015 + - SA4015 + # Certain bitwise operations, such as 'x ^ 0', do not do anything useful. + # https://staticcheck.dev/docs/checks/#SA4016 + - SA4016 + # Discarding the return values of a function without side effects, making the call pointless. + # https://staticcheck.dev/docs/checks/#SA4017 + - SA4017 + # Self-assignment of variables. + # https://staticcheck.dev/docs/checks/#SA4018 + - SA4018 + # Multiple, identical build constraints in the same file. + # https://staticcheck.dev/docs/checks/#SA4019 + - SA4019 + # Unreachable case clause in a type switch. + # https://staticcheck.dev/docs/checks/#SA4020 + - SA4020 + # "x = append(y)" is equivalent to "x = y". + # https://staticcheck.dev/docs/checks/#SA4021 + - SA4021 + # Comparing the address of a variable against nil. + # https://staticcheck.dev/docs/checks/#SA4022 + - SA4022 + # Impossible comparison of interface value with untyped nil. + # https://staticcheck.dev/docs/checks/#SA4023 + - SA4023 + # Checking for impossible return value from a builtin function. + # https://staticcheck.dev/docs/checks/#SA4024 + - SA4024 + # Integer division of literals that results in zero. + # https://staticcheck.dev/docs/checks/#SA4025 + - SA4025 + # Go constants cannot express negative zero. + # https://staticcheck.dev/docs/checks/#SA4026 + - SA4026 + # '(*net/url.URL).Query' returns a copy, modifying it doesn't change the URL. + # https://staticcheck.dev/docs/checks/#SA4027 + - SA4027 + # 'x % 1' is always zero. + # https://staticcheck.dev/docs/checks/#SA4028 + - SA4028 + # Ineffective attempt at sorting slice. + # https://staticcheck.dev/docs/checks/#SA4029 + - SA4029 + # Ineffective attempt at generating random number. + # https://staticcheck.dev/docs/checks/#SA4030 + - SA4030 + # Checking never-nil value against nil. + # https://staticcheck.dev/docs/checks/#SA4031 + - SA4031 + # Comparing 'runtime.GOOS' or 'runtime.GOARCH' against impossible value. + # https://staticcheck.dev/docs/checks/#SA4032 + - SA4032 + # Assignment to nil map. + # https://staticcheck.dev/docs/checks/#SA5000 + - SA5000 + # Deferring 'Close' before checking for a possible error. + # https://staticcheck.dev/docs/checks/#SA5001 + - SA5001 + # The empty for loop ("for {}") spins and can block the scheduler. + # https://staticcheck.dev/docs/checks/#SA5002 + - SA5002 + # Defers in infinite loops will never execute. + # https://staticcheck.dev/docs/checks/#SA5003 + - SA5003 + # "for { select { ..." with an empty default branch spins. + # https://staticcheck.dev/docs/checks/#SA5004 + - SA5004 + # The finalizer references the finalized object, preventing garbage collection. + # https://staticcheck.dev/docs/checks/#SA5005 + - SA5005 + # Infinite recursive call. + # https://staticcheck.dev/docs/checks/#SA5007 + - SA5007 + # Invalid struct tag. + # https://staticcheck.dev/docs/checks/#SA5008 + - SA5008 + # Invalid Printf call. + # https://staticcheck.dev/docs/checks/#SA5009 + - SA5009 + # Impossible type assertion. + # https://staticcheck.dev/docs/checks/#SA5010 + - SA5010 + # Possible nil pointer dereference. + # https://staticcheck.dev/docs/checks/#SA5011 + - SA5011 + # Passing odd-sized slice to function expecting even size. + # https://staticcheck.dev/docs/checks/#SA5012 + - SA5012 + # Using 'regexp.Match' or related in a loop, should use 'regexp.Compile'. + # https://staticcheck.dev/docs/checks/#SA6000 + - SA6000 + # Missing an optimization opportunity when indexing maps by byte slices. + # https://staticcheck.dev/docs/checks/#SA6001 + - SA6001 + # Storing non-pointer values in 'sync.Pool' allocates memory. + # https://staticcheck.dev/docs/checks/#SA6002 + - SA6002 + # Converting a string to a slice of runes before ranging over it. + # https://staticcheck.dev/docs/checks/#SA6003 + - SA6003 + # Inefficient string comparison with 'strings.ToLower' or 'strings.ToUpper'. + # https://staticcheck.dev/docs/checks/#SA6005 + - SA6005 + # Using io.WriteString to write '[]byte'. + # https://staticcheck.dev/docs/checks/#SA6006 + - SA6006 + # Defers in range loops may not run when you expect them to. + # https://staticcheck.dev/docs/checks/#SA9001 + - SA9001 + # Using a non-octal 'os.FileMode' that looks like it was meant to be in octal. + # https://staticcheck.dev/docs/checks/#SA9002 + - SA9002 + # Empty body in an if or else branch. + # https://staticcheck.dev/docs/checks/#SA9003 + - SA9003 + # Only the first constant has an explicit type. + # https://staticcheck.dev/docs/checks/#SA9004 + - SA9004 + # Trying to marshal a struct with no public fields nor custom marshaling. + # https://staticcheck.dev/docs/checks/#SA9005 + - SA9005 + # Dubious bit shifting of a fixed size integer value. + # https://staticcheck.dev/docs/checks/#SA9006 + - SA9006 + # Deleting a directory that shouldn't be deleted. + # https://staticcheck.dev/docs/checks/#SA9007 + - SA9007 + # 'else' branch of a type assertion is probably not reading the right value. + # https://staticcheck.dev/docs/checks/#SA9008 + - SA9008 + # Ineffectual Go compiler directive. + # https://staticcheck.dev/docs/checks/#SA9009 + - SA9009 stylecheck: - # STxxxx checks in https://staticcheck.dev/docs/configuration/options/#checks - # Default: ["*"] - checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ] # https://staticcheck.dev/docs/configuration/options/#dot_import_whitelist # Default: ["github.com/mmcloughlin/avo/build", "github.com/mmcloughlin/avo/operand", "github.com/mmcloughlin/avo/reg"] dot-import-whitelist: @@ -2271,6 +3178,64 @@ linters-settings: # https://staticcheck.dev/docs/configuration/options/#http_status_code_whitelist # Default: ["200", "400", "404", "500"] http-status-code-whitelist: [ "200", "400", "404", "500" ] + # STxxxx checks in https://staticcheck.dev/docs/configuration/options/#checks + # Example (to disable some checks): [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ] + # Default: ["*"] + checks: + # Incorrect or missing package comment. + # https://staticcheck.dev/docs/checks/#ST1000 + - ST1000 + # Dot imports are discouraged. + # https://staticcheck.dev/docs/checks/#ST1001 + - ST1001 + # Poorly chosen identifier. + # https://staticcheck.dev/docs/checks/#ST1003 + - ST1003 + # Incorrectly formatted error string. + # https://staticcheck.dev/docs/checks/#ST1005 + - ST1005 + # Poorly chosen receiver name. + # https://staticcheck.dev/docs/checks/#ST1006 + - ST1006 + # A function's error value should be its last return value. + # https://staticcheck.dev/docs/checks/#ST1008 + - ST1008 + # Poorly chosen name for variable of type 'time.Duration'. + # https://staticcheck.dev/docs/checks/#ST1011 + - ST1011 + # Poorly chosen name for error variable. + # https://staticcheck.dev/docs/checks/#ST1012 + - ST1012 + # Should use constants for HTTP error codes, not magic numbers. + # https://staticcheck.dev/docs/checks/#ST1013 + - ST1013 + # A switch's default case should be the first or last case. + # https://staticcheck.dev/docs/checks/#ST1015 + - ST1015 + # Use consistent method receiver names. + # https://staticcheck.dev/docs/checks/#ST1016 + - ST1016 + # Don't use Yoda conditions. + # https://staticcheck.dev/docs/checks/#ST1017 + - ST1017 + # Avoid zero-width and control characters in string literals. + # https://staticcheck.dev/docs/checks/#ST1018 + - ST1018 + # Importing the same package multiple times. + # https://staticcheck.dev/docs/checks/#ST1019 + - ST1019 + # The documentation of an exported function should start with the function's name. + # https://staticcheck.dev/docs/checks/#ST1020 + - ST1020 + # The documentation of an exported type should start with type's name. + # https://staticcheck.dev/docs/checks/#ST1021 + - ST1021 + # The documentation of an exported variable or constant should start with variable's name. + # https://staticcheck.dev/docs/checks/#ST1022 + - ST1022 + # Redundant type in variable declaration. + # https://staticcheck.dev/docs/checks/#ST1023 + - ST1023 tagalign: # Align and sort can be used together or separately. @@ -2350,7 +3315,9 @@ linters-settings: - blank-import - bool-compare - compares + - contains - empty + - encoded-compare - error-is-as - error-nil - expected-actual @@ -2360,6 +3327,7 @@ linters-settings: - len - negative-positive - nil-compare + - regexp - require-error - suite-broken-parallel - suite-dont-use-pkg @@ -2373,15 +3341,17 @@ linters-settings: disable-all: true # Enable checkers by name # (in addition to default - # blank-import, bool-compare, compares, empty, error-is-as, error-nil, expected-actual, go-require, float-compare, - # formatter, len, negative-positive, nil-compare, require-error, suite-broken-parallel, suite-dont-use-pkg, - # suite-extra-assert-call, suite-subtest-run, useless-assert + # blank-import, bool-compare, compares, contains, empty, encoded-compare, error-is-as, error-nil, expected-actual, + # go-require, float-compare, formatter, len, negative-positive, nil-compare, regexp, require-error, + # suite-broken-parallel, suite-dont-use-pkg, suite-extra-assert-call, suite-subtest-run, useless-assert # ). enable: - blank-import - bool-compare - compares + - contains - empty + - encoded-compare - error-is-as - error-nil - expected-actual @@ -2391,6 +3361,7 @@ linters-settings: - len - negative-positive - nil-compare + - regexp - require-error - suite-broken-parallel - suite-dont-use-pkg diff --git a/CHANGELOG.md b/CHANGELOG.md index b06f959deff7..2094cb03f31f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,55 @@ -Follow the news and releases on [Mastodon](https://fosstodon.org/@golangcilint) and on [Twitter](https://twitter.com/golangci). +Follow the news and releases on [Mastodon](https://fosstodon.org/@golangcilint) and on [Bluesky](https://bsky.app/profile/golangcilint.bsky.social). + +`golangci-lint` is a free and open-source project built by volunteers. + +If you value it, consider supporting us, we appreciate it! ❤️ + +[![Open Collective backers and sponsors](https://img.shields.io/badge/OpenCollective-Donate-blue?logo=opencollective&style=for-the-badge)](https://opencollective.com/golangci-lint) +[![GitHub Sponsors](https://img.shields.io/badge/GitHub-Donate-blue?logo=github&style=for-the-badge)](https://github.com/sponsors/golangci) + +### v1.62.0 + +1. New linters + * Add `recvcheck` linter https://github.com/raeperd/recvcheck + * Add `iface` linter https://github.com/uudashr/iface +2. Updated linters + * ⚠️ `execinquery`: deprecation step 2 + * ⚠️ `gomnd`: deprecation step 2 (replaced by `mnd`) + * `bidichk`: from 0.2.7 to 0.3.2 (important performance improvement) + * `canonicalheader`: from 1.1.1 to 1.1.2 + * `cyclop`: from 1.2.1 to 1.2.3 + * `dupword`: from 0.1.1 to 0.1.3 + * `errcheck`: from 1.7.0 to 1.8.0 + * `errchkjson`: from 0.3.6 to 0.4.0 + * `errname`: from 0.1.13 to 1.0.0 + * `ginkgolinter`: from 0.17.0 to 0.18.0 (new option: `force-succeed`) + * `go-check-sumtype`: from 0.1.4 to 0.2.0 (new option: `default-signifies-exhaustive`) + * `go-critic`: from 0.11.4 to 0.11.5 + * `go-printf-func-name`: from 7558a9eaa5af to v0.1.0 + * `godot`: from 1.4.17 to 1.4.18 + * `gosec`: from 2.21.2 to 2.21.4 + * `intrange`: from 0.2.0 to 0.2.1 + * `loggercheck`: from 0.9.4 to 0.10.1 (`log/slog` support) + * `musttag`: from 0.12.2 to 0.13.0 + * `nakedret`: from 2.0.4 to 2.0.5 + * `nilnil`: from 0.1.9 to 1.0.0 (new option: `detect-opposite`) + * `noctx`: from 0.0.2 to 0.1.0 + * `protogetter`: from 0.3.6 to 0.3.8 + * `revive`: from 1.3.9 to 1.5.0 (new rules: `filename-format`, and `file-length-limit`) + * `tenv`: from 1.10.0 to 1.12.1 (handle dot import) + * `testifylint`: from 1.4.3 to 1.5.0 (new checkers: `contains`, `encoded-compare`, `regexp`) +3. Misc. + * Type sizing when cross-compiling (32-bit). + * code-climate: add check_name field + * Improve Go version detection + * Fix Go version propagation +4. Documentation + * Adds a section about `exclude-dirs-use-default` + * Improve 'install from sources' section + * Improve FAQ about Go versions + * Improve linter/rule/check docs + * Improve new linter section + * Improve `forbidigo` pattern examples for built-in functions ### v1.61.0 diff --git a/README.md b/README.md index 70052187afe8..35390cf4d31a 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,9 @@ Documentation is hosted at https://golangci-lint.run. ## Social Networks [![Join Slack](https://img.shields.io/badge/Slack-4285F4?logo=slack&logoColor=white)](https://gophers.slack.com/archives/CS0TBRKPC) -[![Follow on Mastodon](https://img.shields.io/badge/mastodon-6364FF?logo=mastodon&logoColor=white)](https://fosstodon.org/@golangcilint) -[![Follow on Twitter](https://img.shields.io/badge/twitter-1DA1F2?logo=twitter&logoColor=white)](https://twitter.com/golangci) +[![Follow on Mastodon](https://img.shields.io/badge/Mastodon-6364FF?logo=mastodon&logoColor=white)](https://fosstodon.org/@golangcilint) +[![Follow on Bluesky](https://img.shields.io/badge/Bluesky-0a7aff?logo=bluesky&logoColor=white)](https://bsky.app/profile/golangcilint.bsky.social) +[![Follow on Twitter](https://img.shields.io/badge/Twitter-1DA1F2?logo=x&logoColor=white)](https://twitter.com/golangci) ## Supporting Us diff --git a/assets/linters-info.json b/assets/linters-info.json index 7366356b78e6..d16feecd1b9f 100644 --- a/assets/linters-info.json +++ b/assets/linters-info.json @@ -2,19 +2,19 @@ { "name": "asasalint", "desc": "check for pass []any as any in variadic func(...any)", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs" ], "originalURL": "https://github.com/alingse/asasalint", "internal": false, "isSlow": true, - "since": "1.47.0" + "since": "v1.47.0" }, { "name": "asciicheck", "desc": "checks that all code identifiers does not have non-ASCII symbols in the name", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "bugs", "style" @@ -27,19 +27,19 @@ { "name": "bidichk", "desc": "Checks for dangerous unicode character sequences", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "bugs" ], "originalURL": "https://github.com/breml/bidichk", "internal": false, "isSlow": false, - "since": "1.43.0" + "since": "v1.43.0" }, { "name": "bodyclose", "desc": "checks whether HTTP response body is closed successfully", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "performance", "bugs" @@ -52,7 +52,7 @@ { "name": "canonicalheader", "desc": "canonicalheader checks whether net/http.Header uses canonical header", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], @@ -64,19 +64,19 @@ { "name": "containedctx", "desc": "containedctx is a linter that detects struct contained context.Context field", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], "originalURL": "https://github.com/sivchari/containedctx", "internal": false, "isSlow": true, - "since": "1.44.0" + "since": "v1.44.0" }, { "name": "contextcheck", "desc": "check whether the function uses a non-inherited context", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs" ], @@ -88,7 +88,7 @@ { "name": "copyloopvar", "desc": "copyloopvar is a linter detects places where loop variables are copied", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -100,7 +100,7 @@ { "name": "cyclop", "desc": "checks function and package cyclomatic complexity", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "complexity" ], @@ -112,7 +112,7 @@ { "name": "decorder", "desc": "check declaration order and count of types, constants, variables and functions", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "format", "style" @@ -125,7 +125,7 @@ { "name": "depguard", "desc": "Go linter that checks if package imports are in a list of acceptable packages", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style", "import", @@ -139,7 +139,7 @@ { "name": "dogsled", "desc": "Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -151,7 +151,7 @@ { "name": "dupl", "desc": "Tool for code clone detection", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -163,19 +163,19 @@ { "name": "dupword", "desc": "checks for duplicate words in the source code", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "comment" ], "originalURL": "https://github.com/Abirdcfly/dupword", "internal": false, "isSlow": false, - "since": "1.50.0" + "since": "v1.50.0" }, { "name": "durationcheck", "desc": "check for two durations multiplied together", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs" ], @@ -188,7 +188,7 @@ "name": "errcheck", "desc": "errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases", "enabledByDefault": true, - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs", "error" @@ -200,20 +200,20 @@ }, { "name": "errchkjson", - "desc": "Checks types passed to the json encoding functions. Reports unsupported types and reports occations, where the check for the returned error can be omitted.", - "loadMode": 575, + "desc": "Checks types passed to the json encoding functions. Reports unsupported types and reports occurrences where the check for the returned error can be omitted.", + "loadMode": 8767, "inPresets": [ "bugs" ], "originalURL": "https://github.com/breml/errchkjson", "internal": false, "isSlow": true, - "since": "1.44.0" + "since": "v1.44.0" }, { "name": "errname", "desc": "Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`.", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], @@ -225,7 +225,7 @@ { "name": "errorlint", "desc": "errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs", "error" @@ -235,26 +235,10 @@ "isSlow": true, "since": "v1.32.0" }, - { - "name": "execinquery", - "desc": "execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds", - "loadMode": 575, - "inPresets": [ - "sql" - ], - "originalURL": "https://github.com/1uf3/execinquery", - "internal": false, - "isSlow": true, - "since": "v1.46.0", - "deprecation": { - "since": "v1.58.0", - "message": "The repository of the linter has been archived by the owner." - } - }, { "name": "exhaustive", "desc": "check exhaustiveness of enum switch statements", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs" ], @@ -266,7 +250,7 @@ { "name": "exhaustruct", "desc": "Checks if all structure fields are initialized", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style", "test" @@ -279,7 +263,7 @@ { "name": "exportloopref", "desc": "checks for pointers to enclosing loop variables", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs" ], @@ -296,7 +280,7 @@ { "name": "forbidigo", "desc": "Forbids identifiers", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], @@ -308,7 +292,7 @@ { "name": "forcetypeassert", "desc": "finds forced type assertions", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -320,19 +304,19 @@ { "name": "fatcontext", "desc": "detects nested contexts in loops and function literals", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "performance" ], "originalURL": "https://github.com/Crocmagnon/fatcontext", "internal": false, "isSlow": true, - "since": "1.58.0" + "since": "v1.58.0" }, { "name": "funlen", "desc": "Tool for detection of long functions", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "complexity" ], @@ -344,7 +328,7 @@ { "name": "gci", "desc": "Gci controls Go package import order and makes it always deterministic.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "format", "import" @@ -358,7 +342,7 @@ { "name": "ginkgolinter", "desc": "enforces standards of using ginkgo and gomega", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], @@ -370,7 +354,7 @@ { "name": "gocheckcompilerdirectives", "desc": "Checks that go compiler directive comments (//go:) are valid.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "bugs" ], @@ -382,7 +366,7 @@ { "name": "gochecknoglobals", "desc": "Check that no global variables exist.", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], @@ -394,7 +378,7 @@ { "name": "gochecknoinits", "desc": "Checks that no init functions are present in Go code", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -405,7 +389,7 @@ { "name": "gochecksumtype", "desc": "Run exhaustiveness checks on Go \"sum types\"", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs" ], @@ -417,7 +401,7 @@ { "name": "gocognit", "desc": "Computes and checks the cognitive complexity of functions", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "complexity" ], @@ -429,7 +413,7 @@ { "name": "goconst", "desc": "Finds repeated strings that could be replaced by a constant", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -441,7 +425,7 @@ { "name": "gocritic", "desc": "Provides diagnostics that check for bugs, performance and style issues.\nExtensible without recompilation through dynamic rules.\nDynamic rules are written declaratively with AST patterns, filters, report message and optional suggestion.", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style", "metalinter" @@ -455,7 +439,7 @@ { "name": "gocyclo", "desc": "Computes and checks the cyclomatic complexity of functions", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "complexity" ], @@ -467,7 +451,7 @@ { "name": "godot", "desc": "Check if comments end in a period", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style", "comment" @@ -481,7 +465,7 @@ { "name": "godox", "desc": "Tool for detection of FIXME, TODO and other comment keywords", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style", "comment" @@ -494,7 +478,7 @@ { "name": "err113", "desc": "Go linter to check the errors handling expressions", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style", "error" @@ -510,7 +494,7 @@ { "name": "gofmt", "desc": "Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "format" ], @@ -523,7 +507,7 @@ { "name": "gofumpt", "desc": "Gofumpt checks whether code was gofumpt-ed.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "format" ], @@ -535,8 +519,8 @@ }, { "name": "goheader", - "desc": "Checks is file header matches to pattern", - "loadMode": 7, + "desc": "Checks if file header matches to pattern", + "loadMode": 8199, "inPresets": [ "style" ], @@ -549,7 +533,7 @@ { "name": "goimports", "desc": "Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "format", "import" @@ -563,7 +547,7 @@ { "name": "mnd", "desc": "An analyzer to detect magic numbers.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -572,27 +556,10 @@ "isSlow": false, "since": "v1.22.0" }, - { - "name": "gomnd", - "desc": "An analyzer to detect magic numbers.", - "loadMode": 7, - "inPresets": [ - "style" - ], - "originalURL": "https://github.com/tommy-muehle/go-mnd", - "internal": false, - "isSlow": false, - "since": "v1.22.0", - "deprecation": { - "since": "v1.58.0", - "message": "The linter has been renamed.", - "replacement": "mnd" - } - }, { "name": "gomoddirectives", "desc": "Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style", "module" @@ -605,7 +572,7 @@ { "name": "gomodguard", "desc": "Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style", "import", @@ -619,11 +586,11 @@ { "name": "goprintffuncname", "desc": "Checks that printf-like functions are named with `f` at the end.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], - "originalURL": "https://github.com/jirfag/go-printf-func-name", + "originalURL": "https://github.com/golangci/go-printf-func-name", "internal": false, "isSlow": false, "since": "v1.23.0" @@ -631,7 +598,7 @@ { "name": "gosec", "desc": "Inspects source code for security problems", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs" ], @@ -647,7 +614,7 @@ "name": "gosimple", "desc": "Linter for Go source code that specializes in simplifying code", "enabledByDefault": true, - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], @@ -662,7 +629,7 @@ { "name": "gosmopolitan", "desc": "Report certain i18n/l10n anti-patterns in your Go codebase", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs" ], @@ -675,7 +642,7 @@ "name": "govet", "desc": "Vet examines Go source code and reports suspicious constructs. It is roughly the same as 'go vet' and uses its passes.", "enabledByDefault": true, - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs", "metalinter" @@ -692,7 +659,7 @@ { "name": "grouper", "desc": "Analyze expression groups.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -701,10 +668,22 @@ "isSlow": false, "since": "v1.44.0" }, + { + "name": "iface", + "desc": "Detect the incorrect use of interfaces, helping developers avoid interface pollution.", + "loadMode": 8767, + "inPresets": [ + "style" + ], + "originalURL": "https://github.com/uudashr/iface", + "internal": false, + "isSlow": true, + "since": "v1.62.0" + }, { "name": "importas", "desc": "Enforces consistent import aliases", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], @@ -716,7 +695,7 @@ { "name": "inamedparam", "desc": "reports interfaces with unnamed method parameters", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -729,7 +708,7 @@ "name": "ineffassign", "desc": "Detects when assignments to existing variables are not used", "enabledByDefault": true, - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "unused" ], @@ -741,7 +720,7 @@ { "name": "interfacebloat", "desc": "A linter that checks the number of methods inside an interface.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -753,7 +732,7 @@ { "name": "intrange", "desc": "intrange is a linter to find places where for loops could make use of an integer range.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -765,7 +744,7 @@ { "name": "ireturn", "desc": "Accept Interfaces, Return Concrete Types", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], @@ -777,7 +756,7 @@ { "name": "lll", "desc": "Reports long lines", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -788,7 +767,7 @@ { "name": "loggercheck", "desc": "Checks key value pairs for common logger libraries (kitlog,klog,logr,zap).", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style", "bugs" @@ -804,7 +783,7 @@ { "name": "maintidx", "desc": "maintidx measures the maintainability index of each function.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "complexity" ], @@ -816,7 +795,7 @@ { "name": "makezero", "desc": "Finds slice declarations with non-zero initial length", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style", "bugs" @@ -829,7 +808,7 @@ { "name": "mirror", "desc": "reports wrong mirror patterns of bytes/strings usage", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], @@ -842,7 +821,7 @@ { "name": "misspell", "desc": "Finds commonly misspelled English words", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style", "comment" @@ -856,7 +835,7 @@ { "name": "musttag", "desc": "enforce field tags in (un)marshaled structs", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style", "bugs" @@ -869,7 +848,7 @@ { "name": "nakedret", "desc": "Checks that functions with naked returns are not longer than a maximum size (can be zero).", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -881,7 +860,7 @@ { "name": "nestif", "desc": "Reports deeply nested if statements", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "complexity" ], @@ -893,7 +872,7 @@ { "name": "nilerr", "desc": "Finds the code that returns nil even if it checks that the error is not nil.", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs" ], @@ -905,7 +884,7 @@ { "name": "nilnil", "desc": "Checks that there is no simultaneous return of `nil` error and an invalid value.", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], @@ -917,7 +896,7 @@ { "name": "nlreturn", "desc": "nlreturn checks for a new line before return and branch statements to increase code clarity", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -929,7 +908,7 @@ { "name": "noctx", "desc": "Finds sending http request without context.Context", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "performance", "bugs" @@ -942,7 +921,7 @@ { "name": "nonamedreturns", "desc": "Reports all named returns", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], @@ -954,7 +933,7 @@ { "name": "nosprintfhostport", "desc": "Checks for misuse of Sprintf to construct a host with port in a URL.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -966,7 +945,7 @@ { "name": "paralleltest", "desc": "Detects missing usage of t.Parallel() method in your Go test", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style", "test" @@ -979,7 +958,7 @@ { "name": "perfsprint", "desc": "Checks that fmt.Sprintf can be replaced with a faster alternative.", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "performance" ], @@ -991,7 +970,7 @@ { "name": "prealloc", "desc": "Finds slice declarations that could potentially be pre-allocated", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "performance" ], @@ -1003,7 +982,7 @@ { "name": "predeclared", "desc": "find code that shadows one of Go's predeclared identifiers", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -1015,7 +994,7 @@ { "name": "promlinter", "desc": "Check Prometheus metrics naming via promlint", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -1027,7 +1006,7 @@ { "name": "protogetter", "desc": "Reports direct reads from proto message fields when getters should be used", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs" ], @@ -1040,19 +1019,31 @@ { "name": "reassign", "desc": "Checks that package variables are not reassigned", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs" ], "originalURL": "https://github.com/curioswitch/go-reassign", "internal": false, "isSlow": true, - "since": "1.49.0" + "since": "v1.49.0" + }, + { + "name": "recvcheck", + "desc": "checks for receiver type consistency", + "loadMode": 8767, + "inPresets": [ + "bugs" + ], + "originalURL": "https://github.com/raeperd/recvcheck", + "internal": false, + "isSlow": true, + "since": "v1.62.0" }, { "name": "revive", "desc": "Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style", "metalinter" @@ -1065,7 +1056,7 @@ { "name": "rowserrcheck", "desc": "checks whether Rows.Err of rows is checked successfully", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs", "sql" @@ -1078,7 +1069,7 @@ { "name": "sloglint", "desc": "ensure consistent code style when using log/slog", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style", "format" @@ -1091,7 +1082,7 @@ { "name": "sqlclosecheck", "desc": "Checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed.", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs", "sql" @@ -1104,7 +1095,7 @@ { "name": "spancheck", "desc": "Checks for mistakes with OpenTelemetry/Census spans.", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs" ], @@ -1117,7 +1108,7 @@ "name": "staticcheck", "desc": "It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint.", "enabledByDefault": true, - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs", "metalinter" @@ -1133,7 +1124,7 @@ { "name": "stylecheck", "desc": "Stylecheck is a replacement for golint", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], @@ -1145,7 +1136,7 @@ { "name": "tagalign", "desc": "check that struct tags are well aligned", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style", "format" @@ -1159,7 +1150,7 @@ { "name": "tagliatelle", "desc": "Checks the struct tags.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -1171,7 +1162,7 @@ { "name": "tenv", "desc": "tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "test" ], @@ -1183,7 +1174,7 @@ { "name": "testableexamples", "desc": "linter checks if examples are testable (have an expected output)", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "test" ], @@ -1195,7 +1186,7 @@ { "name": "testifylint", "desc": "Checks usage of github.com/stretchr/testify.", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "test", "bugs" @@ -1208,7 +1199,7 @@ { "name": "testpackage", "desc": "linter that makes you use a separate _test package", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style", "test" @@ -1221,7 +1212,7 @@ { "name": "thelper", "desc": "thelper detects tests helpers which is not start with t.Helper() method.", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "test" ], @@ -1233,7 +1224,7 @@ { "name": "tparallel", "desc": "tparallel detects inappropriate usage of t.Parallel() method in your Go test codes.", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style", "test" @@ -1247,7 +1238,7 @@ "name": "typecheck", "desc": "Like the front-end of a Go compiler, parses and type-checks Go code", "enabledByDefault": true, - "loadMode": 7, + "loadMode": 8199, "internal": true, "isSlow": false, "since": "v1.3.0" @@ -1255,7 +1246,7 @@ { "name": "unconvert", "desc": "Remove unnecessary type conversions", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], @@ -1267,7 +1258,7 @@ { "name": "unparam", "desc": "Reports unused function parameters", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "unused" ], @@ -1280,7 +1271,7 @@ "name": "unused", "desc": "Checks Go code for unused constants, variables, functions and types", "enabledByDefault": true, - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "unused" ], @@ -1296,7 +1287,7 @@ { "name": "usestdlibvars", "desc": "A linter that detect the possibility to use variables/constants from the Go standard library.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -1308,7 +1299,7 @@ { "name": "varnamelen", "desc": "checks that the length of a variable's name matches its scope", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], @@ -1320,7 +1311,7 @@ { "name": "wastedassign", "desc": "Finds wasted assignment statements", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style" ], @@ -1332,7 +1323,7 @@ { "name": "whitespace", "desc": "Whitespace is a linter that checks for unnecessary newlines at the start and end of functions, if, for, etc.", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -1345,7 +1336,7 @@ { "name": "wrapcheck", "desc": "Checks that errors returned from external packages are wrapped", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "style", "error" @@ -1358,7 +1349,7 @@ { "name": "wsl", "desc": "add or remove empty lines", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], @@ -1370,7 +1361,7 @@ { "name": "zerologlint", "desc": "Detects the wrong usage of `zerolog` that a user forgets to dispatch with `Send` or `Msg`", - "loadMode": 575, + "loadMode": 8767, "inPresets": [ "bugs" ], @@ -1382,7 +1373,7 @@ { "name": "nolintlint", "desc": "Reports ill-formed or insufficient nolint directives", - "loadMode": 7, + "loadMode": 8199, "inPresets": [ "style" ], diff --git a/jsonschema/golangci.jsonschema.json b/jsonschema/golangci.jsonschema.json index 88c6eec6ef0b..5ccb898a57a7 100644 --- a/jsonschema/golangci.jsonschema.json +++ b/jsonschema/golangci.jsonschema.json @@ -13,18 +13,19 @@ "badLock", "badRegexp", "badSorting", + "badSyncOnceFunc", "boolExprSimplify", "builtinShadow", "builtinShadowDecl", "captLocal", "caseOrder", "codegenComment", + "commentFormatting", "commentedOutCode", "commentedOutImport", - "commentFormatting", "defaultCaseOrder", - "deferUnlambda", "deferInLoop", + "deferUnlambda", "deprecatedComment", "docStub", "dupArg", @@ -67,6 +68,7 @@ "preferStringWriter", "preferWriteByte", "ptrToRefParam", + "rangeAppendAll", "rangeExprCopy", "rangeValCopy", "redundantSprint", @@ -84,13 +86,12 @@ "sprintfQuotedString", "sqlQuery", "stringConcatSimplify", - "stringsCompare", "stringXbytes", - "suspiciousSorting", + "stringsCompare", "switchTrue", "syncMapLoadAndDelete", - "timeCmpSimplify", "timeExprSimplify", + "todoCommentWithoutDetail", "tooManyResultsChecker", "truncateCmp", "typeAssertChain", @@ -203,6 +204,7 @@ "structtag", "testinggoroutine", "tests", + "timeformat", "unmarshal", "unreachable", "unsafeptr", @@ -246,6 +248,8 @@ "errorf", "exported", "file-header", + "file-length-limit", + "filename-format", "flag-parameter", "function-length", "function-result-limit", @@ -293,6 +297,13 @@ "waitgroup-by-value" ] }, + "iface-analyzers": { + "enum": [ + "identical", + "unused", + "opaque" + ] + }, "linters": { "$comment": "anyOf with enum is used to allow auto completion of non-custom linters", "description": "Linters usable.", @@ -308,7 +319,6 @@ "contextcheck", "copyloopvar", "cyclop", - "deadcode", "decorder", "depguard", "dogsled", @@ -319,9 +329,7 @@ "errchkjson", "errname", "errorlint", - "execinquery", "exhaustive", - "exhaustivestruct", "exhaustruct", "exportloopref", "fatcontext", @@ -345,7 +353,6 @@ "gofumpt", "goheader", "goimports", - "golint", "gomoddirectives", "gomodguard", "goprintffuncname", @@ -354,19 +361,17 @@ "gosmopolitan", "govet", "grouper", - "ifshort", + "iface", "importas", "inamedparam", "ineffassign", "interfacebloat", - "interfacer", "intrange", "ireturn", "lll", "loggercheck", "maintidx", "makezero", - "maligned", "mirror", "misspell", "mnd", @@ -379,7 +384,6 @@ "noctx", "nolintlint", "nonamedreturns", - "nosnakecase", "nosprintfhostport", "paralleltest", "perfsprint", @@ -388,13 +392,12 @@ "promlinter", "protogetter", "reassign", + "recvcheck", "revive", "rowserrcheck", - "scopelint", "sloglint", "sqlclosecheck", "staticcheck", - "structcheck", "stylecheck", "tagalign", "tagliatelle", @@ -408,7 +411,6 @@ "unparam", "unused", "usestdlibvars", - "varcheck", "varnamelen", "wastedassign", "whitespace", @@ -1169,6 +1171,22 @@ "description": "Trigger a warning for variable assignments in ginkgo containers like `Describe`, `Context` and `When`, instead of in `BeforeEach()`.", "type": "boolean", "default": false + }, + "force-succeed": { + "description": "Force using the Succeed matcher for error functions, and the HaveOccurred matcher for non-function error values.", + "type": "boolean", + "default": false + } + } + }, + "gochecksumtype": { + "type": "object", + "additionalProperties": false, + "properties": { + "default-signifies-exhaustive": { + "description": "Presence of `default` case in switch statements satisfies exhaustiveness, if all members are not listed.", + "type": "boolean", + "default": true } } }, @@ -1908,6 +1926,37 @@ } } }, + "iface": { + "type": "object", + "additionalProperties": false, + "properties": { + "enable": { + "description": "Enable analyzers by name.", + "type": "array", + "items": { + "$ref": "#/definitions/iface-analyzers" + } + }, + "settings": { + "type": "object", + "additionalProperties": false, + "properties": { + "unused": { + "type": "object", + "additionalProperties": false, + "properties": { + "exclude": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + }, "importas": { "type": "object", "additionalProperties": false, @@ -2175,13 +2224,18 @@ "type": "object", "additionalProperties": false, "properties": { + "detect-opposite": { + "type": "boolean", + "description": "In addition, detect opposite situation (simultaneous return of non-nil error and valid value).", + "default": false + }, "checked-types": { "type": "array", "description": "List of return types to check.", "items": { - "enum": ["ptr", "func", "iface", "map", "chan", "uintptr", "unsafeptr"] + "enum": ["chan", "func", "iface", "map", "ptr", "uintptr", "unsafeptr"] }, - "default": ["ptr", "func", "iface", "map", "chan", "uintptr", "unsafeptr"] + "default": ["chan", "func", "iface", "map", "ptr", "uintptr", "unsafeptr"] } } }, @@ -2892,7 +2946,9 @@ "blank-import", "bool-compare", "compares", + "contains", "empty", + "encoded-compare", "error-is-as", "error-nil", "expected-actual", @@ -2902,6 +2958,7 @@ "len", "negative-positive", "nil-compare", + "regexp", "require-error", "suite-broken-parallel", "suite-dont-use-pkg", @@ -2915,16 +2972,19 @@ "blank-import", "bool-compare", "compares", + "contains", "empty", + "encoded-compare", "error-is-as", "error-nil", "expected-actual", "float-compare", - "float-compare", + "formatter", "go-require", "len", "negative-positive", "nil-compare", + "regexp", "require-error", "suite-broken-parallel", "suite-dont-use-pkg", @@ -2941,7 +3001,9 @@ "blank-import", "bool-compare", "compares", + "contains", "empty", + "encoded-compare", "error-is-as", "error-nil", "expected-actual", @@ -2951,6 +3013,7 @@ "len", "negative-positive", "nil-compare", + "regexp", "require-error", "suite-broken-parallel", "suite-dont-use-pkg", diff --git a/jsonschema/golangci.v1.61.jsonschema.json b/jsonschema/golangci.v1.61.jsonschema.json new file mode 100644 index 000000000000..88c6eec6ef0b --- /dev/null +++ b/jsonschema/golangci.v1.61.jsonschema.json @@ -0,0 +1,3770 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://json.schemastore.org/golangci-lint.json", + "definitions": { + "gocritic-checks": { + "enum": [ + "appendAssign", + "appendCombine", + "argOrder", + "assignOp", + "badCall", + "badCond", + "badLock", + "badRegexp", + "badSorting", + "boolExprSimplify", + "builtinShadow", + "builtinShadowDecl", + "captLocal", + "caseOrder", + "codegenComment", + "commentedOutCode", + "commentedOutImport", + "commentFormatting", + "defaultCaseOrder", + "deferUnlambda", + "deferInLoop", + "deprecatedComment", + "docStub", + "dupArg", + "dupBranchBody", + "dupCase", + "dupImport", + "dupSubExpr", + "dynamicFmtString", + "elseif", + "emptyDecl", + "emptyFallthrough", + "emptyStringTest", + "equalFold", + "evalOrder", + "exitAfterDefer", + "exposedSyncMutex", + "externalErrorReassign", + "filepathJoin", + "flagDeref", + "flagName", + "hexLiteral", + "httpNoBody", + "hugeParam", + "ifElseChain", + "importShadow", + "indexAlloc", + "initClause", + "ioutilDeprecated", + "mapKey", + "methodExprCall", + "nestingReduce", + "newDeref", + "nilValReturn", + "octalLiteral", + "offBy1", + "paramTypeCombine", + "preferDecodeRune", + "preferFilepathJoin", + "preferFprint", + "preferStringWriter", + "preferWriteByte", + "ptrToRefParam", + "rangeExprCopy", + "rangeValCopy", + "redundantSprint", + "regexpMust", + "regexpPattern", + "regexpSimplify", + "returnAfterHttpError", + "ruleguard", + "singleCaseSwitch", + "sliceClear", + "sloppyLen", + "sloppyReassign", + "sloppyTypeAssert", + "sortSlice", + "sprintfQuotedString", + "sqlQuery", + "stringConcatSimplify", + "stringsCompare", + "stringXbytes", + "suspiciousSorting", + "switchTrue", + "syncMapLoadAndDelete", + "timeCmpSimplify", + "timeExprSimplify", + "tooManyResultsChecker", + "truncateCmp", + "typeAssertChain", + "typeDefFirst", + "typeSwitchVar", + "typeUnparen", + "uncheckedInlineErr", + "underef", + "unlabelStmt", + "unlambda", + "unnamedResult", + "unnecessaryBlock", + "unnecessaryDefer", + "unslice", + "valSwap", + "weakCond", + "whyNoLint", + "wrapperFunc", + "yodaStyleExpr" + ] + }, + "gocritic-tags": { + "enum": [ + "diagnostic", + "style", + "performance", + "experimental", + "opinionated", + "security" + ] + }, + "gosec-rules": { + "enum": [ + "G101", + "G102", + "G103", + "G104", + "G106", + "G107", + "G108", + "G109", + "G110", + "G111", + "G112", + "G113", + "G114", + "G115", + "G201", + "G202", + "G203", + "G204", + "G301", + "G302", + "G303", + "G304", + "G305", + "G306", + "G307", + "G401", + "G402", + "G403", + "G404", + "G405", + "G406", + "G501", + "G502", + "G503", + "G504", + "G505", + "G506", + "G507", + "G601", + "G602" + ] + }, + "govet-analyzers": { + "enum": [ + "appends", + "asmdecl", + "assign", + "atomic", + "atomicalign", + "bools", + "buildtag", + "cgocall", + "composites", + "copylocks", + "deepequalerrors", + "defers", + "directive", + "errorsas", + "fieldalignment", + "findcall", + "framepointer", + "httpresponse", + "ifaceassert", + "loopclosure", + "lostcancel", + "nilfunc", + "nilness", + "printf", + "reflectvaluecompare", + "shadow", + "shift", + "sigchanyzer", + "slog", + "sortslice", + "stdmethods", + "stringintconv", + "structtag", + "testinggoroutine", + "tests", + "unmarshal", + "unreachable", + "unsafeptr", + "unusedresult", + "unusedwrite" + ] + }, + "revive-rules": { + "enum": [ + "add-constant", + "argument-limit", + "atomic", + "banned-characters", + "bare-return", + "blank-imports", + "bool-literal-in-expr", + "call-to-gc", + "cognitive-complexity", + "comment-spacings", + "comments-density", + "confusing-naming", + "confusing-results", + "constant-logical-expr", + "context-as-argument", + "context-keys-type", + "cyclomatic", + "datarace", + "deep-exit", + "defer", + "dot-imports", + "duplicated-imports", + "early-return", + "empty-block", + "empty-lines", + "enforce-map-style", + "enforce-repeated-arg-type-style", + "enforce-slice-style", + "error-naming", + "error-return", + "error-strings", + "errorf", + "exported", + "file-header", + "flag-parameter", + "function-length", + "function-result-limit", + "get-return", + "identical-branches", + "if-return", + "import-alias-naming", + "import-shadowing", + "imports-blocklist", + "increment-decrement", + "indent-error-flow", + "line-length-limit", + "max-control-nesting", + "max-public-structs", + "modifies-parameter", + "modifies-value-receiver", + "nested-structs", + "optimize-operands-order", + "package-comments", + "range", + "range-val-address", + "range-val-in-closure", + "receiver-naming", + "redefines-builtin-id", + "redundant-import-alias", + "string-format", + "string-of-int", + "struct-tag", + "superfluous-else", + "time-equal", + "time-naming", + "unchecked-type-assertion", + "unconditional-recursion", + "unexported-naming", + "unexported-return", + "unhandled-error", + "unnecessary-stmt", + "unreachable-code", + "unused-parameter", + "unused-receiver", + "use-any", + "useless-break", + "var-declaration", + "var-naming", + "waitgroup-by-value" + ] + }, + "linters": { + "$comment": "anyOf with enum is used to allow auto completion of non-custom linters", + "description": "Linters usable.", + "anyOf": [ + { + "enum": [ + "asasalint", + "asciicheck", + "bidichk", + "bodyclose", + "canonicalheader", + "containedctx", + "contextcheck", + "copyloopvar", + "cyclop", + "deadcode", + "decorder", + "depguard", + "dogsled", + "dupl", + "dupword", + "durationcheck", + "errcheck", + "errchkjson", + "errname", + "errorlint", + "execinquery", + "exhaustive", + "exhaustivestruct", + "exhaustruct", + "exportloopref", + "fatcontext", + "forbidigo", + "forcetypeassert", + "funlen", + "gci", + "ginkgolinter", + "gocheckcompilerdirectives", + "gochecknoglobals", + "gochecknoinits", + "gochecksumtype", + "gocognit", + "goconst", + "gocritic", + "gocyclo", + "godot", + "godox", + "err113", + "gofmt", + "gofumpt", + "goheader", + "goimports", + "golint", + "gomoddirectives", + "gomodguard", + "goprintffuncname", + "gosec", + "gosimple", + "gosmopolitan", + "govet", + "grouper", + "ifshort", + "importas", + "inamedparam", + "ineffassign", + "interfacebloat", + "interfacer", + "intrange", + "ireturn", + "lll", + "loggercheck", + "maintidx", + "makezero", + "maligned", + "mirror", + "misspell", + "mnd", + "musttag", + "nakedret", + "nestif", + "nilerr", + "nilnil", + "nlreturn", + "noctx", + "nolintlint", + "nonamedreturns", + "nosnakecase", + "nosprintfhostport", + "paralleltest", + "perfsprint", + "prealloc", + "predeclared", + "promlinter", + "protogetter", + "reassign", + "revive", + "rowserrcheck", + "scopelint", + "sloglint", + "sqlclosecheck", + "staticcheck", + "structcheck", + "stylecheck", + "tagalign", + "tagliatelle", + "tenv", + "testableexamples", + "testifylint", + "testpackage", + "thelper", + "tparallel", + "unconvert", + "unparam", + "unused", + "usestdlibvars", + "varcheck", + "varnamelen", + "wastedassign", + "whitespace", + "wrapcheck", + "wsl", + "zerologlint" + ] + }, + { + "type": "string" + } + ] + } + }, + "type": "object", + "additionalProperties": false, + "properties": { + "run": { + "description": "Options for analysis running,", + "type": "object", + "additionalProperties": false, + "properties": { + "concurrency": { + "description": "Number of concurrent runners. Defaults to the number of available CPU cores.", + "type": "integer", + "minimum": 0, + "examples": [4] + }, + "timeout": { + "description": "Timeout for the analysis.", + "type": "string", + "pattern": "^\\d*[sm]$", + "default": "1m", + "examples": ["30s", "5m"] + }, + "issues-exit-code": { + "description": "Exit code when at least one issue was found.", + "type": "integer", + "default": 1 + }, + "tests": { + "description": "Enable inclusion of test files.", + "type": "boolean", + "default": true + }, + "build-tags": { + "description": "List of build tags to pass to all linters.", + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "examples": [["mytag"]] + }, + "modules-download-mode": { + "description": "Option to pass to \"go list -mod={option}\".\nSee \"go help modules\" for more information.", + "enum": ["mod", "readonly", "vendor"] + }, + "allow-parallel-runners": { + "description": "Allow multiple parallel golangci-lint instances running. If disabled, golangci-lint acquires file lock on start.", + "type": "boolean", + "default": false + }, + "allow-serial-runners": { + "description": "Allow multiple golangci-lint instances running, but serialize them around a lock.", + "type": "boolean", + "default": false + }, + "go": { + "description": "Targeted Go version.", + "type": "string", + "default": "1.17" + } + } + }, + "output": { + "description": "Output configuration options.", + "type": "object", + "additionalProperties": false, + "properties": { + "formats": { + "description": "Output formats to use.", + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "path": { + "default": "stdout", + "anyOf": [ + { + "enum": [ "stdout", "stderr" ] + }, + { + "type": "string" + } + ] + }, + "format": { + "default": "colored-line-number", + "enum": [ + "colored-line-number", + "line-number", + "json", + "colored-tab", + "tab", + "html", + "checkstyle", + "code-climate", + "junit-xml", + "junit-xml-extended", + "github-actions", + "teamcity", + "sarif" + ] + } + }, + "required": ["format"] + } + }, + "print-issued-lines": { + "description": "Print lines of code with issue.", + "type": "boolean", + "default": true + }, + "print-linter-name": { + "description": "Print linter name in the end of issue text.", + "type": "boolean", + "default": true + }, + "uniq-by-line": { + "description": "Make issues output unique by line.", + "type": "boolean", + "default": true + }, + "path-prefix": { + "description": "Add a prefix to the output file references.", + "type": "string", + "default": "" + }, + "show-stats": { + "description": "Show statistics per linter.", + "type": "boolean", + "default": false + }, + "sort-order": { + "type": "array", + "items": { + "enum": ["linter", "severity", "file"] + } + }, + "sort-results": { + "description": "Sort results by: filepath, line and column.", + "type": "boolean", + "default": true + } + } + }, + "linters-settings": { + "description": "All available settings of specific linters.", + "type": "object", + "additionalProperties": false, + "properties": { + "dupword": { + "type": "object", + "additionalProperties": false, + "properties": { + "keywords": { + "description": "Keywords for detecting duplicate words. If this list is not empty, only the words defined in this list will be detected.", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "examples": ["the", "and", "a"] + } + }, + "ignore": { + "description": "Keywords used to ignore detection.", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "examples": ["0C0C"] + } + } + } + }, + "asasalint": { + "type": "object", + "additionalProperties": false, + "properties": { + "exclude": { + "description": "To specify a set of function names to exclude.", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "examples": ["\\.Wrapf"] + } + }, + "use-builtin-exclusions": { + "description": "To enable/disable the asasalint builtin exclusions of function names.", + "type": "boolean", + "default": true + }, + "ignore-test": { + "description": "Ignore *_test.go files.", + "type": "boolean", + "default": false + } + } + }, + "bidichk": { + "type": "object", + "additionalProperties": false, + "properties": { + "left-to-right-embedding": { + "description": "Disallow: LEFT-TO-RIGHT-EMBEDDING", + "type": "boolean", + "default": false + }, + "right-to-left-embedding": { + "description": "Disallow: RIGHT-TO-LEFT-EMBEDDING", + "type": "boolean", + "default": false + }, + "pop-directional-formatting": { + "description": "Disallow: POP-DIRECTIONAL-FORMATTING", + "type": "boolean", + "default": false + }, + "left-to-right-override": { + "description": "Disallow: LEFT-TO-RIGHT-OVERRIDE", + "type": "boolean", + "default": false + }, + "right-to-left-override": { + "description": "Disallow: RIGHT-TO-LEFT-OVERRIDE", + "type": "boolean", + "default": false + }, + "left-to-right-isolate": { + "description": "Disallow: LEFT-TO-RIGHT-ISOLATE", + "type": "boolean", + "default": false + }, + "right-to-left-isolate": { + "description": "Disallow: RIGHT-TO-LEFT-ISOLATE", + "type": "boolean", + "default": false + }, + "first-strong-isolate": { + "description": "Disallow: FIRST-STRONG-ISOLATE", + "type": "boolean", + "default": false + }, + "pop-directional-isolate": { + "description": "Disallow: POP-DIRECTIONAL-ISOLATE", + "type": "boolean", + "default": false + } + } + }, + "cyclop": { + "type": "object", + "additionalProperties": false, + "properties": { + "skip-tests": { + "description": "Should the linter execute on test files as well", + "type": "boolean", + "default": false + }, + "max-complexity": { + "description": "Max complexity the function can have", + "type": "integer", + "default": 10, + "minimum": 0 + }, + "package-average": { + "description": "Max average complexity in package", + "type": "number", + "default": 0, + "minimum": 0 + } + } + }, + "decorder": { + "type": "object", + "additionalProperties": false, + "properties": { + "dec-order": { + "type": "array", + "default": [["type", "const", "var", "func"]], + "items": { + "enum": ["type", "const", "var", "func"] + } + }, + "ignore-underscore-vars": { + "description": "Underscore vars (vars with \"_\" as the name) will be ignored at all checks", + "default": true, + "type": "boolean" + }, + "disable-dec-order-check": { + "description": "Order of declarations is not checked", + "default": true, + "type": "boolean" + }, + "disable-init-func-first-check": { + "description": "Allow init func to be anywhere in file", + "default": true, + "type": "boolean" + }, + "disable-dec-num-check": { + "description": "Multiple global type, const and var declarations are allowed", + "default": true, + "type": "boolean" + }, + "disable-type-dec-num-check": { + "description": "Type declarations will be ignored for dec num check", + "default": true, + "type": "boolean" + }, + "disable-const-dec-num-check": { + "description": "Const declarations will be ignored for dec num check", + "default": true, + "type": "boolean" + }, + "disable-var-dec-num-check": { + "description": "Var declarations will be ignored for dec num check", + "default": true, + "type": "boolean" + } + } + }, + "depguard": { + "type": "object", + "additionalProperties": false, + "properties": { + "rules": { + "description": "Rules to apply.", + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^[^.]+$": { + "description": "Name of a rule.", + "type": "object", + "additionalProperties": false, + "properties": { + "list-mode": { + "description": "Used to determine the package matching priority.", + "enum": ["original", "strict", "lax"], + "default": "original" + }, + "files": { + "description": "List of file globs that will match this list of settings to compare against.", + "additionalProperties": false, + "type": "array", + "items": { + "type": "string" + } + }, + "allow": { + "description": "List of allowed packages.", + "additionalProperties": false, + "type": "array", + "items": { + "type": "string" + } + }, + "deny": { + "description": "Packages that are not allowed where the value is a suggestion.", + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "desc": { + "description": "Description", + "type": "string" + }, + "pkg": { + "description": "Package", + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "dogsled": { + "type": "object", + "additionalProperties": false, + "properties": { + "max-blank-identifiers": { + "description": "Check assignments with too many blank identifiers.", + "type": "integer", + "default": 2, + "minimum": 0 + } + } + }, + "dupl": { + "type": "object", + "additionalProperties": false, + "properties": { + "threshold": { + "description": "Tokens count to trigger issue.", + "type": "integer", + "default": 150, + "minimum": 0 + } + } + }, + "errcheck": { + "type": "object", + "additionalProperties": false, + "properties": { + "check-type-assertions": { + "description": "Report about not checking errors in type assertions, i.e.: `a := b.(MyStruct)`", + "type": "boolean", + "default": false + }, + "check-blank": { + "description": "Report about assignment of errors to blank identifier", + "type": "boolean", + "default": false + }, + "exclude-functions": { + "description": "List of functions to exclude from checking, where each entry is a single function to exclude", + "type": "array", + "examples": ["io/ioutil.ReadFile", "io.Copy(*bytes.Buffer)"], + "items": { + "type": "string" + } + }, + "disable-default-exclusions": { + "description": "To disable the errcheck built-in exclude list", + "type": "boolean", + "default": false + } + } + }, + "errchkjson": { + "type": "object", + "additionalProperties": false, + "properties": { + "check-error-free-encoding": { + "type": "boolean", + "default": false + }, + "report-no-exported": { + "description": "Issue on struct that doesn't have exported fields.", + "type": "boolean", + "default": false + } + } + }, + "errorlint": { + "type": "object", + "additionalProperties": false, + "properties": { + "errorf": { + "description": "Check whether fmt.Errorf uses the %w verb for formatting errors", + "type": "boolean", + "default": true + }, + "errorf-multi": { + "description": "Permit more than 1 %w verb, valid per Go 1.20", + "type": "boolean", + "default": true + }, + "asserts": { + "description": "Check for plain type assertions and type switches.", + "type": "boolean", + "default": true + }, + "comparison": { + "description": "Check for plain error comparisons", + "type": "boolean", + "default": true + }, + "allowed-errors": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "err": { + "type": "string" + }, + "fun": { + "type": "string" + } + } + } + }, + "allowed-errors-wildcard": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "err": { + "type": "string" + }, + "fun": { + "type": "string" + } + } + } + } + } + }, + "exhaustive": { + "type": "object", + "additionalProperties": false, + "properties": { + "check": { + "description": "Program elements to check for exhaustiveness.", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "examples": ["switch", "map"] + } + }, + "check-generated": { + "description": "Check switch statements in generated files", + "type": "boolean", + "default": false + }, + "explicit-exhaustive-switch": { + "description": "Only run exhaustive check on switches with \"//exhaustive:enforce\" comment.", + "type": "boolean", + "default": false + }, + "explicit-exhaustive-map": { + "description": "Only run exhaustive check on map literals with \"//exhaustive:enforce\" comment.", + "type": "boolean", + "default": false + }, + "default-case-required": { + "description": "Switch statement requires default case even if exhaustive.", + "type": "boolean", + "default": false + }, + "default-signifies-exhaustive": { + "description": "Presence of `default` case in switch statements satisfies exhaustiveness, even if all enum members are not listed.", + "type": "boolean", + "default": false + }, + "ignore-enum-members": { + "description": "Enum members matching `regex` do not have to be listed in switch statements to satisfy exhaustiveness", + "type": "string" + }, + "ignore-enum-types": { + "description": "Enum types matching the supplied regex do not have to be listed in switch statements to satisfy exhaustiveness.", + "type": "string" + }, + "package-scope-only": { + "description": "Consider enums only in package scopes, not in inner scopes.", + "type": "boolean", + "default": false + } + } + }, + "exhaustruct": { + "type": "object", + "additionalProperties": false, + "properties": { + "include": { + "description": "List of regular expressions to match struct packages and names.", + "type": "array", + "examples": [".*\\.Test"], + "items": { + "type": "string" + } + }, + "exclude": { + "description": "List of regular expressions to exclude struct packages and names from check.", + "type": "array", + "examples": ["cobra\\.Command$"], + "items": { + "type": "string" + } + } + } + }, + "forbidigo": { + "type": "object", + "additionalProperties": false, + "properties": { + "exclude-godoc-examples": { + "description": "Exclude code in godoc examples.", + "type": "boolean", + "default": true + }, + "analyze-types": { + "description": "Instead of matching the literal source code, use type information to replace expressions with strings that contain the package name and (for methods and fields) the type name.", + "type": "boolean", + "default": true + }, + "forbid": { + "description": "List of identifiers to forbid (written using `regexp`)", + "type": "array", + "examples": ["^print(ln)?$"], + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "p": { + "description": "Pattern", + "type": "string" + }, + "pkg": { + "description": "Package", + "type": "string" + }, + "msg": { + "description": "Message", + "type": "string" + } + } + } + ] + } + } + } + }, + "funlen": { + "type": "object", + "additionalProperties": false, + "properties": { + "lines": { + "description": "Limit lines number per function.", + "type": "integer", + "default": 60 + }, + "statements": { + "description": "Limit statements number per function.", + "type": "integer", + "default": 40 + }, + "ignore-comments": { + "description": "Ignore comments when counting lines.", + "type": "boolean", + "default": false + } + } + }, + "gci": { + "type": "object", + "additionalProperties": false, + "properties": { + "sections": { + "description": "Section configuration to compare against.", + "type": "array", + "items": { + "anyOf": [ + { + "enum": [ + "standard", + "default", + "blank", + "dot", + "alias", + "localmodule" + ] + }, + { + "type": "string" + } + ] + }, + "default": ["standard", "default"] + }, + "skip-generated": { + "description": "Skip generated files.", + "type": "boolean", + "default": true + }, + "custom-order": { + "description": "Enable custom order of sections.", + "type": "boolean", + "default": false + }, + "no-lex-order": { + "description": "Drops lexical ordering for custom sections.", + "type": "boolean", + "default": false + } + } + }, + "ginkgolinter": { + "type": "object", + "additionalProperties": false, + "properties": { + "suppress-len-assertion": { + "description": "Suppress the wrong length assertion warning.", + "type": "boolean", + "default": false + }, + "suppress-nil-assertion": { + "description": "Suppress the wrong nil assertion warning.", + "type": "boolean", + "default": false + }, + "suppress-err-assertion": { + "description": "Suppress the wrong error assertion warning.", + "type": "boolean", + "default": false + }, + "suppress-compare-assertion": { + "description": "Suppress the wrong comparison assertion warning.", + "type": "boolean", + "default": false + }, + "suppress-async-assertion": { + "description": "Suppress the function all in async assertion warning.", + "type": "boolean", + "default": false + }, + "suppress-type-compare-assertion": { + "description": "Suppress warning for comparing values from different types, like int32 and uint32.", + "type": "boolean", + "default": false + }, + "forbid-focus-container": { + "description": "Trigger warning for ginkgo focus containers like FDescribe, FContext, FWhen or FIt.", + "type": "boolean", + "default": false + }, + "allow-havelen-zero": { + "description": "Don't trigger warnings for HaveLen(0).", + "type": "boolean", + "default": false + }, + "force-expect-to": { + "description": "Force using `Expect` with `To`, `ToNot` or `NotTo`", + "type": "boolean", + "default": false + }, + "validate-async-intervals": { + "description": "Best effort validation of async intervals (timeout and polling).", + "type": "boolean", + "default": false + }, + "forbid-spec-pollution": { + "description": "Trigger a warning for variable assignments in ginkgo containers like `Describe`, `Context` and `When`, instead of in `BeforeEach()`.", + "type": "boolean", + "default": false + } + } + }, + "gocognit": { + "type": "object", + "additionalProperties": false, + "properties": { + "min-complexity": { + "description": "Minimal code complexity to report (we recommend 10-20).", + "type": "integer", + "default": 30 + } + } + }, + "goconst": { + "type": "object", + "additionalProperties": false, + "properties": { + "match-constant": { + "description": "Look for existing constants matching the values", + "type": "boolean", + "default": true + }, + "min-len": { + "description": "Minimum length of string constant.", + "type": "integer", + "default": 3 + }, + "min-occurrences": { + "description": "Minimum occurrences count to trigger.", + "type": "integer", + "default": 3 + }, + "ignore-tests": { + "description": "Ignore test files.", + "type": "boolean", + "default": false + }, + "ignore-calls": { + "description": "Ignore when constant is not used as function argument", + "type": "boolean", + "default": true + }, + "ignore-strings": { + "description": "Exclude strings matching the given regular expression", + "type": "string" + }, + "numbers": { + "description": "Search also for duplicated numbers.", + "type": "boolean", + "default": false + }, + "min": { + "description": "Minimum value, only works with `numbers`", + "type": "integer", + "default": 3 + }, + "max": { + "description": "Maximum value, only works with `numbers`", + "type": "integer", + "default": 3 + } + } + }, + "gocritic": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled-checks": { + "description": "Which checks should be enabled. By default, a list of stable checks is used. To see it, run `GL_DEBUG=gocritic golangci-lint run`.", + "type": "array", + "items": { + "$ref": "#/definitions/gocritic-checks" + } + }, + "disabled-checks": { + "description": "Which checks should be disabled.", + "type": "array", + "items": { + "$ref": "#/definitions/gocritic-checks" + }, + "default": [] + }, + "enabled-tags": { + "description": "Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.", + "type": "array", + "items": { + "$ref": "#/definitions/gocritic-tags" + } + }, + "disabled-tags": { + "description": "Disable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.", + "type": "array", + "items": { + "$ref": "#/definitions/gocritic-tags" + } + }, + "settings": { + "description": "Settings passed to gocritic. Properties must be valid and enabled check names.", + "type": "object", + "additionalProperties": false, + "properties": { + "captLocal": { + "type": "object", + "additionalProperties": false, + "properties": { + "paramsOnly" : { + "type": "boolean", + "default": true + } + } + }, + "commentedOutCode": { + "type": "object", + "additionalProperties": false, + "properties": { + "minLength" : { + "type": "number", + "default": 15 + } + } + }, + "elseif": { + "type": "object", + "additionalProperties": false, + "properties": { + "skipBalanced" : { + "type": "boolean", + "default": true + } + } + }, + "hugeParam": { + "type": "object", + "additionalProperties": false, + "properties": { + "sizeThreshold" : { + "type": "number", + "default": 80 + } + } + }, + "ifElseChain": { + "type": "object", + "additionalProperties": false, + "properties": { + "minThreshold" : { + "type": "number", + "default": 2 + } + } + }, + "nestingReduce": { + "type": "object", + "additionalProperties": false, + "properties": { + "bodyWidth" : { + "type": "number", + "default": 5 + } + } + }, + "rangeExprCopy": { + "type": "object", + "additionalProperties": false, + "properties": { + "sizeThreshold" : { + "type": "number", + "default": 512 + }, + "skipTestFuncs" : { + "type": "boolean", + "default": true + } + } + }, + "rangeValCopy": { + "type": "object", + "additionalProperties": false, + "properties": { + "sizeThreshold" : { + "type": "number", + "default": 128 + }, + "skipTestFuncs" : { + "type": "boolean", + "default": true + } + } + }, + "ruleguard": { + "type": "object", + "additionalProperties": false, + "properties": { + "debug" : { + "type": "string" + }, + "enable" : { + "type": "string" + }, + "disable" : { + "type": "string" + }, + "failOn" : { + "type": "string" + }, + "rules" : { + "type": "string" + } + } + }, + "tooManyResultsChecker": { + "type": "object", + "additionalProperties": false, + "properties": { + "maxResults" : { + "type": "number", + "default": 5 + } + } + }, + "truncateCmp": { + "type": "object", + "additionalProperties": false, + "properties": { + "skipArchDependent" : { + "type": "boolean", + "default": true + } + } + }, + "underef": { + "type": "object", + "additionalProperties": false, + "properties": { + "skipRecvDeref" : { + "type": "boolean", + "default": true + } + } + }, + "unnamedResult": { + "type": "object", + "additionalProperties": false, + "properties": { + "checkExported" : { + "type": "boolean", + "default": false + } + } + } + } + }, + "disable-all": { + "type": "boolean", + "default": false + }, + "enable-all": { + "type": "boolean", + "default": false + } + } + }, + "gocyclo": { + "type": "object", + "additionalProperties": false, + "properties": { + "min-complexity": { + "description": "Minimum code complexity to report (we recommend 10-20).", + "type": "integer", + "default": 30 + } + } + }, + "godot": { + "type": "object", + "additionalProperties": false, + "properties": { + "scope": { + "description": "Comments to be checked.", + "enum": ["declarations", "toplevel", "all"], + "default": "declarations" + }, + "exclude": { + "description": "List of regexps for excluding particular comment lines from check.", + "type": "array", + "items": { + "type": "string" + } + }, + "period": { + "description": "Check that each sentence ends with a period.", + "type": "boolean", + "default": true + }, + "capital": { + "description": "Check that each sentence starts with a capital letter.", + "type": "boolean", + "default": false + }, + "check-all": { + "description": "DEPRECATED: Check all top-level comments, not only declarations.", + "type": "boolean", + "default": false + } + } + }, + "godox": { + "type": "object", + "additionalProperties": false, + "properties": { + "keywords": { + "description": "Report any comments starting with one of these keywords. This is useful for TODO or FIXME comments that might be left in the code accidentally and should be resolved before merging.", + "type": "array", + "items": { + "type": "string" + }, + "default": ["TODO", "BUG", "FIXME"] + } + } + }, + "gofmt": { + "type": "object", + "additionalProperties": false, + "properties": { + "simplify": { + "description": "Simplify code.", + "type": "boolean", + "default": true + }, + "rewrite-rules": { + "description": "Apply the rewrite rules to the source before reformatting.", + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "pattern": { + "type": "string" + }, + "replacement": { + "type": "string" + } + } + } + } + } + }, + "interfacebloat": { + "type": "object", + "additionalProperties": false, + "properties": { + "max": { + "description": "The maximum number of methods allowed for an interface.", + "type": "integer" + } + } + }, + "gofumpt": { + "type": "object", + "additionalProperties": false, + "properties": { + "extra-rules": { + "description": "Choose whether or not to use the extra rules that are disabled by default.", + "type": "boolean", + "default": false + }, + "module-path": { + "description": " Module path which contains the source code being formatted.", + "type": "string" + } + } + }, + "goheader": { + "type": "object", + "additionalProperties": false, + "properties": { + "values": { + "type": "object", + "additionalProperties": false, + "properties": { + "const": { + "description": "Constants to use in the template.", + "type": "object", + "patternProperties": { + "^.+$": { + "description": "Value for the constant.", + "type": "string" + } + }, + "additionalProperties": false, + "examples": [ + { + "YEAR": "2030", + "COMPANY": "MY FUTURISTIC COMPANY" + } + ] + }, + "regexp": { + "description": "Regular expressions to use in your template.", + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^.+$": { + "type": "string" + } + }, + "examples": [ + { + "AUTHOR": ".*@mycompany\\.com" + } + ] + } + } + }, + "template": { + "description": "Template to put on top of every file.", + "type": "string", + "examples": [ + "{{ MY COMPANY }}\nSPDX-License-Identifier: Apache-2.0\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at:\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License." + ] + }, + "template-path": { + "description": "Path to the file containing the template source.", + "type": "string", + "examples": ["my_header_template.txt"] + } + }, + "oneOf": [ + { "required": ["template"] }, + { "required": ["template-path"] } + ] + }, + "goimports": { + "type": "object", + "additionalProperties": false, + "properties": { + "local-prefixes": { + "description": "Put imports beginning with prefix after 3rd-party packages. It is a comma-separated list of prefixes.", + "type": "string", + "examples": ["github.com/org/project"] + } + } + }, + "gomoddirectives": { + "type": "object", + "additionalProperties": false, + "properties": { + "replace-local": { + "description": "Allow local `replace` directives.", + "type": "boolean", + "default": true + }, + "replace-allow-list": { + "description": "List of allowed `replace` directives.", + "type": "array", + "items": { + "type": "string" + } + }, + "retract-allow-no-explanation": { + "description": "Allow to not explain why the version has been retracted in the `retract` directives.", + "type": "boolean", + "default": true + }, + "exclude-forbidden": { + "description": "Forbid the use of the `exclude` directives.", + "type": "boolean", + "default": true + } + } + }, + "gomodguard": { + "type": "object", + "additionalProperties": false, + "properties": { + "allowed": { + "type": "object", + "additionalProperties": false, + "properties": { + "modules": { + "description": "List of allowed modules.", + "type": "array", + "items": { + "type": "string", + "examples": ["gopkg.in/yaml.v2"] + } + }, + "domains": { + "description": "List of allowed module domains.", + "type": "array", + "items": { + "type": "string", + "examples": ["golang.org"] + } + } + } + }, + "blocked": { + "type": "object", + "additionalProperties": false, + "properties": { + "modules": { + "description": "List of blocked modules.", + "type": "array", + "items": { + "type": "object", + "patternProperties": { + "^.+$": { + "type": "object", + "additionalProperties": false, + "properties": { + "recommendations": { + "description": "Recommended modules that should be used instead.", + "type": "array", + "items": { + "type": "string" + } + }, + "reason": { + "description": "Reason why the recommended module should be used.", + "type": "string" + } + } + } + }, + "additionalProperties": false + } + }, + "versions": { + "description": "List of blocked module version constraints.", + "type": "array", + "items": { + "type": "object", + "patternProperties": { + "^.*$": { + "type": "object", + "additionalProperties": false, + "properties": { + "version": { + "description": "Version constraint.", + "type": "string" + }, + "reason": { + "description": "Reason why the version constraint exists.", + "type": "string" + } + }, + "required": ["reason"] + } + } + } + }, + "local_replace_directives": { + "description": "Raise lint issues if loading local path with replace directive", + "type": "boolean", + "default": true + } + } + } + } + }, + "gosimple": { + "type": "object", + "additionalProperties": false, + "properties": { + "checks": { + "type": "array", + "items": { + "anyOf": [ + { + "enum": ["all"] + }, + { + "type": "string" + } + ] + } + } + } + }, + "gosec": { + "type": "object", + "additionalProperties": false, + "properties": { + "includes": { + "type": "array", + "description": "To select a subset of rules to run", + "examples": [["G401"]], + "items": { + "$ref": "#/definitions/gosec-rules" + } + }, + "excludes": { + "type": "array", + "description": "To specify a set of rules to explicitly exclude", + "examples": [["G401"]], + "items": { + "$ref": "#/definitions/gosec-rules" + } + }, + "exclude-generated": { + "description": "Exclude generated files", + "type": "boolean", + "default": false + }, + "severity": { + "description": "Filter out the issues with a lower severity than the given value", + "type": "string", + "enum": ["low", "medium", "high"], + "default": "low" + }, + "confidence": { + "description": "Filter out the issues with a lower confidence than the given value", + "type": "string", + "enum": ["low", "medium", "high"], + "default": "low" + }, + "config": { + "description": "To specify the configuration of rules", + "type": "object" + }, + "concurrency": { + "description": "Concurrency value", + "type": "integer" + } + } + }, + "gosmopolitan": { + "type": "object", + "additionalProperties": false, + "properties": { + "allow-time-local": { + "description": "Allow and ignore `time.Local` usages.", + "type": "boolean", + "default": false + }, + "escape-hatches": { + "description": "List of fully qualified names in the `full/pkg/path.name` form, to act as \"i18n escape hatches\".", + "type": "array", + "items": { + "type": "string" + } + }, + "ignore-tests": { + "description": "Ignore test files.", + "type": "boolean", + "default": false + }, + "watch-for-scripts": { + "description": "List of Unicode scripts to watch for any usage in string literals.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "govet": { + "type": "object", + "additionalProperties": false, + "properties": { + "settings": { + "description": "Settings per analyzer. Map of analyzer name to specific settings.\nRun `go tool vet help` to find out more.", + "type": "object", + "propertyNames": { + "$ref": "#/definitions/govet-analyzers" + }, + "patternProperties": { + "^.*$": { + "description": "Run `go tool vet help ` to see all settings.", + "type": "object" + } + } + }, + "enable": { + "description": "Enable analyzers by name.", + "type": "array", + "items": { + "$ref": "#/definitions/govet-analyzers" + } + }, + "disable": { + "description": "Disable analyzers by name.", + "type": "array", + "items": { + "$ref": "#/definitions/govet-analyzers" + } + }, + "enable-all": { + "description": "Enable all analyzers.", + "type": "boolean", + "default": false + }, + "disable-all": { + "description": "Disable all analyzers.", + "type": "boolean", + "default": false + } + } + }, + "grouper": { + "type": "object", + "additionalProperties": false, + "properties": { + "const-require-single-const": { + "type": "boolean", + "default": false + }, + "const-require-grouping": { + "type": "boolean", + "default": false + }, + "import-require-single-import": { + "type": "boolean", + "default": false + }, + "import-require-grouping": { + "type": "boolean", + "default": false + }, + "type-require-single-type": { + "type": "boolean", + "default": false + }, + "type-require-grouping": { + "type": "boolean", + "default": false + }, + "var-require-single-var": { + "type": "boolean", + "default": false + }, + "var-require-grouping": { + "type": "boolean", + "default": false + } + } + }, + "importas": { + "type": "object", + "additionalProperties": false, + "properties": { + "no-unaliased": { + "description": "Do not allow unaliased imports of aliased packages.", + "type": "boolean", + "default": false + }, + "no-extra-aliases": { + "description": "Do not allow non-required aliases.", + "type": "boolean", + "default": false + }, + "alias": { + "description": "List of aliases", + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "pkg": { + "description": "Package path e.g. knative.dev/serving/pkg/apis/autoscaling/v1alpha1", + "type": "string" + }, + "alias": { + "description": "Package alias e.g. autoscalingv1alpha1", + "type": "string" + } + }, + "required": ["pkg", "alias"] + } + } + } + }, + "inamedparam": { + "type": "object", + "additionalProperties": false, + "properties": { + "skip-single-param": { + "description": "Skips check for interface methods with only a single parameter.", + "type": "boolean", + "default": false + } + } + }, + "ireturn": { + "type": "object", + "additionalProperties": false, + "description": "Use either `reject` or `allow` properties for interfaces matching.", + "properties": { + "allow": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "enum": ["anon", "error", "empty", "stdlib"] + } + ] + } + }, + "reject": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "enum": ["anon", "error", "empty", "stdlib"] + } + ] + } + } + }, + "anyOf": [ + { + "not": { + "properties": { + "allow": { + "const": "reject" + } + } + }, + "required": ["allow"] + }, + { + "required": ["reject"] + } + ] + }, + "lll": { + "type": "object", + "additionalProperties": false, + "properties": { + "tab-width": { + "description": "Width of \"\\t\" in spaces.", + "type": "integer", + "minimum": 0, + "default": 1 + }, + "line-length": { + "description": "Maximum allowed line length, lines longer will be reported.", + "type": "integer", + "minimum": 1, + "default": 120 + } + } + }, + "maintidx": { + "description": "Maintainability index https://docs.microsoft.com/en-us/visualstudio/code-quality/code-metrics-maintainability-index-range-and-meaning?view=vs-2022", + "type": "object", + "additionalProperties": false, + "properties": { + "under": { + "description": "Minimum accatpable maintainability index level (see https://docs.microsoft.com/en-us/visualstudio/code-quality/code-metrics-maintainability-index-range-and-meaning?view=vs-2022)", + "type": "number", + "default": 20 + } + } + }, + "makezero": { + "type": "object", + "additionalProperties": false, + "properties": { + "always": { + "description": "Allow only slices initialized with a length of zero.", + "type": "boolean", + "default": false + } + } + }, + "loggercheck": { + "type": "object", + "additionalProperties": false, + "properties": { + "kitlog": { + "description": "Allow check for the github.com/go-kit/log library.", + "type": "boolean", + "default": true + }, + "klog": { + "description": "Allow check for the k8s.io/klog/v2 library.", + "type": "boolean", + "default": true + }, + "logr": { + "description": "Allow check for the github.com/go-logr/logr library.", + "type": "boolean", + "default": true + }, + "zap": { + "description": "Allow check for the \"sugar logger\" from go.uber.org/zap library.", + "type": "boolean", + "default": true + }, + "require-string-key": { + "description": "Require all logging keys to be inlined constant strings.", + "type": "boolean", + "default": false + }, + "no-printf-like": { + "description": "Require printf-like format specifier (%s, %d for example) not present.", + "type": "boolean", + "default": false + }, + "rules": { + "description": "List of custom rules to check against, where each rule is a single logger pattern, useful for wrapped loggers.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "misspell": { + "description": "Correct spellings using locale preferences for US or UK. Default is to use a neutral variety of English.", + "type": "object", + "additionalProperties": false, + "properties": { + "locale": { + "enum": ["US", "UK"] + }, + "ignore-words": { + "description": "List of words to ignore.", + "type": "array", + "items": { + "type": "string" + } + }, + "mode": { + "description": "Mode of the analysis.", + "enum": ["restricted", "", "default"], + "default": "" + }, + "extra-words": { + "description": "Extra word corrections.", + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "correction": { + "type": "string" + }, + "typo": { + "type": "string" + } + } + } + } + } + }, + "musttag": { + "type": "object", + "additionalProperties": false, + "properties": { + "functions": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + }, + "arg-pos": { + "type": "integer" + } + } + } + } + } + }, + "nakedret": { + "type": "object", + "additionalProperties": false, + "properties": { + "max-func-lines": { + "description": "Report if a function has more lines of code than this value and it has naked returns.", + "type": "integer", + "minimum": 0, + "default": 30 + } + } + }, + "nestif": { + "type": "object", + "additionalProperties": false, + "properties": { + "min-complexity": { + "description": "Minimum complexity of \"if\" statements to report.", + "type": "integer", + "default": 5 + } + } + }, + "nilnil": { + "type": "object", + "additionalProperties": false, + "properties": { + "checked-types": { + "type": "array", + "description": "List of return types to check.", + "items": { + "enum": ["ptr", "func", "iface", "map", "chan", "uintptr", "unsafeptr"] + }, + "default": ["ptr", "func", "iface", "map", "chan", "uintptr", "unsafeptr"] + } + } + }, + "nlreturn": { + "type": "object", + "additionalProperties": false, + "properties": { + "block-size": { + "description": "set block size that is still ok", + "type": "number", + "default": 0, + "minimum": 0 + } + } + }, + "mnd": { + "type": "object", + "additionalProperties": false, + "properties": { + "ignored-files": { + "description": "List of file patterns to exclude from analysis.", + "examples": [["magic1_.*.go"]], + "type": "array", + "items": { + "type": "string" + } + }, + "ignored-functions": { + "description": "Comma-separated list of function patterns to exclude from the analysis.", + "examples": [["math.*", "http.StatusText", "make"]], + "type": "array", + "items": { + "type": "string" + } + }, + "ignored-numbers": { + "description": "List of numbers to exclude from analysis.", + "examples": [["1000", "1234_567_890", "3.14159264"]], + "type": "array", + "items": { + "type": "string" + } + }, + "checks": { + "description": "The list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.", + "type": "array", + "items": { + "enum": [ + "argument", + "case", + "condition", + "operation", + "return", + "assign" + ] + } + } + } + }, + "nolintlint": { + "type": "object", + "additionalProperties": false, + "properties": { + "allow-unused": { + "description": "Enable to ensure that nolint directives are all used.", + "type": "boolean", + "default": true + }, + "allow-no-explanation": { + "description": "Exclude these linters from requiring an explanation.", + "type": "array", + "items": { + "$ref": "#/definitions/linters" + }, + "default": [] + }, + "require-explanation": { + "description": "Enable to require an explanation of nonzero length after each nolint directive.", + "type": "boolean", + "default": false + }, + "require-specific": { + "description": "Enable to require nolint directives to mention the specific linter being suppressed.", + "type": "boolean", + "default": false + } + } + }, + "reassign": { + "type": "object", + "additionalProperties": false, + "properties": { + "patterns": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "nonamedreturns": { + "type": "object", + "additionalProperties": false, + "properties": { + "report-error-in-defer": { + "description": "Report named error if it is assigned inside defer.", + "type": "boolean", + "default": false + } + } + }, + "paralleltest": { + "type": "object", + "additionalProperties": false, + "properties": { + "ignore-missing": { + "description": "Ignore missing calls to `t.Parallel()` and only report incorrect uses of it.", + "type": "boolean", + "default": false + }, + "ignore-missing-subtests": { + "description": "Ignore missing calls to `t.Parallel()` in subtests. Top-level tests are still required to have `t.Parallel`, but subtests are allowed to skip it.", + "type": "boolean", + "default": false + } + } + }, + "perfsprint": { + "type": "object", + "additionalProperties": false, + "properties": { + "int-conversion": { + "description": "Optimizes even if it requires an int or uint type cast.", + "type": "boolean", + "default": true + }, + "err-error": { + "description": "Optimizes into `err.Error()` even if it is only equivalent for non-nil errors.", + "type": "boolean", + "default": false + }, + "errorf": { + "description": "Optimizes `fmt.Errorf`.", + "type": "boolean", + "default": true + }, + "sprintf1": { + "description": "Optimizes `fmt.Sprintf` with only one argument.", + "type": "boolean", + "default": true + }, + "strconcat": { + "description": "Optimizes into strings concatenation.", + "type": "boolean", + "default": true + } + } + }, + "prealloc": { + "description": "We do not recommend using this linter before doing performance profiling.\nFor most programs usage of `prealloc` will be premature optimization.", + "type": "object", + "additionalProperties": false, + "properties": { + "simple": { + "description": "Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.", + "type": "boolean", + "default": true + }, + "range-loops": { + "description": "Report preallocation suggestions on range loops.", + "type": "boolean", + "default": true + }, + "for-loops": { + "description": "Report preallocation suggestions on for loops.", + "type": "boolean", + "default": false + } + } + }, + "predeclared": { + "type": "object", + "additionalProperties": false, + "properties": { + "ignore": { + "description": "Comma-separated list of predeclared identifiers to not report on.", + "type": "string" + }, + "q": { + "description": "Include method names and field names (i.e., qualified names) in checks.", + "type": "boolean", + "default": false + } + } + }, + "promlinter": { + "type": "object", + "additionalProperties": false, + "properties": { + "strict": {}, + "disabled-linters": { + "type": "array", + "items": { + "enum": [ + "Help", + "MetricUnits", + "Counter", + "HistogramSummaryReserved", + "MetricTypeInName", + "ReservedChars", + "CamelCase", + "UnitAbbreviations" + ] + } + } + } + }, + "protogetter": { + "type": "object", + "additionalProperties": false, + "properties": { + "skip-generated-by": { + "type": "array", + "items": { + "type": "string", + "examples": ["protoc-gen-go-my-own-generator"] + } + }, + "skip-files": { + "type": "array", + "items": { + "type": "string", + "examples": ["*.pb.go"] + } + }, + "skip-any-generated": { + "description": "Skip any generated files from the checking.", + "type": "boolean", + "default": false + }, + "replace-first-arg-in-append": { + "description": "Skip first argument of append function.", + "type": "boolean", + "default": false + } + } + }, + "revive": { + "type": "object", + "additionalProperties": false, + "examples": [ + { + "ignore-generated-header": true, + "severity": "warning", + "rules": [ + { + "name": "indent-error-flow", + "severity": "warning" + }, + { + "name": "add-constant", + "severity": "warning", + "arguments": [ + { + "maxLitCount": "3", + "allowStrs": "\"\"", + "allowInts": "0,1,2", + "allowFloats": "0.0,0.,1.0,1.,2.0,2." + } + ] + } + ] + } + ], + "properties": { + "max-open-files": { + "type": "integer" + }, + "ignore-generated-header": { + "type": "boolean" + }, + "confidence": { + "type": "number" + }, + "severity": { + "type": "string", + "enum": ["warning", "error"] + }, + "enable-all-rules": { + "type": "boolean", + "default": false + }, + "rules": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": ["name"], + "properties": { + "name": { + "$ref": "#/definitions/revive-rules", + "title": "The rule name" + }, + "disabled": { + "type": "boolean" + }, + "severity": { + "type": "string", + "enum": ["warning", "error"] + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + } + }, + "arguments": { + "type": "array" + } + } + } + } + } + }, + "rowserrcheck": { + "type": "object", + "additionalProperties": false, + "properties": { + "packages": { + "type": "array", + "items": { + "description": "", + "type": "string", + "examples": ["github.com/jmoiron/sqlx"] + } + } + } + }, + "sloglint": { + "type": "object", + "additionalProperties": false, + "properties": { + "kv-only": { + "description": "Enforce using key-value pairs only (incompatible with attr-only).", + "type": "boolean", + "default": false + }, + "no-global": { + "description": "Enforce not using global loggers.", + "enum": ["", "all", "default"], + "default": "" + }, + "no-mixed-args": { + "description": "Enforce not mixing key-value pairs and attributes.", + "type": "boolean", + "default": true + }, + "context": { + "description": "Enforce using methods that accept a context.", + "enum": ["", "all", "scope"], + "default": "" + }, + "static-msg": { + "description": "Enforce using static values for log messages.", + "type": "boolean", + "default": false + }, + "key-naming-case": { + "description": "Enforce a single key naming convention.", + "enum": ["snake", "kebab", "camel", "pascal"] + }, + "attr-only": { + "description": "Enforce using attributes only (incompatible with kv-only).", + "type": "boolean", + "default": false + }, + "no-raw-keys": { + "description": "Enforce using constants instead of raw keys.", + "type": "boolean", + "default": false + }, + "forbidden-keys": { + "description": "Enforce not using specific keys.", + "type": "array", + "items": { + "type": "string" + } + }, + "args-on-sep-lines": { + "description": "Enforce putting arguments on separate lines.", + "type": "boolean", + "default": false + } + } + }, + "spancheck": { + "type": "object", + "additionalProperties": false, + "properties": { + "checks": { + "description": "Checks to enable.", + "type": "array", + "items": { + "enum": ["end", "record-error", "set-status"] + } + }, + "ignore-check-signatures": { + "description": "A list of regexes for function signatures that silence `record-error` and `set-status` reports if found in the call path to a returned error.", + "type": "array", + "items": { + "type": "string" + } + }, + "extra-start-span-signatures": { + "description": "A list of regexes for additional function signatures that create spans.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "staticcheck": { + "type": "object", + "additionalProperties": false, + "properties": { + "checks": { + "type": "array", + "items": { + "anyOf": [ + { + "enum": ["all"] + }, + { + "type": "string" + } + ] + } + } + } + }, + "stylecheck": { + "type": "object", + "additionalProperties": false, + "properties": { + "checks": { + "type": "array", + "items": { + "anyOf": [ + { + "enum": ["all"] + }, + { + "type": "string" + } + ] + }, + "default": [ + "all", + "-ST1000", + "-ST1003", + "-ST1016", + "-ST1020", + "-ST1021", + "-ST1022" + ] + }, + "dot-import-whitelist": { + "description": "By default, ST1001 forbids all uses of dot imports in non-test packages. This setting allows setting a whitelist of import paths that can be dot-imported anywhere.", + "type": "array", + "items": { + "type": "string" + } + }, + "http-status-code-whitelist": { + "description": "ST1013 recommends using constants from the net/http package instead of hard-coding numeric HTTP status codes. This setting specifies a list of numeric status codes that this check does not complain about.", + "default": ["200", "400", "404", "500"], + "type": "array", + "items": { + "enum": [ + "100", + "101", + "102", + "103", + "200", + "201", + "202", + "203", + "204", + "205", + "206", + "207", + "208", + "226", + "300", + "301", + "302", + "303", + "304", + "305", + "306", + "307", + "308", + "400", + "401", + "402", + "403", + "404", + "405", + "406", + "407", + "408", + "409", + "410", + "411", + "412", + "413", + "414", + "415", + "416", + "417", + "418", + "421", + "422", + "423", + "424", + "425", + "426", + "428", + "429", + "431", + "451", + "500", + "501", + "502", + "503", + "504", + "505", + "506", + "507", + "508", + "510", + "511" + ] + } + }, + "initialisms": { + "description": "ST1003 check, among other things, for the correct capitalization of initialisms. The set of known initialisms can be configured with this option.", + "type": "array", + "items": { + "type": "string", + "default": [ + "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", + "SIP", + "RTP", + "AMQP", + "DB", + "TS" + ] + } + } + } + }, + "tagalign": { + "type": "object", + "additionalProperties": false, + "properties": { + "align": { + "description": "Align and sort can be used together or separately.", + "type": "boolean", + "default": true + }, + "sort": { + "description": "Whether enable tags sort.", + "type": "boolean", + "default": true + }, + "order": { + "description": "Specify the order of tags, the other tags will be sorted by name.", + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "examples": [ + [ + "json", + "yaml", + "yml", + "toml", + "mapstructure", + "binding", + "validate" + ] + ] + }, + "strict": { + "description": "Whether enable strict style.", + "type": "boolean", + "default": false + } + } + }, + "tagliatelle": { + "type": "object", + "additionalProperties": false, + "properties": { + "case": { + "type": "object", + "additionalProperties": false, + "properties": { + "use-field-name": { + "description": "Use the struct field name to check the name of the struct tag.", + "type": "boolean", + "default": false + }, + "rules": { + "type": "object", + "patternProperties": { + "^.+$": { + "enum": [ + "camel", + "pascal", + "kebab", + "snake", + "goCamel", + "goPascal", + "goKebab", + "goSnake", + "upper", + "upperSnake", + "lower", + "header" + ] + } + } + } + } + } + } + }, + "tenv": { + "type": "object", + "additionalProperties": false, + "properties": { + "all": { + "description": "The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.", + "type": "boolean", + "default": false + } + } + }, + "testifylint": { + "type": "object", + "additionalProperties": false, + "properties": { + "enable-all": { + "description": "Enable all checkers.", + "type": "boolean", + "default": false + }, + "disable-all": { + "description": "Disable all checkers.", + "type": "boolean", + "default": false + }, + "enable": { + "description": "Enable specific checkers.", + "type": "array", + "items": { + "enum": [ + "blank-import", + "bool-compare", + "compares", + "empty", + "error-is-as", + "error-nil", + "expected-actual", + "float-compare", + "formatter", + "go-require", + "len", + "negative-positive", + "nil-compare", + "require-error", + "suite-broken-parallel", + "suite-dont-use-pkg", + "suite-extra-assert-call", + "suite-subtest-run", + "suite-thelper", + "useless-assert" + ] + }, + "default": [ + "blank-import", + "bool-compare", + "compares", + "empty", + "error-is-as", + "error-nil", + "expected-actual", + "float-compare", + "float-compare", + "go-require", + "len", + "negative-positive", + "nil-compare", + "require-error", + "suite-broken-parallel", + "suite-dont-use-pkg", + "suite-extra-assert-call", + "suite-subtest-run", + "useless-assert" + ] + }, + "disable": { + "description": "Disable specific checkers.", + "type": "array", + "items": { + "enum": [ + "blank-import", + "bool-compare", + "compares", + "empty", + "error-is-as", + "error-nil", + "expected-actual", + "float-compare", + "formatter", + "go-require", + "len", + "negative-positive", + "nil-compare", + "require-error", + "suite-broken-parallel", + "suite-dont-use-pkg", + "suite-extra-assert-call", + "suite-subtest-run", + "suite-thelper", + "useless-assert" + ], + "default": [ + "suite-thelper" + ] + } + }, + "bool-compare": { + "type": "object", + "additionalProperties": false, + "properties": { + "ignore-custom-types": { + "description": "To ignore user defined types (over builtin bool).", + "type": "boolean", + "default": false + } + } + }, + "expected-actual": { + "type": "object", + "additionalProperties": false, + "properties": { + "pattern": { + "description": "Regexp for expected variable name.", + "type": "string", + "default": "(^(exp(ected)?|want(ed)?)([A-Z]\\w*)?$)|(^(\\w*[a-z])?(Exp(ected)?|Want(ed)?)$)" + } + } + }, + "formatter": { + "type": "object", + "additionalProperties": false, + "properties": { + "check-format-string": { + "description": "To enable go vet's printf checks.", + "type": "boolean", + "default": true + }, + "require-f-funcs": { + "description": "To require f-assertions if format string is used.", + "type": "boolean", + "default": false + } + } + }, + "go-require": { + "type": "object", + "additionalProperties": false, + "properties": { + "ignore-http-handlers": { + "description": "To ignore HTTP handlers (like http.HandlerFunc).", + "type": "boolean", + "default": false + } + } + }, + "require-error": { + "type": "object", + "additionalProperties": false, + "properties": { + "fn-pattern": { + "description": "Regexp for assertions to analyze. If defined, then only matched error assertions will be reported.", + "type": "string", + "default": "" + } + } + }, + "suite-extra-assert-call": { + "type": "object", + "additionalProperties": false, + "properties": { + "mode": { + "description": "To require or remove extra Assert() call?", + "type": "string", + "enum": ["remove", "require"], + "default": "remove" + } + } + } + } + }, + "testpackage": { + "type": "object", + "additionalProperties": false, + "properties": { + "skip-regexp": { + "description": "Files with names matching this regular expression are skipped.", + "type": "string", + "examples": ["(export|internal)_test\\.go"] + }, + "allow-packages": { + "description": "List of packages that don't end with _test that tests are allowed to be in.", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "examples": ["example"] + } + } + } + }, + "thelper": { + "type": "object", + "additionalProperties": false, + "properties": { + "test": { + "type": "object", + "additionalProperties": false, + "properties": { + "begin": { + "description": "Check if `t.Helper()` begins helper function.", + "default": true, + "type": "boolean" + }, + "first": { + "description": "Check if *testing.T is first param of helper function.", + "default": true, + "type": "boolean" + }, + "name": { + "description": "Check if *testing.T param has t name.", + "default": true, + "type": "boolean" + } + } + }, + "benchmark": { + "type": "object", + "additionalProperties": false, + "properties": { + "begin": { + "description": "Check if `b.Helper()` begins helper function.", + "default": true, + "type": "boolean" + }, + "first": { + "description": "Check if *testing.B is first param of helper function.", + "default": true, + "type": "boolean" + }, + "name": { + "description": "Check if *testing.B param has b name.", + "default": true, + "type": "boolean" + } + } + }, + "tb": { + "type": "object", + "additionalProperties": false, + "properties": { + "begin": { + "description": "Check if `tb.Helper()` begins helper function.", + "default": true, + "type": "boolean" + }, + "first": { + "description": "Check if *testing.TB is first param of helper function.", + "default": true, + "type": "boolean" + }, + "name": { + "description": "Check if *testing.TB param has tb name.", + "default": true, + "type": "boolean" + } + } + }, + "fuzz": { + "type": "object", + "additionalProperties": false, + "properties": { + "begin": { + "description": "Check if `f.Helper()` begins helper function.", + "default": true, + "type": "boolean" + }, + "first": { + "description": "Check if *testing.F is first param of helper function.", + "default": true, + "type": "boolean" + }, + "name": { + "description": "Check if *testing.F param has f name.", + "default": true, + "type": "boolean" + } + } + } + } + }, + "usestdlibvars": { + "type": "object", + "additionalProperties": false, + "properties": { + "http-method": { + "description": "Suggest the use of http.MethodXX.", + "type": "boolean", + "default": true + }, + "http-status-code": { + "description": "Suggest the use of http.StatusXX.", + "type": "boolean", + "default": true + }, + "time-weekday": { + "description": "Suggest the use of time.Weekday.String().", + "type": "boolean", + "default": false + }, + "time-month": { + "description": "Suggest the use of time.Month.String().", + "type": "boolean", + "default": false + }, + "time-layout": { + "description": "Suggest the use of time.Layout.", + "type": "boolean", + "default": false + }, + "crypto-hash": { + "description": "Suggest the use of crypto.Hash.String().", + "type": "boolean", + "default": false + }, + "default-rpc-path": { + "description": "Suggest the use of rpc.DefaultXXPath.", + "type": "boolean", + "default": false + }, + "sql-isolation-level": { + "description": "Suggest the use of sql.LevelXX.String().", + "type": "boolean", + "default": false + }, + "tls-signature-scheme": { + "description": "Suggest the use of tls.SignatureScheme.String().", + "type": "boolean", + "default": false + }, + "constant-kind": { + "description": "Suggest the use of constant.Kind.String().", + "type": "boolean", + "default": false + } + } + }, + "unconvert": { + "type": "object", + "additionalProperties": false, + "properties": { + "fast-math": { + "type": "boolean", + "default": false + }, + "safe": { + "type": "boolean", + "default": false + } + } + }, + "unparam": { + "type": "object", + "additionalProperties": false, + "properties": { + "check-exported": { + "description": "Inspect exported functions. Set to true if no external program/library imports your code.\n\nWARNING: if you enable this setting, unparam will report a lot of false-positives in text editors:\nif it's called for subdir of a project it can't find external interfaces. All text editor integrations\nwith golangci-lint call it on a directory with the changed file.", + "type": "boolean", + "default": false + } + } + }, + "unused": { + "type": "object", + "additionalProperties": false, + "properties": { + "field-writes-are-uses": { + "description": "", + "type": "boolean", + "default": true + }, + "post-statements-are-reads": { + "description": "", + "type": "boolean", + "default": false + }, + "exported-fields-are-used": { + "description": "", + "type": "boolean", + "default": true + }, + "parameters-are-used": { + "description": "", + "type": "boolean", + "default": true + }, + "local-variables-are-used": { + "description": "", + "type": "boolean", + "default": true + }, + "generated-is-used": { + "description": "", + "type": "boolean", + "default": true + } + } + }, + "varnamelen": { + "type": "object", + "additionalProperties": false, + "properties": { + "max-distance": { + "description": "Variables used in at most this N-many lines will be ignored.", + "type": "integer", + "default": 5 + }, + "min-name-length": { + "description": "The minimum length of a variable's name that is considered `long`.", + "type": "integer", + "default": 3 + }, + "check-receiver": { + "description": "Check method receiver names.", + "default": false, + "type": "boolean" + }, + "check-return": { + "description": "Check named return values.", + "default": false, + "type": "boolean" + }, + "check-type-param": { + "description": "Check type parameters.", + "default": false, + "type": "boolean" + }, + "ignore-type-assert-ok": { + "description": "Ignore `ok` variables that hold the bool return value of a type assertion", + "default": false, + "type": "boolean" + }, + "ignore-map-index-ok": { + "description": "Ignore `ok` variables that hold the bool return value of a map index.", + "default": false, + "type": "boolean" + }, + "ignore-chan-recv-ok": { + "description": "Ignore `ok` variables that hold the bool return value of a channel receive.", + "default": false, + "type": "boolean" + }, + "ignore-names": { + "description": "Optional list of variable names that should be ignored completely.", + "default": [[]], + "type": "array", + "items": { + "type": "string" + } + }, + "ignore-decls": { + "description": "Optional list of variable declarations that should be ignored completely.", + "type": "array", + "items": { + "type": "string" + }, + "examples": [ + ["c echo.Context", "t testing.T", "f *foo.Bar", "const C"] + ] + } + } + }, + "whitespace": { + "type": "object", + "additionalProperties": false, + "properties": { + "multi-if": { + "description": "Enforces newlines (or comments) after every multi-line if statement", + "type": "boolean", + "default": false + }, + "multi-func": { + "description": "Enforces newlines (or comments) after every multi-line function signature", + "type": "boolean", + "default": false + } + } + }, + "wrapcheck": { + "type": "object", + "additionalProperties": false, + "properties": { + "ignoreSigs": { + "description": "An array of strings which specify substrings of signatures to ignore.", + "default": [ + ".Errorf(", + "errors.New(", + "errors.Unwrap(", + ".Wrap(", + ".Wrapf(", + ".WithMessage(", + ".WithMessagef(", + ".WithStack(" + ], + "type": "array", + "items": { + "type": "string" + } + }, + "ignoreSigRegexps": { + "description": "An array of strings which specify regular expressions of signatures to ignore.", + "default": [""], + "type": "array", + "items": { + "type": "string" + } + }, + "ignorePackageGlobs": { + "description": "An array of glob patterns which, if any match the package of the function returning the error, will skip wrapcheck analysis for this error.", + "default": [""], + "type": "array", + "items": { + "type": "string" + } + }, + "ignoreInterfaceRegexps": { + "description": "An array of glob patterns which, if matched to an underlying interface name, will ignore unwrapped errors returned from a function whose call is defined on the given interface.", + "default": [""], + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "wsl": { + "type": "object", + "additionalProperties": false, + "properties": { + "allow-assign-and-anything": { + "description": "Controls if you may cuddle assignments and anything without needing an empty line between them.", + "type": "boolean", + "default": false + }, + "allow-assign-and-call": { + "description": "Allow calls and assignments to be cuddled as long as the lines have any matching variables, fields or types.", + "type": "boolean", + "default": true + }, + "allow-cuddle-declarations": { + "description": "Allow declarations (var) to be cuddled.", + "type": "boolean", + "default": false + }, + "allow-cuddle-with-calls": { + "description": "A list of call idents that everything can be cuddled with.", + "type": "array", + "items": { + "type": "string" + } + }, + "allow-cuddle-with-rhs": { + "description": "AllowCuddleWithRHS is a list of right hand side variables that is allowed to be cuddled with anything.", + "type": "array", + "items": { + "type": "string" + } + }, + "allow-multiline-assign": { + "description": "Allow multiline assignments to be cuddled.", + "type": "boolean", + "default": true + }, + "allow-separated-leading-comment": { + "description": "Allow leading comments to be separated with empty lines.", + "type": "boolean", + "default": false + }, + "allow-trailing-comment": { + "description": "Allow trailing comments in ending of blocks.", + "type": "boolean", + "default": false + }, + "error-variable-names": { + "description": "When force-err-cuddling is enabled this is a list of names used for error variables to check for in the conditional.", + "type": "array", + "items": { + "type": "string" + } + }, + "force-case-trailing-whitespace": { + "description": "Force newlines in end of case at this limit (0 = never).", + "type": "integer", + "minimum": 0, + "default": 0 + }, + "force-err-cuddling": { + "description": "Causes an error when an If statement that checks an error variable doesn't cuddle with the assignment of that variable.", + "type": "boolean", + "default": false + }, + "force-short-decl-cuddling": { + "description": "Causes an error if a short declaration (:=) cuddles with anything other than another short declaration.", + "type": "boolean", + "default": false + }, + "strict-append": { + "description": "If true, append is only allowed to be cuddled if appending value is matching variables, fields or types on line above.", + "type": "boolean", + "default": true + } + } + }, + "copyloopvar": { + "type": "object", + "additionalProperties": false, + "properties": { + "check-alias": { + "type": "boolean", + "default": false + } + } + }, + "custom": { + "description": "The custom section can be used to define linter plugins to be loaded at runtime. See README of golangci-lint for more information.\nEach custom linter should have a unique name.", + "type": "object", + "patternProperties": { + "^.*$": { + "type": "object", + "additionalProperties": false, + "properties": { + "type": { + "description": "The plugin type.", + "enum": ["module", "goplugin"], + "default": "goplugin" + }, + "path": { + "description": "The path to the plugin *.so. Can be absolute or local.", + "type": "string", + "examples": ["/path/to/example.so"] + }, + "description": { + "description": "The description of the linter, for documentation purposes only.", + "type": "string" + }, + "original-url": { + "description": "Intended to point to the repo location of the linter, for documentation purposes only.", + "type": "string" + }, + "settings": { + "description": "Plugins settings/configuration. Only work with plugin based on `linterdb.PluginConstructor`.", + "type": "object" + } + }, + "oneOf": [ + { + "properties": { + "type": {"enum": ["module"] } + } + }, + { + "required": ["path"] + } + ] + } + } + } + } + }, + "linters": { + "type": "object", + "additionalProperties": false, + "properties": { + "enable": { + "description": "List of enabled linters.", + "type": "array", + "items": { + "$ref": "#/definitions/linters" + } + }, + "disable": { + "description": "List of disabled linters.", + "type": "array", + "items": { + "$ref": "#/definitions/linters" + } + }, + "enable-all": { + "description": "Whether to enable all linters. You can re-disable them with `disable` explicitly.", + "type": "boolean", + "default": false + }, + "disable-all": { + "description": "Whether to disable all linters. You can re-enable them with `enable` explicitly.", + "type": "boolean", + "default": false + }, + "presets": { + "description": "Allow to use different presets of linters", + "type": "array", + "items": { + "enum": [ + "bugs", + "comment", + "complexity", + "error", + "format", + "import", + "metalinter", + "module", + "performance", + "sql", + "style", + "test", + "unused" + ] + } + }, + "fast": { + "description": "Enable run of fast linters.", + "type": "boolean", + "default": false + } + } + }, + "issues": { + "type": "object", + "additionalProperties": false, + "properties": { + "exclude": { + "description": "List of regular expressions of issue texts to exclude.\nBut independently from this option we use default exclude patterns. Their usage can be controlled through `exclude-use-default`.", + "type": "array", + "items": { + "type": "string" + } + }, + "exclude-rules": { + "description": "Exclude configuration per-path, per-linter, per-text and per-source", + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "path": { + "type": "string" + }, + "path-except": { + "type": "string" + }, + "linters": { + "type": "array", + "items": { + "$ref": "#/definitions/linters" + } + }, + "text": { + "type": "string" + }, + "source": { + "type": "string" + } + } + } + }, + "exclude-use-default": { + "description": "Independently from option `exclude` we use default exclude patterns. This behavior can be disabled by this option.", + "type": "boolean", + "default": true + }, + "exclude-case-sensitive": { + "description": "If set to true, exclude and exclude-rules regular expressions become case sensitive.", + "type": "boolean", + "default": false + }, + "exclude-generated": { + "description": "Mode of the generated files analysis.", + "enum": ["lax", "strict", "disable"], + "default": "lax" + }, + "exclude-dirs": { + "description": "Which directories to exclude: issues from them won't be reported.", + "type": "array", + "items": { + "description": "You can use regexp here. The regexp is applied on the full path.\n\"/\" will be replaced by current OS file path separator to properly work on Windows.", + "type": "string", + "examples": ["generated.*"] + }, + "default": [], + "examples": [["src/external_libs", "autogenerated_by_my_lib"]] + }, + "exclude-dirs-use-default": { + "description": "Enable exclusion of directories \"vendor\", \"third_party\", \"testdata\", \"examples\", \"Godeps\", and \"builtin\".", + "type": "boolean", + "default": true + }, + "exclude-files": { + "description": "Which files to exclude: they will be analyzed, but issues from them will not be reported.", + "type": "array", + "items": { + "description": "You can use regexp here. There is no need to include all autogenerated files, we confidently recognize them. If that is not the case, please let us know.\n\"/\" will be replaced by current OS file path separator to properly work on Windows.", + "type": "string", + "examples": [".*\\.my\\.go$"] + }, + "default": [], + "examples": [[".*\\.my\\.go$", "lib/bad.go"]] + }, + "include": { + "description": "The list of ids of default excludes to include or disable.", + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "max-issues-per-linter": { + "description": "Maximum issues count per one linter. Set to 0 to disable.", + "type": "integer", + "default": 50, + "minimum": 0 + }, + "max-same-issues": { + "description": "Maximum count of issues with the same text. Set to 0 to disable.", + "type": "integer", + "default": 3, + "minimum": 0 + }, + "new": { + "description": "Show only new issues: if there are unstaged changes or untracked files, only those changes are analyzed, else only changes in HEAD~ are analyzed.", + "type": "boolean", + "default": false + }, + "new-from-rev": { + "description": "Show only new issues created after this git revision.", + "type": "string" + }, + "new-from-patch": { + "description": "Show only new issues created in git patch with this file path.", + "type": "string", + "examples": ["path/to/patch/file"] + }, + "fix": { + "description": "Fix found issues (if it's supported by the linter).", + "type": "boolean", + "default": false + }, + "whole-files": { + "description": "Show issues in any part of update files (requires new-from-rev or new-from-patch).", + "type": "boolean", + "default": false + } + } + }, + "severity": { + "type": "object", + "additionalProperties": false, + "properties": { + "default-severity": { + "description": "Set the default severity for issues. If severity rules are defined and the issues do not match or no severity is provided to the rule this will be the default severity applied. Severities should match the supported severity names of the selected out format.", + "type": "string", + "default": "" + }, + "case-sensitive": { + "description": "If set to true, severity-rules regular expressions become case sensitive.", + "type": "boolean", + "default": false + }, + "rules": { + "description": "When a list of severity rules are provided, severity information will be added to lint issues. Severity rules have the same filtering capability as exclude rules except you are allowed to specify one matcher per severity rule.\nOnly affects out formats that support setting severity information.", + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "severity": { + "type": "string" + }, + "path": { + "type": "string" + }, + "path-except": { + "type": "string" + }, + "linters": { + "type": "array", + "items": { + "$ref": "#/definitions/linters" + } + }, + "text": { + "type": "string" + }, + "source": { + "type": "string" + } + }, + "required": ["severity"], + "anyOf": [ + { "required": ["path"] }, + { "required": ["path-except"] }, + { "required": ["linters"] }, + { "required": ["text"] }, + { "required": ["source"] } + ] + }, + "default": [] + } + }, + "required": ["default-severity"] + } + } +}