mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Kotlin: Add FP test case for unnecessarily complex bool expression
This commit is contained in:
@@ -0,0 +1 @@
|
||||
| SimplifyBoolExpr.kt:8:8:8:16 | ... (value equals) ... | Expressions of the form "A == true" can be simplified to "A". |
|
||||
@@ -0,0 +1,13 @@
|
||||
fun main() {
|
||||
f(null)
|
||||
f(true)
|
||||
f(false)
|
||||
}
|
||||
|
||||
fun f(x: Boolean?) {
|
||||
if(x == true) {
|
||||
println("Yes")
|
||||
} else {
|
||||
println("No")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Violations of Best Practice/Boolean Logic/SimplifyBoolExpr.ql
|
||||
Reference in New Issue
Block a user