mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
Move usage count into where clause
This commit is contained in:
@@ -10,7 +10,7 @@ private import semmle.code.java.dataflow.ExternalFlow
|
||||
class ExternalAPI extends Callable {
|
||||
ExternalAPI() { not this.fromSource() }
|
||||
|
||||
/** Holds true if this API is part of a common testing library or framework */
|
||||
/** Holds if this API is part of a common testing library or framework */
|
||||
predicate isTestLibrary() { getDeclaringType() instanceof TestLibrary }
|
||||
|
||||
/**
|
||||
@@ -22,7 +22,7 @@ class ExternalAPI extends Callable {
|
||||
";" + api.getName() + ";" + paramsString(api)
|
||||
}
|
||||
|
||||
/** Holds true if this API is not yet supported by existing CodeQL libraries */
|
||||
/** Holds if this API is not yet supported by existing CodeQL libraries */
|
||||
predicate isSupported() { not supportKind(this) = "?" }
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,12 +11,13 @@ import APIUsage
|
||||
import ExternalAPI
|
||||
import semmle.code.java.GeneratedFiles
|
||||
|
||||
from ExternalAPI api
|
||||
from ExternalAPI api, int usages
|
||||
where
|
||||
not api.isTestLibrary() and
|
||||
supportKind(api) = "sink"
|
||||
select api.asCsv(api) as csv,
|
||||
strictcount(Call c |
|
||||
c.getCallee() = api and
|
||||
not c.getFile() instanceof GeneratedFile
|
||||
) as Usages order by Usages desc
|
||||
supportKind(api) = "sink" and
|
||||
usages =
|
||||
strictcount(Call c |
|
||||
c.getCallee().getSourceDeclaration() = api and
|
||||
not c.getFile() instanceof GeneratedFile
|
||||
)
|
||||
select api.asCsv(api) as csv, usages order by usages desc
|
||||
|
||||
@@ -17,7 +17,7 @@ where
|
||||
supportKind(api) = "source" and
|
||||
usages =
|
||||
strictcount(Call c |
|
||||
c.getCallee() = api and
|
||||
c.getCallee().getSourceDeclaration() = api and
|
||||
not c.getFile() instanceof GeneratedFile
|
||||
)
|
||||
select api.asCsv(api) as csv, usages order by usages desc
|
||||
|
||||
@@ -11,12 +11,13 @@ import APIUsage
|
||||
import ExternalAPI
|
||||
import semmle.code.java.GeneratedFiles
|
||||
|
||||
from ExternalAPI api
|
||||
from ExternalAPI api, int usages
|
||||
where
|
||||
not api.isTestLibrary() and
|
||||
supportKind(api) = ["summary", "taint-preserving"]
|
||||
select api.asCsv(api) as csv,
|
||||
strictcount(Call c |
|
||||
c.getCallee() = api and
|
||||
not c.getFile() instanceof GeneratedFile
|
||||
) as Usages order by Usages desc
|
||||
supportKind(api) = ["summary", "taint-preserving"] and
|
||||
usages =
|
||||
strictcount(Call c |
|
||||
c.getCallee().getSourceDeclaration() = api and
|
||||
not c.getFile() instanceof GeneratedFile
|
||||
)
|
||||
select api.asCsv(api) as csv, usages order by usages desc
|
||||
|
||||
@@ -11,12 +11,13 @@ import APIUsage
|
||||
import ExternalAPI
|
||||
import semmle.code.java.GeneratedFiles
|
||||
|
||||
from ExternalAPI api
|
||||
from ExternalAPI api, int usages
|
||||
where
|
||||
not api.isTestLibrary() and
|
||||
not api.isSupported()
|
||||
select api.asCsv(api) as csv,
|
||||
strictcount(Call c |
|
||||
c.getCallee() = api and
|
||||
not c.getFile() instanceof GeneratedFile
|
||||
) as Usages order by Usages desc
|
||||
not api.isSupported() and
|
||||
usages =
|
||||
strictcount(Call c |
|
||||
c.getCallee().getSourceDeclaration() = api and
|
||||
not c.getFile() instanceof GeneratedFile
|
||||
)
|
||||
select api.asCsv(api) as csv, usages order by usages desc
|
||||
|
||||
Reference in New Issue
Block a user