rule

package
v1.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2025 License: MIT Imports: 27 Imported by: 28

Documentation

Overview

Package rule implements revive's linting rules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddConstantRule

type AddConstantRule struct {
	// contains filtered or unexported fields
}

AddConstantRule suggests using constants instead of magic numbers and string literals.

func (*AddConstantRule) Apply

func (r *AddConstantRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*AddConstantRule) Configure added in v1.6.0

func (r *AddConstantRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*AddConstantRule) Name

func (*AddConstantRule) Name() string

Name returns the rule name.

type ArgumentsLimitRule

type ArgumentsLimitRule struct {
	// contains filtered or unexported fields
}

ArgumentsLimitRule lints the number of arguments a function can receive.

func (*ArgumentsLimitRule) Apply

func (r *ArgumentsLimitRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*ArgumentsLimitRule) Configure added in v1.6.0

func (r *ArgumentsLimitRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*ArgumentsLimitRule) Name

func (*ArgumentsLimitRule) Name() string

Name returns the rule name.

type AtomicRule

type AtomicRule struct{}

AtomicRule lints usages of the `sync/atomic` package.

func (*AtomicRule) Apply

func (*AtomicRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*AtomicRule) Name

func (*AtomicRule) Name() string

Name returns the rule name.

type BannedCharsRule added in v1.1.3

type BannedCharsRule struct {
	// contains filtered or unexported fields
}

BannedCharsRule checks if a file contains banned characters.

func (*BannedCharsRule) Apply added in v1.1.3

