Skip to content

Commit 9612bb9

Browse files
authored
Merge pull request github#12246 from owen-mc/go/fix/misc
Fix miscellaneous errors highlighted by QL-for-QL
2 parents 7c9100c + 8e8ffb2 commit 9612bb9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+142
-150
lines changed

go/ql/lib/printAst.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ import semmle.go.PrintAst
1212
import ideContextual
1313

1414
/**
15-
* The source file to generate an AST from.
15+
* Gets the source file to generate an AST from.
1616
*/
1717
external string selectedSourceFile();
1818

1919
/**
20-
* Hook to customize the functions printed by this query.
20+
* A hook to customize the functions printed by this query.
2121
*/
2222
class Cfg extends PrintAstConfiguration {
2323
override predicate shouldPrintFunction(FuncDecl func) { shouldPrintFile(func.getFile()) }

go/ql/lib/semmle/go/Concepts.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ module FileSystemAccess {
115115
/** A function that escapes meta-characters to prevent injection attacks. */
116116
class EscapeFunction extends Function instanceof EscapeFunction::Range {
117117
/**
118-
* The context that this function escapes for.
118+
* Gets the context that this function escapes for.
119119
*
120120
* Currently, this can be "js", "html", or "url".
121121
*/
@@ -132,7 +132,7 @@ module EscapeFunction {
132132
*/
133133
abstract class Range extends Function {
134134
/**
135-
* The context that this function escapes for.
135+
* Gets the context that this function escapes for.
136136
*
137137
* Currently, this can be `js', `html', or `url'.
138138
*/

go/ql/lib/semmle/go/Files.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class Folder extends Container, @folder {
181181
override string getURL() { result = "folder://" + this.getAbsolutePath() }
182182
}
183183

184-
/** Any file, including files that have not been extracted but are referred to as locations for errors. */
184+
/** A file, including files that have not been extracted but are referred to as locations for errors. */
185185
class ExtractedOrExternalFile extends Container, @file, Documentable, ExprParent, GoModExprParent,
186186
DeclParent, ScopeNode
187187
{

go/ql/lib/semmle/go/PrintAst.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import go
99
import PrintAst
1010

1111
/**
12-
* Hook to customize the functions printed by this query.
12+
* A hook to customize the functions printed by this query.
1313
*/
1414
class Cfg extends PrintAstConfiguration {
1515
override predicate shouldPrintFunction(FuncDecl func) { any() }

go/ql/lib/semmle/go/PrintAst.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import go
66

77
/**
8-
* Hook to customize the files and functions printed by this module.
8+
* A hook to customize the files and functions printed by this module.
99
*
1010
* For an AstNode to be printed, it always requires `shouldPrintFile(f)` to hold
1111
* for its containing file `f`, and additionally requires `shouldPrintFunction(fun)`

go/ql/lib/semmle/go/Scopes.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ private newtype TCallable =
602602
TFuncLitCallable(FuncLit l)
603603

604604
/**
605-
* This is either a `Function` or a `FuncLit`, because of limitations of both
605+
* A `Function` or a `FuncLit`. We do it this way because of limitations of both
606606
* `Function` and `FuncDef`:
607607
* - `Function` is an entity, and therefore does not include function literals, and
608608
* - `FuncDef` is an AST node, and so is not extracted for functions from external libraries.

go/ql/lib/semmle/go/StringOps.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ module StringOps {
581581
}
582582

583583
/**
584-
* One of the operands in a string concatenation.
584+
* An operand in a string concatenation.
585585
*
586586
* See `ConcatenationElement` for more information.
587587
*/

go/ql/lib/semmle/go/Types.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class InvalidType extends @invalidtype, Type {
172172
/** A basic type. */
173173
class BasicType extends @basictype, Type { }
174174

175-
/** Either the normal or literal boolean type */
175+
/** The normal boolean type or the literal boolean type */
176176
class BoolType extends @booltype, BasicType { }
177177

178178
/** The `bool` type of a non-literal expression */
@@ -317,7 +317,7 @@ class Complex128Type extends @complex128type, ComplexType {
317317
override string getName() { result = "complex128" }
318318
}
319319

320-
/** Either the normal or literal string type */
320+
/** The normal string type or the literal string type */
321321
class StringType extends @stringtype, BasicType { }
322322

323323
/** The `string` type of a non-literal expression */

go/ql/lib/semmle/go/controlflow/ControlFlowGraphImpl.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,10 +1305,10 @@ module CFG {
13051305
exists(Completion inner | lastNode(this.getBody(), last, inner) and not inner.isNormal() |
13061306
if inner = Break(this.getLabel())
13071307
then cmpl = Done()
1308-
else
1309-
if inner = Continue(this.getLabel())
1310-
then none()
1311-
else cmpl = inner
1308+
else (
1309+
not inner = Continue(this.getLabel()) and
1310+
cmpl = inner
1311+
)
13121312
)
13131313
}
13141314
}

go/ql/lib/semmle/go/dataflow/SSA.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ private newtype TSsaWithFields =
310310
TStep(SsaWithFields base, Field f) { exists(accessPathAux(base, f)) }
311311

312312
/**
313-
* Gets a representation of `nd` as an ssa-with-fields value if there is one.
313+
* Gets a representation of `insn` as an ssa-with-fields value if there is one.
314314
*/
315315
private TSsaWithFields accessPath(IR::Instruction insn) {
316316
exists(SsaVariable v | insn = v.getAUse() | result = TRoot(v))

0 commit comments

Comments
 (0)