Skip to content

Commit 605bfd6

Browse files
committed
move the "I don't care about parent relation on mocks" hack into the predicate, so the tests dont fail
1 parent 54072d2 commit 605bfd6

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

ql/ql/src/codeql_ql/ast/internal/AstNodes.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ class TVarDef = TVarDecl or TAsExpr;
238238

239239
module AstConsistency {
240240
import ql
241+
import codeql_ql.ast.internal.AstNodes as AstNodes
241242

242243
query predicate nonTotalGetParent(AstNode node) {
243244
exists(toQL(node).getParent()) and
@@ -247,5 +248,8 @@ module AstConsistency {
247248
not (node instanceof QLDoc and node.getLocation().getFile().getExtension() = "dbscheme") // qldoc in dbschemes are not hooked up
248249
}
249250

250-
query predicate nonUniqueParent(AstNode node) { count(node.getParent()) >= 2 }
251+
query predicate nonUniqueParent(AstNode node) {
252+
count(node.getParent()) >= 2 and
253+
not exists(AstNodes::toMock(node)) // we don't care about the mocks, they are nasty by design.
254+
}
251255
}

ql/ql/src/queries/diagnostics/EmptyConsistencies.ql

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import codeql_ql.ast.internal.Builtins::BuiltinsConsistency as BuiltinsConsisten
1515
import codeql_ql.ast.internal.Module::ModConsistency as ModConsistency
1616
import codeql_ql.ast.internal.Variable::VarConsistency as VarConsistency
1717
import codeql_ql.ast.internal.AstNodes::AstConsistency as AstConsistency
18-
import codeql_ql.ast.internal.AstNodes as AstNodes
1918

2019
from AstNode node, string msg
2120
where
@@ -43,9 +42,7 @@ where
4342
or
4443
AstConsistency::nonTotalGetParent(node) and msg = "AstConsistency::nonTotalGetParent"
4544
or
46-
AstConsistency::nonUniqueParent(node) and
47-
msg = "AstConsistency::nonUniqueParent" and
48-
not exists(AstNodes::toMock(node)) // we don't care about the mocks, they are nasty by design.
45+
AstConsistency::nonUniqueParent(node) and msg = "AstConsistency::nonUniqueParent"
4946
or
5047
TypeConsistency::noResolve(node) and msg = "TypeConsistency::noResolve"
5148
or

0 commit comments

Comments
 (0)