func (r *BannedCharsRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applied the rule to the given file.

func (*BannedCharsRule) Configure added in v1.6.0

func (r *BannedCharsRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*BannedCharsRule) Name added in v1.1.3

func (*BannedCharsRule) Name() string

Name returns the rule name.

type BareReturnRule

type BareReturnRule struct{}

BareReturnRule lints bare returns.

func (*BareReturnRule) Apply

func (*BareReturnRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*BareReturnRule) Name

func (*BareReturnRule) Name() string

Name returns the rule name.

type BlankImportsRule

type BlankImportsRule struct{}

BlankImportsRule lints blank imports.

func (*BlankImportsRule) Apply

func (r *BlankImportsRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*BlankImportsRule) Name

func (*BlankImportsRule) Name() string

Name returns the rule name.

type BoolLiteralRule

type BoolLiteralRule struct{}

BoolLiteralRule warns when logic expressions contains Boolean literals.

func (*BoolLiteralRule) Apply

func (*BoolLiteralRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*BoolLiteralRule) Name

func (*BoolLiteralRule) Name() string

Name returns the rule name.

type CallToGCRule

type CallToGCRule struct{}

CallToGCRule lints calls to the garbage collector.

func (*CallToGCRule) Apply

func (*CallToGCRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*CallToGCRule) Name

func (*CallToGCRule) Name() string

Name returns the rule name.

type CognitiveComplexityRule

type CognitiveComplexityRule struct {
	// contains filtered or unexported fields
}

CognitiveComplexityRule sets restriction for maximum cognitive complexity.

func (*CognitiveComplexityRule) Apply

Apply applies the rule to given file.

func (*CognitiveComplexityRule) Configure added in v1.6.0

func (r *CognitiveComplexityRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*CognitiveComplexityRule) Name

Name returns the rule name.

type CommentSpacingsRule added in v1.2.5

type CommentSpacingsRule struct {
	// contains filtered or unexported fields
}

CommentSpacingsRule check whether there is a space between the comment symbol( // ) and the start of the comment text.

func (*CommentSpacingsRule) Apply added in v1.2.5

func (r *CommentSpacingsRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply the rule.

func (*CommentSpacingsRule) Configure added in v1.6.0

func (r *CommentSpacingsRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*CommentSpacingsRule) Name added in v1.2.5

func (*CommentSpacingsRule) Name() string

Name yields this rule name.

type CommentsDensityRule added in v1.3.8

type CommentsDensityRule struct {
	// contains filtered or unexported fields
}

CommentsDensityRule enforces a minimum comment / code relation.

func (*CommentsDensityRule) Apply added in v1.3.8

func (r *CommentsDensityRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*CommentsDensityRule) Configure added in v1.6.0

func (r *CommentsDensityRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*CommentsDensityRule) Name added in v1.3.8

func (*CommentsDensityRule) Name() string

Name returns the rule name.

type ConfusingNamingRule

type ConfusingNamingRule struct{}

ConfusingNamingRule lints method names that differ only by capitalization.

func (*ConfusingNamingRule) Apply

func (*ConfusingNamingRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*ConfusingNamingRule) Name

func (*ConfusingNamingRule) Name() string

Name returns the rule name.

type ConfusingResultsRule

type ConfusingResultsRule struct{}

ConfusingResultsRule lints given function declarations.

func (*ConfusingResultsRule) Apply

Apply applies the rule to given file.

func (*ConfusingResultsRule) Name

func (*ConfusingResultsRule) Name() string

Name returns the rule name.

type ConstantLogicalExprRule

type ConstantLogicalExprRule struct{}

ConstantLogicalExprRule warns on constant logical expressions.

func (*ConstantLogicalExprRule) Apply

Apply applies the rule to given file.

func (*ConstantLogicalExprRule) Name

Name returns the rule name.

type ContextAsArgumentRule

type ContextAsArgumentRule struct {
	// contains filtered or unexported fields
}

ContextAsArgumentRule suggests that `context.Context` should be the first argument of a function.

func (*ContextAsArgumentRule) Apply

func (r *ContextAsArgumentRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*ContextAsArgumentRule) Configure added in v1.6.0

func (r *ContextAsArgumentRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*ContextAsArgumentRule) Name

func (*ContextAsArgumentRule) Name() string

Name returns the rule name.

type ContextKeysType

type ContextKeysType struct{}

ContextKeysType disallows the usage of basic types in `context.WithValue`.

func (*ContextKeysType) Apply

func (*ContextKeysType) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*ContextKeysType) Name

func (*ContextKeysType) Name() string

Name returns the rule name.

type CyclomaticRule

type CyclomaticRule struct {
	// contains filtered or unexported fields
}

CyclomaticRule sets restriction for maximum cyclomatic complexity.

func (*CyclomaticRule) Apply

func (r *CyclomaticRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*CyclomaticRule) Configure added in v1.6.0

func (r *CyclomaticRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*CyclomaticRule) Name

func (*CyclomaticRule) Name() string

Name returns the rule name.

type DataRaceRule added in v1.2.2

type DataRaceRule struct{}

DataRaceRule lints assignments to value method-receivers.

func (*DataRaceRule) Apply added in v1.2.2

func (r *DataRaceRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*DataRaceRule) Name added in v1.2.2

func (*DataRaceRule) Name() string

Name returns the rule name.

type DeepExitRule

type DeepExitRule struct{}

DeepExitRule lints program exit at functions other than main or init.

func (*DeepExitRule) Apply

func (*DeepExitRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*DeepExitRule) Name

func (*DeepExitRule) Name() string

Name returns the rule name.

type DeferRule added in v1.0.3

type DeferRule struct {
	// contains filtered or unexported fields
}

DeferRule lints gotchas in defer statements.

func (*DeferRule) Apply added in v1.0.3

func (r *DeferRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*DeferRule) Configure added in v1.6.0

func (r *DeferRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*DeferRule) Name added in v1.0.3

func (*DeferRule) Name() string

Name returns the rule name.

type DotImportsRule

type DotImportsRule struct {
	// contains filtered or unexported fields
}

DotImportsRule forbids . imports.

func (*DotImportsRule) Apply

func (r *DotImportsRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*DotImportsRule) Configure added in v1.6.0

func (r *DotImportsRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*DotImportsRule) Name

func (*DotImportsRule) Name() string

Name returns the rule name.

type DuplicatedImportsRule

type DuplicatedImportsRule struct{}

DuplicatedImportsRule looks for packages that are imported two or more times.

func (*DuplicatedImportsRule) Apply

Apply applies the rule to given file.

func (*DuplicatedImportsRule) Name

func (*DuplicatedImportsRule) Name() string

Name returns the rule name.

type EarlyReturnRule added in v1.0.3

type EarlyReturnRule struct {
	// contains filtered or unexported fields
}

EarlyReturnRule finds opportunities to reduce nesting by inverting the condition of an "if" block.

func (*EarlyReturnRule) Apply added in v1.0.3

func (e *EarlyReturnRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*EarlyReturnRule) Configure added in v1.8.0

func (e *EarlyReturnRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*EarlyReturnRule) Name added in v1.0.3

func (*EarlyReturnRule) Name() string

Name returns the rule name.

type EmptyBlockRule

type EmptyBlockRule struct{}

EmptyBlockRule warns on empty code blocks.

func (*EmptyBlockRule) Apply

func (*EmptyBlockRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*EmptyBlockRule) Name

func (*EmptyBlockRule) Name() string

Name returns the rule name.

type EmptyLinesRule

type EmptyLinesRule struct{}

EmptyLinesRule lints empty lines in blocks.

func (*EmptyLinesRule) Apply

func (r *EmptyLinesRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*EmptyLinesRule) Name

func (*EmptyLinesRule) Name() string

Name returns the rule name.

type EnforceMapStyleRule added in v1.3.4

type EnforceMapStyleRule struct {
	// contains filtered or unexported fields
}

EnforceMapStyleRule implements a rule to enforce `make(map[type]type)` over `map[type]type{}`.

func (*EnforceMapStyleRule) Apply added in v1.3.4

func (r *EnforceMapStyleRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*EnforceMapStyleRule) Configure added in v1.6.0

func (r *EnforceMapStyleRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*EnforceMapStyleRule) Name added in v1.3.4

func (*EnforceMapStyleRule) Name() string

Name returns the rule name.

type EnforceRepeatedArgTypeStyleRule added in v1.3.5

type EnforceRepeatedArgTypeStyleRule struct {
	// contains filtered or unexported fields
}

EnforceRepeatedArgTypeStyleRule implements a rule to enforce repeated argument type style.

func (*EnforceRepeatedArgTypeStyleRule) Apply added in v1.3.5

Apply applies the rule to a given file.

func (*EnforceRepeatedArgTypeStyleRule) Configure added in v1.6.0

func (r *EnforceRepeatedArgTypeStyleRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*EnforceRepeatedArgTypeStyleRule) Name added in v1.3.5

Name returns the name of the linter rule.

type EnforceSliceStyleRule added in v1.3.5

type EnforceSliceStyleRule struct {
	// contains filtered or unexported fields
}

EnforceSliceStyleRule implements a rule to enforce `make([]type)` over `[]type{}`.

func (*EnforceSliceStyleRule) Apply added in v1.3.5

func (r *EnforceSliceStyleRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*EnforceSliceStyleRule) Configure added in v1.6.0

func (r *EnforceSliceStyleRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*EnforceSliceStyleRule) Name added in v1.3.5

func (*EnforceSliceStyleRule) Name() string

Name returns the rule name.

type EnforceSwitchStyleRule added in v1.11.0

type EnforceSwitchStyleRule struct {
	// contains filtered or unexported fields
}

EnforceSwitchStyleRule implements a rule to enforce default clauses use and/or position.

func (*EnforceSwitchStyleRule) Apply added in v1.11.0

func (r *EnforceSwitchStyleRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*EnforceSwitchStyleRule) Configure added in v1.11.0

func (r *EnforceSwitchStyleRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*EnforceSwitchStyleRule) Name added in v1.11.0

Name returns the rule name.

type ErrorNamingRule

type ErrorNamingRule struct{}

ErrorNamingRule lints naming of error variables.

func (*ErrorNamingRule) Apply

func (*ErrorNamingRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*ErrorNamingRule) Name

func (*ErrorNamingRule) Name() string

Name returns the rule name.

type ErrorReturnRule

type ErrorReturnRule struct{}

ErrorReturnRule ensures that the error return parameter is the last parameter.

func (*ErrorReturnRule) Apply

func (*ErrorReturnRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*ErrorReturnRule) Name

func (*ErrorReturnRule) Name() string

Name returns the rule name.

type ErrorStringsRule

type ErrorStringsRule struct {
	// contains filtered or unexported fields
}

ErrorStringsRule lints error strings.

func (*ErrorStringsRule) Apply

func (r *ErrorStringsRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*ErrorStringsRule) Configure added in v1.6.0

func (r *ErrorStringsRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*ErrorStringsRule) Name

func (*ErrorStringsRule) Name() string

Name returns the rule name.

type ErrorfRule

type ErrorfRule struct{}

ErrorfRule suggests using `fmt.Errorf` instead of `errors.New(fmt.Sprintf())`.

func (*ErrorfRule) Apply

func (*ErrorfRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*ErrorfRule) Name

func (*ErrorfRule) Name() string

Name returns the rule name.

type ExportedRule

type ExportedRule struct {
	// contains filtered or unexported fields
}

ExportedRule lints naming and commenting conventions on exported symbols.

func (*ExportedRule) Apply

func (r *ExportedRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*ExportedRule) Configure added in v1.6.0

func (r *ExportedRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configure makes the rule implement the lint.ConfigurableRule interface.

func (*ExportedRule) Name

func (*ExportedRule) Name() string

Name returns the rule name.

type FileHeaderRule

type FileHeaderRule struct {
	// contains filtered or unexported fields
}

FileHeaderRule lints the header that each file should have.

func (*FileHeaderRule) Apply

func (r *FileHeaderRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*FileHeaderRule) Configure added in v1.6.0

func (r *FileHeaderRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*FileHeaderRule) Name

func (*FileHeaderRule) Name() string

Name returns the rule name.

type FileLengthLimitRule added in v1.5.0

type FileLengthLimitRule struct {
	// contains filtered or unexported fields
}

FileLengthLimitRule lints the number of lines in a file.

func (*FileLengthLimitRule) Apply added in v1.5.0

func (r *FileLengthLimitRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*FileLengthLimitRule) Configure added in v1.6.0

func (r *FileLengthLimitRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*FileLengthLimitRule) Name added in v1.5.0

func (*FileLengthLimitRule) Name() string

Name returns the rule name.

type FilenameFormatRule added in v1.5.0

type FilenameFormatRule struct {
	// contains filtered or unexported fields
}

FilenameFormatRule lints source filenames according to a set of regular expressions given as arguments.

func (*FilenameFormatRule) Apply added in v1.5.0

func (r *FilenameFormatRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to the given file.

func (*FilenameFormatRule) Configure added in v1.6.0

func (r *FilenameFormatRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*FilenameFormatRule) Name added in v1.5.0

func (*FilenameFormatRule) Name() string

Name returns the rule name.

type FlagParamRule

type FlagParamRule struct{}

FlagParamRule warns on boolean parameters that create a control coupling.

func (*FlagParamRule) Apply

func (*FlagParamRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*FlagParamRule) Name

func (*FlagParamRule) Name() string

Name returns the rule name.

type ForbiddenCallInWgGoRule added in v1.13.0

type ForbiddenCallInWgGoRule struct{}

ForbiddenCallInWgGoRule spots calls to panic or wg.Done when using WaitGroup.Go.

func (*ForbiddenCallInWgGoRule) Apply added in v1.13.0

Apply applies the rule to given file.

func (*ForbiddenCallInWgGoRule) Name added in v1.13.0

Name returns the rule name.

type FunctionLength added in v1.0.5

type FunctionLength struct {
	// contains filtered or unexported fields
}

FunctionLength lint.

func (*FunctionLength) Apply added in v1.0.5

func (r *FunctionLength) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*FunctionLength) Configure added in v1.6.0

func (r *FunctionLength) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*FunctionLength) Name added in v1.0.5

func (*FunctionLength) Name() string

Name returns the rule name.

type FunctionResultsLimitRule

type FunctionResultsLimitRule struct {
	// contains filtered or unexported fields
}

FunctionResultsLimitRule limits the maximum number of results a function can return.

func (*FunctionResultsLimitRule) Apply

Apply applies the rule to given file.

func (*FunctionResultsLimitRule) Configure added in v1.6.0

func (r *FunctionResultsLimitRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*FunctionResultsLimitRule) Name

Name returns the rule name.

type GetReturnRule

type GetReturnRule struct{}

GetReturnRule warns on getters that do not yield any result.

func (*GetReturnRule) Apply

func (*GetReturnRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*GetReturnRule) Name

func (*GetReturnRule) Name() string

Name returns the rule name.

type IdenticalBranchesRule added in v1.0.3

type IdenticalBranchesRule struct{}

IdenticalBranchesRule warns on if...else statements with both branches being the same.

func (*IdenticalBranchesRule) Apply added in v1.0.3

Apply applies the rule to given file.

func (*IdenticalBranchesRule) Name added in v1.0.3

func (*IdenticalBranchesRule) Name() string

Name returns the rule name.

type IdenticalIfElseIfBranchesRule added in v1.12.0

type IdenticalIfElseIfBranchesRule struct{}

IdenticalIfElseIfBranchesRule warns on if...else if chains with identical branches.

func (*IdenticalIfElseIfBranchesRule) Apply added in v1.12.0

Apply applies the rule to given file.

func (*IdenticalIfElseIfBranchesRule) Name added in v1.12.0

Name returns the rule name.

type IdenticalIfElseIfConditionsRule added in v1.12.0

type IdenticalIfElseIfConditionsRule struct{}

IdenticalIfElseIfConditionsRule warns on if...else if chains with identical conditions.

func (*IdenticalIfElseIfConditionsRule) Apply added in v1.12.0

Apply applies the rule to given file.

func (*IdenticalIfElseIfConditionsRule) Name added in v1.12.0

Name returns the rule name.

type IdenticalSwitchBranchesRule added in v1.12.0

type IdenticalSwitchBranchesRule struct{}

IdenticalSwitchBranchesRule warns on identical switch branches.

func (*IdenticalSwitchBranchesRule) Apply added in v1.12.0

Apply applies the rule to given file.

func (*IdenticalSwitchBranchesRule) Name added in v1.12.0

Name returns the rule name.

type IdenticalSwitchConditionsRule added in v1.12.0

type IdenticalSwitchConditionsRule struct{}

IdenticalSwitchConditionsRule warns on switch case clauses with identical conditions.

func (*IdenticalSwitchConditionsRule) Apply added in v1.12.0

Apply applies the rule to given file.

func (*IdenticalSwitchConditionsRule) Name added in v1.12.0

Name returns the rule name.

type IfReturnRule

type IfReturnRule struct{}

IfReturnRule searches for redundant `if` when returning an error.

func (*IfReturnRule) Apply

func (*IfReturnRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*IfReturnRule) Name

func (*IfReturnRule) Name() string

Name returns the rule name.

type ImportAliasNamingRule added in v1.3.4

type ImportAliasNamingRule struct {
	// contains filtered or unexported fields
}

ImportAliasNamingRule lints import alias naming.

func (*ImportAliasNamingRule) Apply added in v1.3.4

func (r *ImportAliasNamingRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*ImportAliasNamingRule) Configure added in v1.6.0

func (r *ImportAliasNamingRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*ImportAliasNamingRule) Name added in v1.3.4

func (*ImportAliasNamingRule) Name() string

Name returns the rule name.

type ImportShadowingRule

type ImportShadowingRule struct{}

ImportShadowingRule spots identifiers that shadow an import.

func (*ImportShadowingRule) Apply

func (r *ImportShadowingRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*ImportShadowingRule) Name

func (*ImportShadowingRule) Name() string

Name returns the rule name.

type ImportsBlocklistRule added in v1.3.7

type ImportsBlocklistRule struct {
	// contains filtered or unexported fields
}

ImportsBlocklistRule disallows importing the specified packages.

func (*ImportsBlocklistRule) Apply added in v1.3.7

func (r *ImportsBlocklistRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*ImportsBlocklistRule) Configure added in v1.6.0

func (r *ImportsBlocklistRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*ImportsBlocklistRule) Name added in v1.3.7

func (*ImportsBlocklistRule) Name() string

Name returns the rule name.

type IncrementDecrementRule

type IncrementDecrementRule struct{}

IncrementDecrementRule lints `i += 1` and `i -= 1` constructs.

func (*IncrementDecrementRule) Apply

Apply applies the rule to given file.

func (*IncrementDecrementRule) Name

Name returns the rule name.

type IndentErrorFlowRule

type IndentErrorFlowRule struct {
	// contains filtered or unexported fields
}

IndentErrorFlowRule prevents redundant else statements.

func (*IndentErrorFlowRule) Apply

func (e *IndentErrorFlowRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*IndentErrorFlowRule) Configure added in v1.8.0

func (e *IndentErrorFlowRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*IndentErrorFlowRule) Name

func (*IndentErrorFlowRule) Name() string

Name returns the rule name.

type InefficientMapLookupRule added in v1.13.0

type InefficientMapLookupRule struct{}

InefficientMapLookupRule spots potential inefficient map lookups.

func (*InefficientMapLookupRule) Apply added in v1.13.0

Apply applies the rule to given file.

func (*InefficientMapLookupRule) Name added in v1.13.0

Name returns the rule name.

type LineLengthLimitRule

type LineLengthLimitRule struct {
	// contains filtered or unexported fields
}

LineLengthLimitRule lints number of characters in a line.

func (*LineLengthLimitRule) Apply

func (r *LineLengthLimitRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*LineLengthLimitRule) Configure added in v1.6.0

func (r *LineLengthLimitRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*LineLengthLimitRule) Name

func (*LineLengthLimitRule) Name() string

Name returns the rule name.

type MaxControlNestingRule added in v1.3.7

type MaxControlNestingRule struct {
	// contains filtered or unexported fields
}

MaxControlNestingRule sets restriction for maximum nesting of control structures.

func (*MaxControlNestingRule) Apply added in v1.3.7

func (r *MaxControlNestingRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*MaxControlNestingRule) Configure added in v1.6.0

func (r *MaxControlNestingRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*MaxControlNestingRule) Name added in v1.3.7

func (*MaxControlNestingRule) Name() string

Name returns the rule name.

type MaxPublicStructsRule

type MaxPublicStructsRule struct {
	// contains filtered or unexported fields
}

MaxPublicStructsRule lints the number of public structs in a file.

func (*MaxPublicStructsRule) Apply

func (r *MaxPublicStructsRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*MaxPublicStructsRule) Configure added in v1.6.0

func (r *MaxPublicStructsRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*MaxPublicStructsRule) Name

func (*MaxPublicStructsRule) Name() string

Name returns the rule name.

type ModifiesParamRule

type ModifiesParamRule struct{}

ModifiesParamRule warns on assignments to function parameters.

func (*ModifiesParamRule) Apply

func (*ModifiesParamRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*ModifiesParamRule) Name

func (*ModifiesParamRule) Name() string

Name returns the rule name.

type ModifiesValRecRule

type ModifiesValRecRule struct{}

ModifiesValRecRule lints assignments to value method-receivers.

func (*ModifiesValRecRule) Apply

func (r *ModifiesValRecRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*ModifiesValRecRule) Name

func (*ModifiesValRecRule) Name() string

Name returns the rule name.

type NestedStructs added in v1.0.8

type NestedStructs struct{}

NestedStructs lints nested structs.

func (*NestedStructs) Apply added in v1.0.8

func (*NestedStructs) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*NestedStructs) Name added in v1.0.8

func (*NestedStructs) Name() string

Name returns the rule name.

type OptimizeOperandsOrderRule added in v1.1.3

type OptimizeOperandsOrderRule struct{}

OptimizeOperandsOrderRule checks inefficient conditional expressions.

func (*OptimizeOperandsOrderRule) Apply added in v1.1.3

Apply applies the rule to given file.

func (*OptimizeOperandsOrderRule) Name added in v1.1.3

Name returns the rule name.

type PackageCommentsRule

type PackageCommentsRule struct {
	// contains filtered or unexported fields
}

PackageCommentsRule lints the package comments. It complains if there is no package comment, or if it is not of the right form. This has a notable false positive in that a package comment could rightfully appear in a different file of the same package, but that's not easy to fix since this linter is file-oriented.

func (*PackageCommentsRule) Apply

func (r *PackageCommentsRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*PackageCommentsRule) Name

func (*PackageCommentsRule) Name() string

Name returns the rule name.

type PackageDirectoryMismatchRule added in v1.12.0

type PackageDirectoryMismatchRule struct {
	// contains filtered or unexported fields
}

PackageDirectoryMismatchRule detects when package name doesn't match directory name.

func (*PackageDirectoryMismatchRule) Apply added in v1.12.0

Apply applies the rule to the given file.

func (*PackageDirectoryMismatchRule) Configure added in v1.12.0

func (r *PackageDirectoryMismatchRule) Configure(arguments lint.Arguments) error

Configure the rule to exclude certain directories.

func (*PackageDirectoryMismatchRule) Name added in v1.12.0

Name returns the rule name.

type RangeRule

type RangeRule struct{}

RangeRule prevents redundant variables when iterating over a collection.

func (*RangeRule) Apply

func (*RangeRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*RangeRule) Name

func (*RangeRule) Name() string

Name returns the rule name.

type RangeValAddress added in v1.0.2

type RangeValAddress struct{}

RangeValAddress warns if address of range value is used dangerously.

func (*RangeValAddress) Apply added in v1.0.2

func (*RangeValAddress) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*RangeValAddress) Name added in v1.0.2

