Skip to content

Commit d008975

Browse files
authored
Merge pull request #9825 from erik-krogh/repeatedWord
QL: add ql/repeated-word query
2 parents 30ff18a + 559ec7b commit d008975

File tree

17 files changed

+62
-18
lines changed

17 files changed

+62
-18
lines changed

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowUtil.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ private predicate exprToExprStep_nocfg(Expr fromExpr, Expr toExpr) {
699699
call.getTarget() = f and
700700
// AST dataflow treats a reference as if it were the referred-to object, while the dataflow
701701
// models treat references as pointers. If the return type of the call is a reference, then
702-
// look for data flow the the referred-to object, rather than the reference itself.
702+
// look for data flow to the referred-to object, rather than the reference itself.
703703
if call.getType().getUnspecifiedType() instanceof ReferenceType
704704
then outModel.isReturnValueDeref()
705705
else outModel.isReturnValue()

cpp/ql/lib/semmle/code/cpp/rangeanalysis/SimpleRangeAnalysis.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1573,7 +1573,7 @@ private module SimpleRangeAnalysisCached {
15731573
result = min([max(getTruncatedUpperBounds(expr)), getGuardedUpperBound(expr)])
15741574
}
15751575

1576-
/** Holds if the upper bound of `expr` may have been widened. This means the the upper bound is in practice likely to be overly wide. */
1576+
/** Holds if the upper bound of `expr` may have been widened. This means the upper bound is in practice likely to be overly wide. */
15771577
cached
15781578
predicate upperBoundMayBeWidened(Expr e) {
15791579
isRecursiveExpr(e) and

csharp/ql/lib/semmle/code/csharp/controlflow/internal/ControlFlowGraphImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ module Expressions {
335335
// ```csharp
336336
// new Dictionary<int, string>() { [0] = "Zero", [1] = "One", [2] = "Two" }
337337
// ```
338-
// need special treatment, because the the accesses `[0]`, `[1]`, and `[2]`
338+
// need special treatment, because the accesses `[0]`, `[1]`, and `[2]`
339339
// have no qualifier.
340340
this = any(MemberInitializer mi).getLValue()
341341
}

csharp/ql/src/Telemetry/ExternalApi.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class ExternalApi extends DotNet::Callable {
8585
defaultAdditionalTaintStep(this.getAnInput(), _)
8686
}
8787

88-
/** Holds if this API is is a constructor without parameters. */
88+
/** Holds if this API is a constructor without parameters. */
8989
private predicate isParameterlessConstructor() {
9090
this instanceof Constructor and this.getNumberOfParameters() = 0
9191
}

go/ql/src/RedundantCode/DuplicateSwitchCase.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import go
1515

16-
/** Gets the global value number of of `e`, which is the `i`th case label of `switch`. */
16+
/** Gets the global value number of `e`, which is the `i`th case label of `switch`. */
1717
GVN switchCaseGVN(SwitchStmt switch, int i, Expr e) {
1818
e = switch.getCase(i).getExpr(0) and result = e.getGlobalValueNumber()
1919
}

java/ql/src/Telemetry/ExternalApi.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class ExternalApi extends Callable {
7373
TaintTracking::localAdditionalTaintStep(this.getAnInput(), _)
7474
}
7575

76-
/** Holds if this API is is a constructor without parameters. */
76+
/** Holds if this API is a constructor without parameters. */
7777
private predicate isParameterlessConstructor() {
7878
this instanceof Constructor and this.getNumberOfParameters() = 0
7979
}

python/ql/lib/semmle/python/Frameworks.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Helper file that imports all framework modeling.
33
*/
44

5-
// If you add modeling of a new framework/library, remember to add it it to the docs in
5+
// If you add modeling of a new framework/library, remember to add it to the docs in
66
// `docs/codeql/support/reusables/frameworks.rst`
77
private import semmle.python.frameworks.Aioch
88
private import semmle.python.frameworks.Aiohttp

python/ql/lib/semmle/python/dataflow/old/TaintTracking.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ abstract class Sanitizer extends string {
333333
/** Holds if `taint` cannot flow through `node`. */
334334
predicate sanitizingNode(TaintKind taint, ControlFlowNode node) { none() }
335335

336-
/** Holds if `call` removes removes the `taint` */
336+
/** Holds if `call` removes the `taint` */
337337
predicate sanitizingCall(TaintKind taint, FunctionObject callee) { none() }
338338

339339
/** Holds if `test` shows value to be untainted with `taint` */

ql/ql/src/codeql_ql/ast/Ast.qll

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,28 +156,42 @@ class TopLevel extends TTopLevel, AstNode {
156156
override QLDoc getQLDoc() { result = this.getMember(0) }
157157
}
158158

159-
class QLDoc extends TQLDoc, AstNode {
159+
abstract class Comment extends AstNode, TComment {
160+
abstract string getContents();
161+
}
162+
163+
class QLDoc extends TQLDoc, Comment {
160164
QL::Qldoc qldoc;
161165

162166
QLDoc() { this = TQLDoc(qldoc) }
163167

164-
string getContents() { result = qldoc.getValue() }
168+
override string getContents() { result = qldoc.getValue() }
165169

166170
override string getAPrimaryQlClass() { result = "QLDoc" }
167171

168172
override AstNode getParent() { result.getQLDoc() = this }
169173
}
170174

171-
class BlockComment extends TBlockComment, AstNode {
175+
class BlockComment extends TBlockComment, Comment {
172176
QL::BlockComment comment;
173177

174178
BlockComment() { this = TBlockComment(comment) }
175179

176-
string getContents() { result = comment.getValue() }
180+
override string getContents() { result = comment.getValue() }
177181

178182
override string getAPrimaryQlClass() { result = "BlockComment" }
179183
}
180184

185+
class LineComment extends TLineComment, Comment {
186+
QL::LineComment comment;
187+
188+
LineComment() { this = TLineComment(comment) }
189+
190+
override string getContents() { result = comment.getValue() }
191+
192+
override string getAPrimaryQlClass() { result = "LineComment" }
193+
}
194+
181195
/**
182196
* The `from, where, select` part of a QL query.
183197
*/

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ newtype TAstNode =
77
TTopLevel(QL::Ql file) or
88
TQLDoc(QL::Qldoc qldoc) or
99
TBlockComment(QL::BlockComment comment) or
10+
TLineComment(QL::LineComment comment) or
1011
TClasslessPredicate(QL::ClasslessPredicate pred) or
1112
TVarDecl(QL::VarDecl decl) or
1213
TFieldDecl(QL::Field field) or
@@ -89,6 +90,8 @@ class TYamlNode = TYamlCommemt or TYamlEntry or TYamlKey or TYamlListitem or TYa
8990

9091
class TSignatureExpr = TPredicateExpr or TType;
9192

93+
class TComment = TQLDoc or TBlockComment or TLineComment;
94+
9295
/** DEPRECATED: Alias for TYamlNode */
9396
deprecated class TYAMLNode = TYamlNode;
9497

@@ -154,6 +157,8 @@ QL::AstNode toQL(AST::AstNode n) {
154157
or
155158
n = TBlockComment(result)
156159
or
160+
n = TLineComment(result)
161+
or
157162
n = TClasslessPredicate(result)
158163
or
159164
n = TVarDecl(result)

0 commit comments

Comments
 (0)