mirror of
https://github.com/github/codeql.git
synced 2026-02-14 14:11:20 +01:00
29 lines
669 B
Plaintext
29 lines
669 B
Plaintext
import javascript
|
|
|
|
class Assertion extends CallExpr {
|
|
Assertion() {
|
|
getCalleeName() = "checkDeep" or
|
|
getCalleeName() = "checkShallow"
|
|
}
|
|
|
|
predicate shouldBeDeep() {
|
|
getCalleeName() = "checkDeep"
|
|
}
|
|
|
|
ExtendCall getExtendCall() { result = getArgument(0).flow() }
|
|
|
|
string getMessage() {
|
|
if not exists(getExtendCall()) then
|
|
result = "Not an extend call"
|
|
else if shouldBeDeep() and not getExtendCall().isDeep() then
|
|
result = "Not deep"
|
|
else if not shouldBeDeep() and getExtendCall().isDeep() then
|
|
result = "Not shallow"
|
|
else
|
|
result = "OK"
|
|
}
|
|
}
|
|
|
|
from Assertion assertion
|
|
select assertion, assertion.getMessage()
|