func (*RangeValAddress) Name() string

Name returns the rule name.

type RangeValInClosureRule

type RangeValInClosureRule struct{}

RangeValInClosureRule warns if range value is used in a closure dispatched as goroutine.

func (*RangeValInClosureRule) Apply

Apply applies the rule to given file.

func (*RangeValInClosureRule) Name

func (*RangeValInClosureRule) Name() string

Name returns the rule name.

type ReceiverNamingRule

type ReceiverNamingRule struct {
	// contains filtered or unexported fields
}

ReceiverNamingRule lints a receiver name.

func (*ReceiverNamingRule) Apply

func (r *ReceiverNamingRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*ReceiverNamingRule) Configure added in v1.6.0

func (r *ReceiverNamingRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*ReceiverNamingRule) Name

func (*ReceiverNamingRule) Name() string

Name returns the rule name.

type RedefinesBuiltinIDRule

type RedefinesBuiltinIDRule struct{}

RedefinesBuiltinIDRule warns when a builtin identifier is shadowed.

func (*RedefinesBuiltinIDRule) Apply

Apply applies the rule to given file.

func (*RedefinesBuiltinIDRule) Name

Name returns the rule name.

type RedundantBuildTagRule added in v1.6.0

type RedundantBuildTagRule struct{}

RedundantBuildTagRule lints the presence of redundant build tags.

