1
0
mirror of https://github.com/mgechev/revive.git synced 2024-12-04 10:24:49 +02:00

docs: fix rule descriptions (#1147)

This commit is contained in:
Oleksandr Redko 2024-12-01 17:44:41 +02:00 committed by GitHub
parent b532dc8e5e
commit d181862481
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
45 changed files with 45 additions and 45 deletions

View File

@ -31,7 +31,7 @@ func (wl allowList) add(kind, list string) {
}
}
// AddConstantRule lints unused params in functions.
// AddConstantRule suggests using constants instead of magic numbers and string literals.
type AddConstantRule struct {
allowList allowList
ignoreFunctions []*regexp.Regexp

View File

@ -8,7 +8,7 @@ import (
"github.com/mgechev/revive/lint"
)
// ArgumentsLimitRule lints given else constructs.
// ArgumentsLimitRule lints the number of arguments a function can receive.
type ArgumentsLimitRule struct {
max int

View File

@ -8,7 +8,7 @@ import (
"github.com/mgechev/revive/lint"
)
// AtomicRule lints given else constructs.
// AtomicRule lints usages of the `sync/atomic` package.
type AtomicRule struct{}
// Apply applies the rule to given file.

View File

@ -6,7 +6,7 @@ import (
"github.com/mgechev/revive/lint"
)
// BareReturnRule lints given else constructs.
// BareReturnRule lints bare returns.
type BareReturnRule struct{}
// Apply applies the rule to given file.

View File

@ -7,7 +7,7 @@ import (
"github.com/mgechev/revive/lint"
)
// BlankImportsRule lints given else constructs.
// BlankImportsRule lints blank imports.
type BlankImportsRule struct{}
// Name returns the rule name.

View File

@ -10,7 +10,7 @@ import (
"golang.org/x/tools/go/ast/astutil"
)
// CognitiveComplexityRule lints given else constructs.
// CognitiveComplexityRule sets restriction for maximum cognitive complexity.
type CognitiveComplexityRule struct {
maxComplexity int

View File

@ -9,7 +9,7 @@ import (
"github.com/mgechev/revive/lint"
)
// CommentsDensityRule lints given else constructs.
// CommentsDensityRule enforces a minimum comment / code relation.
type CommentsDensityRule struct {
minimumCommentsDensity int64

View File

@ -9,7 +9,7 @@ import (
"github.com/mgechev/revive/lint"
)
// ContextAsArgumentRule lints given else constructs.
// ContextAsArgumentRule suggests that `context.Context` should be the first argument of a function.
type ContextAsArgumentRule struct {
allowTypesLUT map[string]struct{}

View File

@ -8,7 +8,7 @@ import (
"github.com/mgechev/revive/lint"
)
// ContextKeysType lints given else constructs.
// ContextKeysType disallows the usage of basic types in `context.WithValue`.
type ContextKeysType struct{}
// Apply applies the rule to given file.

View File

@ -11,7 +11,7 @@ import (
// Based on https://github.com/fzipp/gocyclo
// CyclomaticRule lints given else constructs.
// CyclomaticRule sets restriction for maximum cyclomatic complexity.
type CyclomaticRule struct {
maxComplexity int

View File

@ -8,7 +8,7 @@ import (
"github.com/mgechev/revive/lint"
)
// DeferRule lints unused params in functions.
// DeferRule lints gotchas in defer statements.
type DeferRule struct {
allow map[string]bool

View File

@ -8,7 +8,7 @@ import (
"github.com/mgechev/revive/lint"
)
// DotImportsRule lints given else constructs.
// DotImportsRule forbids . imports.
type DotImportsRule struct {
allowedPackages allowPackages

View File

@ -6,7 +6,7 @@ import (
"github.com/mgechev/revive/lint"
)
// DuplicatedImportsRule lints given else constructs.
// DuplicatedImportsRule looks for packages that are imported two or more times.
type DuplicatedImportsRule struct{}
// Apply applies the rule to given file.

View File

@ -6,7 +6,7 @@ import (
"github.com/mgechev/revive/lint"
)
// EmptyBlockRule lints given else constructs.
// EmptyBlockRule warns on empty code blocks.
type EmptyBlockRule struct{}
// Apply applies the rule to given file.

View File

@ -9,7 +9,7 @@ import (
"github.com/mgechev/revive/lint"
)
// ErrorNamingRule lints given else constructs.
// ErrorNamingRule lints naming of error variables.
type ErrorNamingRule struct{}
// Apply applies the rule to given file.

View File

@ -6,7 +6,7 @@ import (
"github.com/mgechev/revive/lint"
)
// ErrorReturnRule lints given else constructs.
// ErrorReturnRule ensures that the error return parameter is the last parameter.
type ErrorReturnRule struct{}
// Apply applies the rule to given file.

View File

@ -12,7 +12,7 @@ import (
"github.com/mgechev/revive/lint"
)
// ErrorStringsRule lints given else constructs.
// ErrorStringsRule lints error strings.
type ErrorStringsRule struct {
errorFunctions map[string]map[string]struct{}

View File

@ -9,7 +9,7 @@ import (
"github.com/mgechev/revive/lint"
)
// ErrorfRule lints given else constructs.
// ErrorfRule suggests using `fmt.Errorf` instead of `errors.New(fmt.Sprintf())`.
type ErrorfRule struct{}
// Apply applies the rule to given file.

View File

@ -62,7 +62,7 @@ var commonMethods = map[string]bool{
"Unwrap": true,
}
// ExportedRule lints given else constructs.
// ExportedRule lints naming and commenting conventions on exported symbols.
type ExportedRule struct {
stuttersMsg string
disabledChecks disabledChecks

View File

@ -8,7 +8,7 @@ import (
"github.com/mgechev/revive/lint"
)
// FileHeaderRule lints given else constructs.
// FileHeaderRule lints the header that each file should have.
type FileHeaderRule struct {
header string

View File

@ -7,7 +7,7 @@ import (
"github.com/mgechev/revive/lint"
)
// FlagParamRule lints given else constructs.
// FlagParamRule warns on boolean parameters that create a control coupling.
type FlagParamRule struct{}
// Apply applies the rule to given file.

View File

@ -8,7 +8,7 @@ import (
"github.com/mgechev/revive/lint"
)
// FunctionResultsLimitRule lints given else constructs.
// FunctionResultsLimitRule limits the maximum number of results a function can return.
type FunctionResultsLimitRule struct {
max int

View File

@ -8,7 +8,7 @@ import (
"github.com/mgechev/revive/lint"
)
// GetReturnRule lints given else constructs.
// GetReturnRule warns on getters that do not yield any result.
type GetReturnRule struct{}
// Apply applies the rule to given file.

View File

@ -8,7 +8,7 @@ import (
"github.com/mgechev/revive/lint"
)
// IfReturnRule lints given else constructs.
// IfReturnRule searches for redundant `if` when returning an error.
type IfReturnRule struct{}
// Apply applies the rule to given file.

View File

@ -9,7 +9,7 @@ import (
"github.com/mgechev/revive/lint"
)
// ImportShadowingRule lints given else constructs.
// ImportShadowingRule spots identifiers that shadow an import.
type ImportShadowingRule struct{}
// Apply applies the rule to given file.

View File

@ -8,7 +8,7 @@ import (
"github.com/mgechev/revive/lint"
)
// ImportsBlocklistRule lints given else constructs.
// ImportsBlocklistRule disallows importing the specified packages.
type ImportsBlocklistRule struct {
blocklist []*regexp.Regexp

View File

@ -8,7 +8,7 @@ import (
"github.com/mgechev/revive/lint"
)
// IncrementDecrementRule lints given else constructs.
// IncrementDecrementRule lints `i += 1` and `i -= 1` constructs.
type IncrementDecrementRule struct{}
// Apply applies the rule to given file.

View File

@ -5,7 +5,7 @@ import (
"github.com/mgechev/revive/lint"
)
// IndentErrorFlowRule lints given else constructs.
// IndentErrorFlowRule prevents redundant else statements.
type IndentErrorFlowRule struct{}
// Apply applies the rule to given file.

View File

@ -12,7 +12,7 @@ import (
"github.com/mgechev/revive/lint"
)
// LineLengthLimitRule lints given else constructs.
// LineLengthLimitRule lints number of characters in a line.
type LineLengthLimitRule struct {
max int

View File

@ -8,7 +8,7 @@ import (
"github.com/mgechev/revive/lint"
)
// MaxControlNestingRule lints given else constructs.
// MaxControlNestingRule sets restriction for maximum nesting of control structures.
type MaxControlNestingRule struct {
max int64

View File

@ -9,7 +9,7 @@ import (
"github.com/mgechev/revive/lint"
)
// MaxPublicStructsRule lints given else constructs.
// MaxPublicStructsRule lints the number of public structs in a file.
type MaxPublicStructsRule struct {
max int64

View File

@ -7,7 +7,7 @@ import (
"github.com/mgechev/revive/lint"
)
// ModifiesParamRule lints given else constructs.
// ModifiesParamRule warns on assignments to function parameters.
type ModifiesParamRule struct{}
// Apply applies the rule to given file.

View File

@ -8,7 +8,7 @@ import (
"github.com/mgechev/revive/lint"
)
// OptimizeOperandsOrderRule lints given else constructs.
// OptimizeOperandsOrderRule checks inefficient conditional expressions.
type OptimizeOperandsOrderRule struct{}
// Apply applies the rule to given file.

View File

@ -8,7 +8,7 @@ import (
"github.com/mgechev/revive/lint"
)
// RangeRule lints given else constructs.
// RangeRule prevents redundant variables when iterating over a collection.
type RangeRule struct{}
// Apply applies the rule to given file.

View File

@ -7,7 +7,7 @@ import (
"github.com/mgechev/revive/lint"
)
// RangeValInClosureRule lints given else constructs.
// RangeValInClosureRule warns if range value is used in a closure dispatched as goroutine.
type RangeValInClosureRule struct{}
// Apply applies the rule to given file.

View File

@ -9,7 +9,7 @@ import (
"github.com/mgechev/revive/lint"
)
// ReceiverNamingRule lints given else constructs.
// ReceiverNamingRule lints a receiver name.
type ReceiverNamingRule struct {
receiverNameMaxLength int

View File

@ -8,7 +8,7 @@ import (
"github.com/mgechev/revive/lint"
)
// RedundantImportAlias lints given else constructs.
// RedundantImportAlias warns on import aliases matching the imported package name.
type RedundantImportAlias struct{}
// Apply applies the rule to given file.

View File

@ -9,7 +9,7 @@ import (
"github.com/mgechev/revive/lint"
)
// TimeNamingRule lints given else constructs.
// TimeNamingRule lints the name of a time variable.
type TimeNamingRule struct{}
// Apply applies the rule to given file.

View File

@ -6,7 +6,7 @@ import (
"github.com/mgechev/revive/lint"
)
// UnconditionalRecursionRule lints given else constructs.
// UnconditionalRecursionRule warns on function calls that will lead to infinite recursion.
type UnconditionalRecursionRule struct{}
// Apply applies the rule to given file.

View File

@ -9,7 +9,7 @@ import (
"github.com/mgechev/revive/lint"
)
// UnexportedReturnRule lints given else constructs.
// UnexportedReturnRule warns when a public return is from unexported type.
type UnexportedReturnRule struct{}
// Apply applies the rule to given file.

View File

@ -11,7 +11,7 @@ import (
"github.com/mgechev/revive/lint"
)
// UnhandledErrorRule lints given else constructs.
// UnhandledErrorRule warns on unhandled errors returned by function calls.
type UnhandledErrorRule struct {
ignoreList []*regexp.Regexp

View File

@ -9,7 +9,7 @@ import (
"github.com/mgechev/revive/lint"
)
// UnusedReceiverRule lints unused params in functions.
// UnusedReceiverRule lints unused receivers in functions.
type UnusedReceiverRule struct {
// regex to check if some name is valid for unused parameter, "^_$" by default
allowRegex *regexp.Regexp

View File

@ -6,7 +6,7 @@ import (
"github.com/mgechev/revive/lint"
)
// UseAnyRule lints given else constructs.
// UseAnyRule proposes to replace `interface{}` with its alias `any`.
type UseAnyRule struct{}
// Apply applies the rule to given file.

View File

@ -25,7 +25,7 @@ var zeroLiteral = map[string]bool{
"0i": true,
}
// VarDeclarationsRule lints given else constructs.
// VarDeclarationsRule reduces redundancies around variable declaration.
type VarDeclarationsRule struct{}
// Apply applies the rule to given file.

View File

@ -23,7 +23,7 @@ var knownNameExceptions = map[string]bool{
"kWh": true,
}
// VarNamingRule lints given else constructs.
// VarNamingRule lints the name of a variable.
type VarNamingRule struct {
allowList []string
blockList []string