Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions java/ql/src/Likely Bugs/Statements/ReturnValueIgnored.ql
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ predicate isMustBeQualifierMockingMethod(Method m) {

predicate relevantMethodCall(MethodAccess ma, Method m) {
// For "return value ignored", all method calls are relevant.
not ma.getFile().isKotlinSourceFile() and
ma.getMethod() = m and
not m.getReturnType().hasName("void") and
(not isMockingMethod(m) or isMustBeQualifierMockingMethod(m)) and
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Likely Bugs/Statements/ReturnValueIgnored.ql
16 changes: 16 additions & 0 deletions java/ql/test/kotlin/query-tests/ReturnValueIgnored/Test.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Foo {
fun foo(): Int { return 5 }
fun bar() {
val x0 = foo()
val x1 = foo()
val x2 = foo()
val x3 = foo()
val x4 = foo()
val x5 = foo()
val x6 = foo()
val x7 = foo()
val x8 = foo()
val x9 = foo()
val x = if (true) { foo() } else 6
}
}