func (*RedundantBuildTagRule) Apply added in v1.6.0

Apply triggers if an old build tag `// +build` is found after a new one `//go:build`. `//go:build` comments are automatically added by gofmt when Go 1.17+ is used. See https://pkg.go.dev/cmd/go#hdr-Build_constraints

func (*RedundantBuildTagRule) Name added in v1.6.0

func (*RedundantBuildTagRule) Name() string

Name returns the rule name.

type RedundantImportAlias added in v1.3.3

type RedundantImportAlias struct{}

RedundantImportAlias warns on import aliases matching the imported package name.

func (*RedundantImportAlias) Apply added in v1.3.3

Apply applies the rule to given file.

func (*RedundantImportAlias) Name added in v1.3.3

func (*RedundantImportAlias) Name() string

Name returns the rule name.

type RedundantTestMainExitRule added in v1.6.1

type RedundantTestMainExitRule struct{}

RedundantTestMainExitRule suggests removing Exit call in TestMain function for test files.

func (*RedundantTestMainExitRule) Apply added in v1.6.1

Apply applies the rule to given file.

func (*RedundantTestMainExitRule) Name added in v1.6.1

Name returns the rule name.

type StringFormatRule added in v1.0.7

type StringFormatRule struct {
	// contains filtered or unexported fields
}

