Skip to content

Commit

Permalink
cleanup: removes or names unused parameters and receivers to _ (#907)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfederowicz committed Sep 24, 2023
1 parent 36c2ee2 commit 70ceb1c
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion revivelib/core_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (*mockRule) Name() string {
return "mock-rule"
}

func (*mockRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
func (*mockRule) Apply(_ *lint.File, _ lint.Arguments) []lint.Failure {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion rule/add-constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (w lintAddConstantRule) checkFunc(expr *ast.CallExpr) {
}
}

func (w lintAddConstantRule) getFuncName(expr *ast.CallExpr) string {
func (lintAddConstantRule) getFuncName(expr *ast.CallExpr) string {
switch f := expr.Fun.(type) {
case *ast.SelectorExpr:
switch prefix := f.X.(type) {
Expand Down
8 changes: 4 additions & 4 deletions rule/constant-logical-expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
type ConstantLogicalExprRule struct{}

// Apply applies the rule to given file.
func (r *ConstantLogicalExprRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure {
func (*ConstantLogicalExprRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure {
var failures []lint.Failure

onFailure := func(failure lint.Failure) {
Expand Down Expand Up @@ -63,7 +63,7 @@ func (w *lintConstantLogicalExpr) Visit(node ast.Node) ast.Visitor {
return w
}

func (w *lintConstantLogicalExpr) isOperatorWithLogicalResult(t token.Token) bool {
func (*lintConstantLogicalExpr) isOperatorWithLogicalResult(t token.Token) bool {
switch t {
case token.LAND, token.LOR, token.EQL, token.LSS, token.GTR, token.NEQ, token.LEQ, token.GEQ:
return true
Expand All @@ -72,7 +72,7 @@ func (w *lintConstantLogicalExpr) isOperatorWithLogicalResult(t token.Token) boo
return false
}

func (w *lintConstantLogicalExpr) isEqualityOperator(t token.Token) bool {
func (*lintConstantLogicalExpr) isEqualityOperator(t token.Token) bool {
switch t {
case token.EQL, token.LEQ, token.GEQ:
return true
Expand All @@ -81,7 +81,7 @@ func (w *lintConstantLogicalExpr) isEqualityOperator(t token.Token) bool {
return false
}

func (w *lintConstantLogicalExpr) isInequalityOperator(t token.Token) bool {
func (*lintConstantLogicalExpr) isInequalityOperator(t token.Token) bool {
switch t {
case token.LSS, token.GTR, token.NEQ:
return true
Expand Down
2 changes: 1 addition & 1 deletion rule/datarace.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (w lintDataRaces) Visit(n ast.Node) ast.Visitor {
return nil
}

func (w lintDataRaces) ExtractReturnIDs(fields []*ast.Field) map[*ast.Object]struct{} {
func (lintDataRaces) ExtractReturnIDs(fields []*ast.Field) map[*ast.Object]struct{} {
r := map[*ast.Object]struct{}{}
for _, f := range fields {
for _, id := range f.Names {
Expand Down
2 changes: 1 addition & 1 deletion rule/early-return.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (*EarlyReturnRule) Name() string {
}

// CheckIfElse evaluates the rule against an ifelse.Chain.
func (e *EarlyReturnRule) CheckIfElse(chain ifelse.Chain, args ifelse.Args) (failMsg string) {
func (*EarlyReturnRule) CheckIfElse(chain ifelse.Chain, args ifelse.Args) (failMsg string) {
if !chain.Else.Deviates() {
// this rule only applies if the else-block deviates control flow
return
Expand Down
2 changes: 1 addition & 1 deletion rule/enforce-map-style.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (r *EnforceMapStyleRule) Apply(file *lint.File, arguments lint.Arguments) [
}

// Name returns the rule name.
func (r *EnforceMapStyleRule) Name() string {
func (*EnforceMapStyleRule) Name() string {
return "enforce-map-style"
}

Expand Down
2 changes: 1 addition & 1 deletion rule/enforce-slice-style.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (r *EnforceSliceStyleRule) Apply(file *lint.File, arguments lint.Arguments)
}

// Name returns the rule name.
func (r *EnforceSliceStyleRule) Name() string {
func (*EnforceSliceStyleRule) Name() string {
return "enforce-slice-style"
}

Expand Down
2 changes: 1 addition & 1 deletion rule/indent-error-flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (*IndentErrorFlowRule) Name() string {
}

// CheckIfElse evaluates the rule against an ifelse.Chain.
func (e *IndentErrorFlowRule) CheckIfElse(chain ifelse.Chain, args ifelse.Args) (failMsg string) {
func (*IndentErrorFlowRule) CheckIfElse(chain ifelse.Chain, args ifelse.Args) (failMsg string) {
if !chain.If.Deviates() {
// this rule only applies if the if-block deviates control flow
return
Expand Down
2 changes: 1 addition & 1 deletion rule/superfluous-else.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (*SuperfluousElseRule) Name() string {
}

// CheckIfElse evaluates the rule against an ifelse.Chain.
func (e *SuperfluousElseRule) CheckIfElse(chain ifelse.Chain, args ifelse.Args) (failMsg string) {
func (*SuperfluousElseRule) CheckIfElse(chain ifelse.Chain, args ifelse.Args) (failMsg string) {
if !chain.If.Deviates() {
// this rule only applies if the if-block deviates control flow
return
Expand Down

0 comments on commit 70ceb1c

Please sign in to comment.