Skip to content

Commit 14b5f84

Browse files
committed
move the consistency predicates where they should be
1 parent 4be969c commit 14b5f84

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,4 +311,8 @@ module ModConsistency {
311311
c > 1 and
312312
resolveModuleExpr(me, m)
313313
}
314+
315+
query predicate noName(Module mod) { not exists(mod.getName()) }
316+
317+
query predicate nonUniqueName(Module mod) { count(mod.getName()) >= 2 }
314318
}

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,20 @@ where
3131
TypeConsistency::multiplePrimitivesExpr(node, _, _) and
3232
msg = "TypeConsistency::multiplePrimitivesExpr"
3333
or
34-
AstConsistency::nonTotalGetParent(node) and msg = "AstConsistency::nonTotalGetParent"
34+
AstConsistency::nonTotalGetParent(node) and msg = "AstConsistency::nonTotalGetParent" // TODO: unique parent
3535
or
3636
TypeConsistency::noResolve(node) and msg = "TypeConsistency::noResolve"
3737
or
3838
ModConsistency::noResolve(node) and msg = "ModConsistency::noResolve"
3939
or
4040
ModConsistency::noResolveModuleExpr(node) and msg = "ModConsistency::noResolveModuleExpr"
4141
or
42-
VarConsistency::noFieldDef(node) and msg = "VarConsistency::noFieldDef"
42+
ModConsistency::noName(node) and msg = "ModConsistency::noName"
4343
or
44-
VarConsistency::noVarDef(node) and msg = "VarConsistency::noVarDef"
44+
ModConsistency::nonUniqueName(node) and msg = "ModConsistency::nonUniqueName"
4545
or
46-
node instanceof ModuleExpr and
47-
not exists(node.(ModuleExpr).getName()) and
48-
msg = "exists(ModuleExpr::getName)"
46+
VarConsistency::noFieldDef(node) and msg = "VarConsistency::noFieldDef"
4947
or
50-
node instanceof ModuleExpr and
51-
count(node.(ModuleExpr).getName()) >= 2 and
52-
msg = "unique(ModuleExpr::getName)"
48+
VarConsistency::noVarDef(node) and msg = "VarConsistency::noVarDef"
5349
select node, msg
50+
// TODO: vardef consistency.

0 commit comments

Comments
 (0)