StringFormatRule lints strings and/or comments according to a set of regular expressions given as Arguments.

func (*StringFormatRule) Apply added in v1.0.7

func (r *StringFormatRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to the given file.

func (*StringFormatRule) Configure added in v1.8.0

func (r *StringFormatRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*StringFormatRule) Name added in v1.0.7

func (*StringFormatRule) Name() string

Name returns the rule name.

type StringOfIntRule added in v1.0.2

type StringOfIntRule struct{}

StringOfIntRule warns when logic expressions contains Boolean literals.

func (*StringOfIntRule) Apply added in v1.0.2

func (*StringOfIntRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*StringOfIntRule) Name added in v1.0.2

func (*StringOfIntRule) Name() string

Name returns the rule name.

type StructTagRule

type StructTagRule struct {
	// contains filtered or unexported fields
}

StructTagRule lints struct tags.

func (*StructTagRule) Apply

func (r *StructTagRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*StructTagRule) Configure added in v1.6.0

func (r *StructTagRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*StructTagRule) Name

func (*StructTagRule) Name() string

Name returns the rule name.

type SuperfluousElseRule

type SuperfluousElseRule struct {
	// contains filtered or unexported fields
}

SuperfluousElseRule lints given else constructs.

func (*SuperfluousElseRule) Apply

func (e *SuperfluousElseRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*SuperfluousElseRule) Configure added in v1.8.0

func (e *SuperfluousElseRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*SuperfluousElseRule) Name

func (*SuperfluousElseRule) Name() string

Name returns the rule name.

type TimeDateRule added in v1.10.0

type TimeDateRule struct{}

TimeDateRule lints the way time.Date is used.

func (*TimeDateRule) Apply added in v1.10.0

func (*TimeDateRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*TimeDateRule) Name added in v1.10.0

func (*TimeDateRule) Name() string

Name returns the rule name.

type TimeEqualRule added in v1.1.3

type TimeEqualRule struct{}

TimeEqualRule shows where "==" and "!=" used for equality check time.Time.

func (*TimeEqualRule) Apply added in v1.1.3

func (*TimeEqualRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*TimeEqualRule) Name added in v1.1.3

func (*TimeEqualRule) Name() string

Name returns the rule name.

type TimeNamingRule

type TimeNamingRule struct{}

TimeNamingRule lints the name of a time variable.

func (*TimeNamingRule) Apply

func (*TimeNamingRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*TimeNamingRule) Name

func (*TimeNamingRule) Name() string

Name returns the rule name.

type UncheckedTypeAssertionRule added in v1.3.4

type UncheckedTypeAssertionRule struct {
	// contains filtered or unexported fields
}

UncheckedTypeAssertionRule lints missing or ignored `ok`-value in dynamic type casts.

func (*UncheckedTypeAssertionRule) Apply added in v1.3.4

Apply applies the rule to given file.

func (*UncheckedTypeAssertionRule) Configure added in v1.6.0

func (r *UncheckedTypeAssertionRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*UncheckedTypeAssertionRule) Name added in v1.3.4

Name returns the rule name.

type UnconditionalRecursionRule added in v1.0.3

type UnconditionalRecursionRule struct{}

UnconditionalRecursionRule warns on function calls that will lead to infinite recursion.

func (*UnconditionalRecursionRule) Apply added in v1.0.3

Apply applies the rule to given file.

func (*UnconditionalRecursionRule) Name added in v1.0.3

Name returns the rule name.

type UnexportedNamingRule added in v1.0.3

type UnexportedNamingRule struct{}

UnexportedNamingRule lints wrongly named unexported symbols.

func (*UnexportedNamingRule) Apply added in v1.0.3

Apply applies the rule to given file.

func (*UnexportedNamingRule) Name added in v1.0.3

func (*UnexportedNamingRule) Name() string

Name returns the rule name.

type UnexportedReturnRule

type UnexportedReturnRule struct{}

UnexportedReturnRule warns when a public return is from unexported type.

func (*UnexportedReturnRule) Apply

Apply applies the rule to given file.

func (*UnexportedReturnRule) Name

func (*UnexportedReturnRule) Name() string

Name returns the rule name.

type UnhandledErrorRule

type UnhandledErrorRule struct {
	// contains filtered or unexported fields
}

UnhandledErrorRule warns on unhandled errors returned by function calls.

func (*UnhandledErrorRule) Apply

func (r *UnhandledErrorRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*UnhandledErrorRule) Configure added in v1.6.0

func (r *UnhandledErrorRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*UnhandledErrorRule) Name

func (*UnhandledErrorRule) Name() string

Name returns the rule name.

type UnnecessaryFormatRule added in v1.10.0

type UnnecessaryFormatRule struct{}

UnnecessaryFormatRule spots calls to formatting functions without leveraging formatting directives.

func (*UnnecessaryFormatRule) Apply added in v1.10.0

Apply applies the rule to given file.

func (*UnnecessaryFormatRule) Name added in v1.10.0

func (*UnnecessaryFormatRule) Name() string

Name returns the rule name.

type UnnecessaryIfRule added in v1.13.0

type UnnecessaryIfRule struct{}

UnnecessaryIfRule warns on if...else statements that can be replaced by simpler expressions.

func (*UnnecessaryIfRule) Apply added in v1.13.0

func (*UnnecessaryIfRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*UnnecessaryIfRule) Name added in v1.13.0

func (*UnnecessaryIfRule) Name() string

Name returns the rule name.

type UnnecessaryStmtRule

type UnnecessaryStmtRule struct{}

UnnecessaryStmtRule warns on unnecessary statements.

func (*UnnecessaryStmtRule) Apply

func (*UnnecessaryStmtRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*UnnecessaryStmtRule) Name

func (*UnnecessaryStmtRule) Name() string

Name returns the rule name.

type UnreachableCodeRule

type UnreachableCodeRule struct{}

UnreachableCodeRule lints unreachable code.

func (*UnreachableCodeRule) Apply

func (*UnreachableCodeRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*UnreachableCodeRule) Name

func (*UnreachableCodeRule) Name() string

Name returns the rule name.

type UnsecureURLSchemeRule added in v1.12.0

type UnsecureURLSchemeRule struct{}

UnsecureURLSchemeRule checks if a file contains string literals with unsecure URL schemes (for example: http://... in place of https://...).

func (*UnsecureURLSchemeRule) Apply added in v1.12.0

Apply applied the rule to the given file.

func (*UnsecureURLSchemeRule) Name added in v1.12.0

func (*UnsecureURLSchemeRule) Name() string

Name returns the rule name.

type UnusedParamRule

type UnusedParamRule struct {
	// contains filtered or unexported fields
}

UnusedParamRule lints unused params in functions.

func (*UnusedParamRule) Apply

func (r *UnusedParamRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*UnusedParamRule) Configure added in v1.6.0

func (r *UnusedParamRule) Configure(args lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*UnusedParamRule) Name

func (*UnusedParamRule) Name() string

Name returns the rule name.

type UnusedReceiverRule

type UnusedReceiverRule struct {
	// contains filtered or unexported fields
}

UnusedReceiverRule lints unused receivers in functions.

func (*UnusedReceiverRule) Apply

func (r *UnusedReceiverRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*UnusedReceiverRule) Configure added in v1.6.0

func (r *UnusedReceiverRule) Configure(args lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*UnusedReceiverRule) Name

func (*UnusedReceiverRule) Name() string

Name returns the rule name.

type UseAnyRule added in v1.2.0

type UseAnyRule struct{}

UseAnyRule proposes to replace `interface{}` with its alias `any`.

func (*UseAnyRule) Apply added in v1.2.0

func (*UseAnyRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*UseAnyRule) Name added in v1.2.0

func (*UseAnyRule) Name() string

Name returns the rule name.

type UseErrorsNewRule added in v1.6.0

type UseErrorsNewRule struct{}

UseErrorsNewRule spots calls to fmt.Errorf that can be replaced by errors.New.

func (*UseErrorsNewRule) Apply added in v1.6.0

func (*UseErrorsNewRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*UseErrorsNewRule) Name added in v1.6.0

func (*UseErrorsNewRule) Name() string

Name returns the rule name.

type UseFmtPrintRule added in v1.10.0

type UseFmtPrintRule struct{}

UseFmtPrintRule lints calls to print and println.

func (*UseFmtPrintRule) Apply added in v1.10.0

func (r *UseFmtPrintRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*UseFmtPrintRule) Name added in v1.10.0

func (*UseFmtPrintRule) Name() string

Name returns the rule name.

type UseWaitGroupGoRule added in v1.12.0

type UseWaitGroupGoRule struct{}

UseWaitGroupGoRule spots Go idioms that might be rewritten using WaitGroup.Go.

func (*UseWaitGroupGoRule) Apply added in v1.12.0

func (*UseWaitGroupGoRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*UseWaitGroupGoRule) Name added in v1.12.0

func (*UseWaitGroupGoRule) Name() string

Name returns the rule name.

type UselessBreak added in v1.1.0

type UselessBreak struct{}

UselessBreak lint rule.

func (*UselessBreak) Apply added in v1.1.0

func (*UselessBreak) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*UselessBreak) Name added in v1.1.0

func (*UselessBreak) Name() string

Name returns the rule name.

type UselessFallthroughRule added in v1.12.0

type UselessFallthroughRule struct{}

UselessFallthroughRule warns on useless fallthroughs in switch case clauses.

func (*UselessFallthroughRule) Apply added in v1.12.0

Apply applies the rule to given file.

func (*UselessFallthroughRule) Name added in v1.12.0

Name returns the rule name.

type VarDeclarationsRule

type VarDeclarationsRule struct{}

VarDeclarationsRule reduces redundancies around variable declaration.

func (*VarDeclarationsRule) Apply

func (*VarDeclarationsRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*VarDeclarationsRule) Name

func (*VarDeclarationsRule) Name() string

Name returns the rule name.

type VarNamingRule

type VarNamingRule struct {
	// contains filtered or unexported fields
}

VarNamingRule lints the name of a variable.

func (*VarNamingRule) Apply

func (r *VarNamingRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure

Apply applies the rule to given file.

func (*VarNamingRule) Configure added in v1.6.0

func (r *VarNamingRule) Configure(arguments lint.Arguments) error

Configure validates the rule configuration, and configures the rule accordingly.

Configuration implements the lint.ConfigurableRule interface.

func (*VarNamingRule) Name

func (*VarNamingRule) Name() string

Name returns the rule name.

type WaitGroupByValueRule

type WaitGroupByValueRule struct{}

WaitGroupByValueRule lints sync.WaitGroup passed by copy in functions.

func (*WaitGroupByValueRule) Apply

Apply applies the rule to given file.

func (*WaitGroupByValueRule) Name

func (*WaitGroupByValueRule) Name() string

Name returns the rule name.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL