mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
Kotlin: Add FP test case for dead code queries
This commit is contained in:
@@ -14,6 +14,8 @@ import semmle.code.java.deadcode.DeadCode
|
||||
|
||||
from DeadClass c, Element origin, string reason
|
||||
where
|
||||
not c.getFile().isKotlinSourceFile() and
|
||||
not origin.getFile().isKotlinSourceFile() and
|
||||
if exists(DeadRoot root | root = c.getADeadRoot() | not root = c.getACallable())
|
||||
then (
|
||||
// Report a list of the dead roots.
|
||||
|
||||
@@ -15,6 +15,8 @@ import semmle.code.java.deadcode.DeadCode
|
||||
|
||||
from DeadField f, Element origin, string reason
|
||||
where
|
||||
not f.getFile().isKotlinSourceFile() and
|
||||
not origin.getFile().isKotlinSourceFile() and
|
||||
not f.isInDeadScope() and
|
||||
if f.getAnAccess() instanceof FieldRead
|
||||
then (
|
||||
|
||||
@@ -15,6 +15,8 @@ import semmle.code.java.deadcode.DeadCode
|
||||
|
||||
from DeadMethod c, Callable origin, string reason
|
||||
where
|
||||
not c.getFile().isKotlinSourceFile() and
|
||||
not origin.getFile().isKotlinSourceFile() and
|
||||
not c.isInDeadScope() and
|
||||
if exists(DeadRoot deadRoot | deadRoot = getADeadRoot(c) | deadRoot.getSourceDeclaration() != c)
|
||||
then (
|
||||
|
||||
Reference in New Issue
Block a user