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