mirror of
https://github.com/mgechev/revive.git
synced 2025-01-10 03:17:11 +02:00
adds tests for Boolean expressions
This commit is contained in:
parent
e63e7cbd3d
commit
e4ac6611aa
@ -33,8 +33,8 @@ func g(f func() bool) string { // MATCH /function g has cognitive complexity 1 (
|
||||
}
|
||||
|
||||
// Test Boolean expr
|
||||
func h(a, b, c, d, e, f bool) bool { // MATCH /function h has cognitive complexity 2 (> max enabled 0)/
|
||||
return a && b && c || d || e && f //FIXME: complexity should be 3?
|
||||
func h(a, b, c, d, e, f bool) bool { // MATCH /function h has cognitive complexity 3 (> max enabled 0)/
|
||||
return a && b && c || d || e && f // +3
|
||||
}
|
||||
|
||||
func i(a, b, c, d, e, f bool) bool { // MATCH /function i has cognitive complexity 2 (> max enabled 0)/
|
||||
@ -47,6 +47,10 @@ func j(a, b, c, d, e, f bool) bool { // MATCH /function j has cognitive complexi
|
||||
return result
|
||||
}
|
||||
|
||||
func j1(a, b, c, d, e, f bool) bool { // MATCH /function j1 has cognitive complexity 2 (> max enabled 0)/
|
||||
return (a && !(b < 2) || c)
|
||||
}
|
||||
|
||||
// Test Switch expr
|
||||
func k(a, b, c, d, e, f bool) bool { // MATCH /function k has cognitive complexity 1 (> max enabled 0)/
|
||||
switch expr { // +1
|
||||
|
Loading…
Reference in New Issue
Block a user