Skip to content

Commit 234a36f

Browse files
authored
Merge pull request github#9119 from github/nickrolfe/non-us-spelling-fixes
Fix non-US spellings and the corresponding query
2 parents 0a78927 + 12a43b6 commit 234a36f

File tree

10 files changed

+22
-15
lines changed

10 files changed

+22
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: deprecated
3+
---
4+
* The `AnalysedString` class in the `StringAnalysis` module has been replaced with `AnalyzedString`, to follow our style guide. The old name still exists as a deprecated alias.

cpp/ql/lib/semmle/code/cpp/commons/Printf.qll

+1-1
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,7 @@ class FormatLiteral extends Literal {
13121312
len =
13131313
min(int v |
13141314
v = this.getPrecision(n) or
1315-
v = this.getUse().getFormatArgument(n).(AnalysedString).getMaxLength() - 1 // (don't count null terminator)
1315+
v = this.getUse().getFormatArgument(n).(AnalyzedString).getMaxLength() - 1 // (don't count null terminator)
13161316
) and
13171317
reason = TValueFlowAnalysis()
13181318
)

cpp/ql/lib/semmle/code/cpp/commons/StringAnalysis.qll

+9-6
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,14 @@ predicate canValueFlow(Expr fromExpr, Expr toExpr) {
2727
fromExpr = toExpr.(ConditionalExpr).getElse()
2828
}
2929

30+
/** DEPRECATED: Alias for AnalyzedString */
31+
deprecated class AnalysedString = AnalyzedString;
32+
3033
/**
31-
* An analysed null terminated string.
34+
* An analyzed null terminated string.
3235
*/
33-
class AnalysedString extends Expr {
34-
AnalysedString() {
36+
class AnalyzedString extends Expr {
37+
AnalyzedString() {
3538
this.getUnspecifiedType() instanceof ArrayType or
3639
this.getUnspecifiedType() instanceof PointerType
3740
}
@@ -41,15 +44,15 @@ class AnalysedString extends Expr {
4144
* can be calculated.
4245
*/
4346
int getMaxLength() {
44-
// take the longest AnalysedString it's value could 'flow' from; however if even one doesn't
47+
// take the longest AnalyzedString its value could 'flow' from; however if even one doesn't
4548
// return a value (this essentially means 'infinity') we can't return a value either.
4649
result =
47-
max(AnalysedString expr, int toMax |
50+
max(AnalyzedString expr, int toMax |
4851
canValueFlow*(expr, this) and toMax = expr.(StringLiteral).getOriginalLength()
4952
|
5053
toMax
5154
) and // maximum length
52-
forall(AnalysedString expr | canValueFlow(expr, this) | exists(expr.getMaxLength())) // all sources return a value (recursive)
55+
forall(AnalyzedString expr | canValueFlow(expr, this) | exists(expr.getMaxLength())) // all sources return a value (recursive)
5356
}
5457
}
5558

cpp/ql/lib/semmle/code/cpp/security/BufferWrite.qll

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class StrCopyBW extends BufferWriteCall {
155155
// when result exists, it is an exact flow analysis
156156
reason instanceof ValueFlowAnalysis and
157157
result =
158-
this.getArgument(this.getParamSrc()).(AnalysedString).getMaxLength() * this.getCharSize()
158+
this.getArgument(this.getParamSrc()).(AnalyzedString).getMaxLength() * this.getCharSize()
159159
}
160160

161161
override int getMaxData(BufferWriteEstimationReason reason) {
@@ -201,7 +201,7 @@ class StrCatBW extends BufferWriteCall {
201201
// when result exists, it is an exact flow analysis
202202
reason instanceof ValueFlowAnalysis and
203203
result =
204-
this.getArgument(this.getParamSrc()).(AnalysedString).getMaxLength() * this.getCharSize()
204+
this.getArgument(this.getParamSrc()).(AnalyzedString).getMaxLength() * this.getCharSize()
205205
}
206206

207207
override int getMaxData(BufferWriteEstimationReason reason) {

cpp/ql/test/library-tests/string_analysis/StringAnalysis.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import cpp
77

8-
from AnalysedString s, string str
8+
from AnalyzedString s, string str
99
where
1010
if s.(StringLiteral).getUnspecifiedType().(DerivedType).getBaseType() instanceof Wchar_t
1111
then str = "[?]"

java/ql/lib/semmle/code/java/dataflow/StringPrefixes.qll

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ private import semmle.code.java.StringFormat
3434
* A string constant that contains a prefix whose possibly-appended strings are
3535
* returned by `getAnAppendedExpression`.
3636
*
37-
* Extend this class to specify prefixes whose possibly-appended strings should be analysed.
37+
* Extend this class to specify prefixes whose possibly-appended strings should be analyzed.
3838
*/
3939
abstract class InterestingPrefix extends CompileTimeConstantExpr {
4040
/**

javascript/ql/lib/semmle/javascript/frameworks/NoSQL.qll

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import javascript
66

7-
/** Provices classes for modelling NoSQL query sinks. */
7+
/** Provides classes for modeling NoSQL query sinks. */
88
module NoSql {
99
/** An expression that is interpreted as a NoSQL query. */
1010
abstract class Query extends Expr {

python/ql/lib/semmle/python/objects/ObjectInternal.qll

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class ObjectInternal extends TObject {
4949
abstract ObjectInternal getClass();
5050

5151
/**
52-
* True if this "object" can be meaningfully analysed to determine the boolean value of
52+
* True if this "object" can be meaningfully analyzed to determine the boolean value of
5353
* equality tests on it.
5454
* For example, `None` or `int` can be, but `int()` or an unknown string cannot.
5555
*/

python/ql/lib/semmle/python/objects/Sequences.qll

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ abstract class TupleObjectInternal extends SequenceObjectInternal {
7070
override ObjectInternal getClass() { result = ObjectInternal::builtin("tuple") }
7171

7272
/**
73-
* True if this "object" can be meaningfully analysed for
73+
* True if this "object" can be meaningfully analyzed for
7474
* truth or false in comparisons. For example, `None` or `int` can be, but `int()`
7575
* or an unknown string cannot.
7676
*/

ql/ql/src/codeql_ql/style/docs/NonUSSpellingQuery.qll

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ predicate contains_non_us_spelling(string s, string wrong, string right) {
1818
wrong != "analyse"
1919
or
2020
// analyses (as a noun) is fine
21-
s.regexpMatch(".*analyse[^s].*") and
21+
s.regexpReplaceAll("[\\r\\n]", " ").regexpMatch(".*analyse[^s].*") and
2222
wrong = "analyse"
2323
)
2424
}

0 commit comments

Comments
 (0)