From ea1503ce2c6c571fa5165573f889afaff5c4629c Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Thu, 24 Feb 2022 14:41:27 +0100 Subject: [PATCH] fix ql-for-ql errors inside ql-for-ql --- ql/ql/src/codeql_ql/ast/Ast.qll | 4 ++-- ql/ql/src/ide-contextual-queries/printAst.ql | 2 +- .../src/queries/style/RegexpInsteadOfPattern.ql | 17 ++++++++++------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ql/ql/src/codeql_ql/ast/Ast.qll b/ql/ql/src/codeql_ql/ast/Ast.qll index be2973d5ddf..95d01936f03 100644 --- a/ql/ql/src/codeql_ql/ast/Ast.qll +++ b/ql/ql/src/codeql_ql/ast/Ast.qll @@ -415,7 +415,7 @@ class ClasslessPredicate extends TClasslessPredicate, Predicate, ModuleDeclarati ClasslessPredicate() { this = TClasslessPredicate(pred) } /** - * If this predicate is an alias, gets the aliased value. + * Gets the aliased value if this predicate is an alias * E.g. for `predicate foo = Module::bar/2;` gets `Module::bar/2`. * The result is either a `PredicateExpr` or `HigherOrderFormula`. */ @@ -1672,7 +1672,7 @@ class Rank extends Aggregate { override string getAPrimaryQlClass() { result = "Rank" } /** - * The `i` in `rank[i]( | | )`. + * Gets the `i` in `rank[i]( | | )`. */ Expr getRankExpr() { toQL(result) = this.getAggregate().getChild(1) } diff --git a/ql/ql/src/ide-contextual-queries/printAst.ql b/ql/ql/src/ide-contextual-queries/printAst.ql index a0c394c4aec..1016fe810da 100644 --- a/ql/ql/src/ide-contextual-queries/printAst.ql +++ b/ql/ql/src/ide-contextual-queries/printAst.ql @@ -13,7 +13,7 @@ import codeql_ql.printAstAst import codeql.IDEContextual /** - * The source file to generate an AST from. + * Gets the source file to generate an AST from. */ external string selectedSourceFile(); diff --git a/ql/ql/src/queries/style/RegexpInsteadOfPattern.ql b/ql/ql/src/queries/style/RegexpInsteadOfPattern.ql index 69541ed30eb..4e65b9f7d1a 100644 --- a/ql/ql/src/queries/style/RegexpInsteadOfPattern.ql +++ b/ql/ql/src/queries/style/RegexpInsteadOfPattern.ql @@ -13,13 +13,16 @@ import ql * Gets a regular expression pattern that matches the syntax of likely regular expressions. */ private string getALikelyRegExpPattern() { - result = "/.*/[gimuy]{1,5}" or // pattern with at least one flag: /foo/i - result = "/\\^.*/[gimuy]{0,5}" or // pattern with anchor: /^foo/ - result = "/.*\\$/[gimuy]{0,5}" or // pattern with anchor: /foo$/ - result = "\\^.*\\$" or // pattern body with anchors: ^foo$ - result = ".*(?