mirror of
				https://github.com/mgechev/revive.git
				synced 2025-10-30 23:37:49 +02:00 
			
		
		
		
	Prevent empty-block when looping over call expr
This commit is contained in:
		
				
					committed by
					
						 chavacava
						chavacava
					
				
			
			
				
	
			
			
			
						parent
						
							dc6909b49f
						
					
				
				
					commit
					55585666b7
				
			| @@ -43,6 +43,13 @@ func (w lintEmptyBlock) Visit(node ast.Node) ast.Visitor { | ||||
| 	case *ast.SelectStmt: | ||||
| 		w.ignore[n.Body] = true | ||||
| 		return w | ||||
| 	case *ast.ForStmt: | ||||
| 		if len(n.Body.List) == 0 && n.Init == nil && n.Post == nil && n.Cond != nil { | ||||
| 			if _, isCall := n.Cond.(*ast.CallExpr); isCall { | ||||
| 				w.ignore[n.Body] = true | ||||
| 				return w | ||||
| 			} | ||||
| 		} | ||||
| 	case *ast.RangeStmt: | ||||
| 		if len(n.Body.List) == 0 { | ||||
| 			w.onFailure(lint.Failure{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user