mirror of
				https://github.com/mgechev/revive.git
				synced 2025-10-30 23:37:49 +02:00 
			
		
		
		
	cleanup: removes or names unused parameters and receivers to _ (#907)
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							36c2ee2718
						
					
				
				
					commit
					70ceb1cbfb
				
			| @@ -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 | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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) { | ||||
|   | ||||
| @@ -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) { | ||||
| @@ -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 | ||||
| @@ -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 | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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" | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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" | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user