mirror of
				https://github.com/mgechev/revive.git
				synced 2025-10-30 23:37:49 +02:00 
			
		
		
		
	| @@ -52,7 +52,7 @@ type cognitiveComplexityLinter struct { | ||||
| func (w cognitiveComplexityLinter) lint() { | ||||
| 	f := w.file | ||||
| 	for _, decl := range f.AST.Decls { | ||||
| 		if fn, ok := decl.(*ast.FuncDecl); ok { | ||||
| 		if fn, ok := decl.(*ast.FuncDecl); ok && fn.Body != nil { | ||||
| 			v := cognitiveComplexityVisitor{} | ||||
| 			c := v.subTreeComplexity(fn.Body) | ||||
| 			if c > w.maxComplexity { | ||||
|   | ||||
							
								
								
									
										3
									
								
								testdata/cognitive-complexity.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								testdata/cognitive-complexity.go
									
									
									
									
										vendored
									
									
								
							| @@ -278,3 +278,6 @@ func (m *Migrator) MigrateIfNeeded(target *EtcdVersionPair) error { // MATCH /fu | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // no regression test for issue #451 | ||||
| func myFunc() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user