Skip to content

Commit 8f2094f

Browse files
committed
Autoformat.
1 parent 931322e commit 8f2094f

File tree

95 files changed

+189
-341
lines changed

Some content is hidden

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

95 files changed

+189
-341
lines changed

cpp/ql/src/Best Practices/Magic Constants/MagicConstants.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,7 @@ predicate arrayInitializerChild(AggregateLiteral parent, Expr e) {
291291

292292
// i.e. not a constant folded expression
293293
predicate literallyLiteral(Literal lit) {
294-
lit
295-
.getValueText()
294+
lit.getValueText()
296295
.regexpMatch(".*\".*|\\s*+[-+]?+\\s*+(0[xob][0-9a-fA-F]|[0-9])[0-9a-fA-F,._]*+([eE][-+]?+[0-9,._]*+)?+\\s*+[a-zA-Z]*+\\s*+")
297296
}
298297

cpp/ql/src/Security/CWE/CWE-457/InitializationFunctions.qll

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ class InitializationFunction extends Function {
189189
// Field wise assignment to the parameter
190190
any(Assignment e).getLValue() = getAFieldAccess(this.getParameter(i)) or
191191
i =
192-
this
193-
.(MemberFunction)
192+
this.(MemberFunction)
194193
.getAnOverridingFunction+()
195194
.(InitializationFunction)
196195
.initializedParameter() or
@@ -475,12 +474,9 @@ class ConditionalInitializationCall extends FunctionCall {
475474
fa.getASuccessor+() = result
476475
) and
477476
result =
478-
this
479-
.getArgument(getTarget(this)
480-
.(ConditionalInitializationFunction)
481-
.conditionallyInitializedParameter(_))
482-
.(AddressOfExpr)
483-
.getOperand()
477+
this.getArgument(getTarget(this)
478+
.(ConditionalInitializationFunction)
479+
.conditionallyInitializedParameter(_)).(AddressOfExpr).getOperand()
484480
}
485481

486482
Variable getStatusVariable() {

cpp/ql/src/jsf/4.09 Style/AV Rule 48.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ predicate canonicalName1(Declaration d, string canonical) {
3131

3232
predicate canonicalName2(Declaration d, string canonical) {
3333
canonical =
34-
d
35-
.getName()
34+
d.getName()
3635
.replaceAll("_", "")
3736
.replaceAll("0", "O")
3837
.replaceAll("D", "O")

cpp/ql/src/semmle/code/cpp/AutogeneratedFile.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ private predicate autogeneratedComment(string comment) {
3535
.regexpMatch("(?si).*(" +
3636
// replace `generated` with a regexp that also catches things like
3737
// `auto-generated`.
38-
cond
39-
.replaceAll("generated", "(auto[\\w-]*[\\s/\\*\\r\\n]*)?generated")
38+
cond.replaceAll("generated", "(auto[\\w-]*[\\s/\\*\\r\\n]*)?generated")
4039
// replace `!` with a regexp for end-of-sentence / separator characters.
4140
.replaceAll("!", "[\\.\\?\\!\\-\\;\\,]")
4241
// replace ` ` with a regexp for one or more whitespace characters

cpp/ql/src/semmle/code/cpp/Class.qll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,8 @@ class Class extends UserType {
236236
or
237237
exists(ClassDerivation cd | cd.getBaseClass() = base |
238238
result =
239-
this
240-
.accessOfBaseMemberMulti(cd.getDerivedClass(),
241-
fieldInBase.accessInDirectDerived(cd.getASpecifier().(AccessSpecifier)))
239+
this.accessOfBaseMemberMulti(cd.getDerivedClass(),
240+
fieldInBase.accessInDirectDerived(cd.getASpecifier().(AccessSpecifier)))
242241
)
243242
}
244243

cpp/ql/src/semmle/code/cpp/Declaration.qll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,8 @@ class AccessHolder extends Declaration, TAccessHolder {
478478
*/
479479
pragma[inline]
480480
predicate canAccessMember(Declaration member, Class derived) {
481-
this
482-
.couldAccessMember(member.getDeclaringType(), member.getASpecifier().(AccessSpecifier),
483-
derived)
481+
this.couldAccessMember(member.getDeclaringType(), member.getASpecifier().(AccessSpecifier),
482+
derived)
484483
}
485484

486485
/**

cpp/ql/src/semmle/code/cpp/PrintAST.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ private predicate shouldPrintFunction(Function func) {
3434
bindingset[s]
3535
private string escapeString(string s) {
3636
result =
37-
s
38-
.replaceAll("\\", "\\\\")
37+
s.replaceAll("\\", "\\\\")
3938
.replaceAll("\n", "\\n")
4039
.replaceAll("\r", "\\r")
4140
.replaceAll("\t", "\\t")

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,8 +1089,7 @@ class FormatLiteral extends Literal {
10891089
then result = this.getFormat().substring(0, this.getConvSpecOffset(0))
10901090
else
10911091
result =
1092-
this
1093-
.getFormat()
1092+
this.getFormat()
10941093
.substring(this.getConvSpecOffset(n - 1) + this.getConvSpec(n - 1).length(),
10951094
this.getConvSpecOffset(n))
10961095
}
@@ -1106,8 +1105,7 @@ class FormatLiteral extends Literal {
11061105
if n > 0
11071106
then
11081107
result =
1109-
this
1110-
.getFormat()
1108+
this.getFormat()
11111109
.substring(this.getConvSpecOffset(n - 1) + this.getConvSpec(n - 1).length(),
11121110
this.getFormat().length())
11131111
else result = this.getFormat()

cpp/ql/src/semmle/code/cpp/exprs/Expr.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,8 +847,7 @@ class NewOrNewArrayExpr extends Expr, @any_new_expr {
847847
*/
848848
Expr getPlacementPointer() {
849849
result =
850-
this
851-
.getAllocatorCall()
850+
this.getAllocatorCall()
852851
.getArgument(this.getAllocator().(OperatorNewAllocationFunction).getPlacementArgument())
853852
}
854853
}

cpp/ql/src/semmle/code/cpp/headers/MultipleInclusion.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ predicate ifndefDirective(PreprocessorDirective ppd, string macro) {
160160
ppd instanceof PreprocessorIf and
161161
exists(string head | head = ppd.getHead() |
162162
macro =
163-
head
164-
.replaceAll("(", " ")
163+
head.replaceAll("(", " ")
165164
.replaceAll(")", "")
166165
.replaceAll("\t", " ")
167166
.regexpCapture("[ ]*![ ]*defined[ ]+([^ ]*)[ ]*", 1)

cpp/ql/src/semmle/code/cpp/ir/dataflow/DefaultTaintTracking.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,7 @@ module TaintedWithPath {
652652
override predicate hasLocationInfo(
653653
string filepath, int startline, int startcolumn, int endline, int endcolumn
654654
) {
655-
this
656-
.inner()
655+
this.inner()
657656
.getLocation()
658657
.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
659658
}

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,9 @@ class TranslatedSideEffect extends TranslatedElement, TTranslatedArgumentSideEff
528528
tag instanceof OnlyInstructionTag and
529529
operandTag instanceof BufferSizeOperandTag and
530530
result =
531-
getTranslatedExpr(call
532-
.getArgument(call.getTarget().(SideEffectFunction).getParameterSizeIndex(index))
533-
.getFullyConverted()).getResult()
531+
getTranslatedExpr(call.getArgument(call.getTarget()
532+
.(SideEffectFunction)
533+
.getParameterSizeIndex(index)).getFullyConverted()).getResult()
534534
}
535535

536536
override CppType getInstructionMemoryOperandType(InstructionTag tag, TypedOperandTag operandTag) {

cpp/ql/src/semmle/code/cpp/models/implementations/Iterator.qll

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ private class IteratorByTraits extends Iterator {
5858
private FunctionInput getIteratorArgumentInput(Operator op, int index) {
5959
exists(Type t |
6060
t =
61-
op
62-
.getACallToThisFunction()
61+
op.getACallToThisFunction()
6362
.getArgument(index)
6463
.getExplicitlyConverted()
6564
.getType()
@@ -307,11 +306,10 @@ private class IteratorAssignmentMemberOperator extends MemberFunction, TaintFunc
307306
*/
308307
private class BeginOrEndFunction extends MemberFunction, TaintFunction, GetIteratorFunction {
309308
BeginOrEndFunction() {
310-
this
311-
.hasName([
312-
"begin", "cbegin", "rbegin", "crbegin", "end", "cend", "rend", "crend", "before_begin",
313-
"cbefore_begin"
314-
]) and
309+
this.hasName([
310+
"begin", "cbegin", "rbegin", "crbegin", "end", "cend", "rend", "crend", "before_begin",
311+
"cbefore_begin"
312+
]) and
315313
this.getType().getUnspecifiedType() instanceof Iterator
316314
}
317315

cpp/ql/src/semmle/code/cpp/models/implementations/StdMap.qll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,8 @@ private class StdMapErase extends TaintFunction {
179179
*/
180180
private class StdMapEqualRange extends TaintFunction {
181181
StdMapEqualRange() {
182-
this
183-
.hasQualifiedName("std", ["map", "unordered_map"],
184-
["lower_bound", "upper_bound", "equal_range"])
182+
this.hasQualifiedName("std", ["map", "unordered_map"],
183+
["lower_bound", "upper_bound", "equal_range"])
185184
}
186185

187186
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {

cpp/ql/src/semmle/code/cpp/models/implementations/StdSet.qll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,8 @@ private class StdSetErase extends TaintFunction {
132132
*/
133133
private class StdSetEqualRange extends TaintFunction {
134134
StdSetEqualRange() {
135-
this
136-
.hasQualifiedName("std", ["set", "unordered_set"],
137-
["lower_bound", "upper_bound", "equal_range"])
135+
this.hasQualifiedName("std", ["set", "unordered_set"],
136+
["lower_bound", "upper_bound", "equal_range"])
138137
}
139138

140139
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {

cpp/ql/test/library-tests/arguments/arguments.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ from Compilation c, int i, string s
55
where
66
i > 0 and
77
s =
8-
c
9-
.getArgument(i)
8+
c.getArgument(i)
109
.replaceAll("\\", "/")
1110
.regexpReplaceAll(".*(/qltest/predefined_macros)", "<tools>$1")
1211
select c.getAFileCompiled().toString(), i, s

csharp/ql/examples/snippets/null_argument.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ from MethodCall call, Method add
1515
where
1616
call.getTarget() = add.getAnUltimateImplementor*() and
1717
add.hasName("Add") and
18-
add
19-
.getDeclaringType()
18+
add.getDeclaringType()
2019
.getUnboundDeclaration()
2120
.hasQualifiedName("System.Collections.Generic.ICollection<>") and
2221
call.getAnArgument() instanceof NullLiteral

csharp/ql/src/Concurrency/DataMembers.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ class CollectionMember extends DataMember {
5959
// A write of a field or property can be a method call to certain methods...
6060
exists(MethodCall call | call = result |
6161
call.getQualifier() = this.getAnAccess() and
62-
call
63-
.getTarget()
62+
call.getTarget()
6463
.getName()
6564
.regexpMatch("Add.*|Append|Clear.*|Delete|" +
6665
"(Try)?Dequeue|Enqueue|Insert.*|(Try)?Pop|Push|(Try?)Remove.*|Replace.*|SafeDelete|Set.*|")

csharp/ql/src/Concurrency/ThreadCreation.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ class ThreadStartingCallable extends Callable {
1313
this.(Method).getQualifiedName() = "System.Threading.Tasks.Task.Run" or
1414
this.(Constructor).getDeclaringType().getQualifiedName() = "System.Threading.Thread" or
1515
this.(Method).getQualifiedName() = "System.Threading.Thread.Start" or
16-
this
17-
.(Constructor)
16+
this.(Constructor)
1817
.getDeclaringType()
1918
.getQualifiedName()
2019
.matches("System.Threading.Tasks.Task<%>")

csharp/ql/src/Likely Bugs/MishandlingJapaneseEra.ql

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,10 @@ predicate isDateFromJapaneseCalendarCreation(ObjectCreation cr) {
5151
cr.getType().hasQualifiedName("System.DateTimeOffset")
5252
) and
5353
(
54-
cr
55-
.getArgumentForName("calendar")
54+
cr.getArgumentForName("calendar")
5655
.getType()
5756
.hasQualifiedName("System.Globalization.JapaneseCalendar") or
58-
cr
59-
.getArgumentForName("calendar")
57+
cr.getArgumentForName("calendar")
6058
.getType()
6159
.hasQualifiedName("System.Globalization.JapaneseLunisolarCalendar")
6260
) and

csharp/ql/src/Security Features/CWE-016/ASPNetMaxRequestLength.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ import semmle.code.asp.WebConfig
1616
from SystemWebXMLElement web, XMLAttribute maxReqLength
1717
where
1818
maxReqLength =
19-
web
20-
.getAChild(any(string s | s.toLowerCase() = "httpruntime"))
19+
web.getAChild(any(string s | s.toLowerCase() = "httpruntime"))
2120
.getAttribute(any(string s | s.toLowerCase() = "maxrequestlength")) and
2221
maxReqLength.getValue().toInt() > 4096
2322
select maxReqLength, "Large 'maxRequestLength' value (" + maxReqLength.getValue() + " KB)."

csharp/ql/src/Security Features/CWE-091/XMLInjection.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration {
3434
override predicate isSanitizer(DataFlow::Node node) {
3535
exists(MethodCall mc |
3636
mc.getTarget().hasName("Escape") and
37-
mc
38-
.getTarget()
37+
mc.getTarget()
3938
.getDeclaringType()
4039
.getABaseType*()
4140
.hasQualifiedName("System.Security.SecurityElement")

csharp/ql/src/Security Features/CWE-114/AssemblyPathInjection.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration {
2929
override predicate isSink(DataFlow::Node sink) {
3030
exists(MethodCall mc, string name, int arg |
3131
mc.getTarget().getName().matches(name) and
32-
mc
33-
.getTarget()
32+
mc.getTarget()
3433
.getDeclaringType()
3534
.getABaseType*()
3635
.hasQualifiedName("System.Reflection.Assembly") and

csharp/ql/src/Security Features/CWE-327/DontInstallRootCert.ql

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ class AddCertToRootStoreConfig extends DataFlow::Configuration {
1818

1919
override predicate isSource(DataFlow::Node source) {
2020
exists(ObjectCreation oc | oc = source.asExpr() |
21-
oc
22-
.getType()
21+
oc.getType()
2322
.(RefType)
2423
.hasQualifiedName("System.Security.Cryptography.X509Certificates.X509Store") and
2524
oc.getArgument(0).(Access).getTarget().hasName("Root")
@@ -29,11 +28,9 @@ class AddCertToRootStoreConfig extends DataFlow::Configuration {
2928
override predicate isSink(DataFlow::Node sink) {
3029
exists(MethodCall mc |
3130
(
32-
mc
33-
.getTarget()
31+
mc.getTarget()
3432
.hasQualifiedName("System.Security.Cryptography.X509Certificates.X509Store", "Add") or
35-
mc
36-
.getTarget()
33+
mc.getTarget()
3734
.hasQualifiedName("System.Security.Cryptography.X509Certificates.X509Store", "AddRange")
3835
) and
3936
sink.asExpr() = mc.getQualifier()

csharp/ql/src/Security Features/HeaderCheckingDisabled.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ where
1818
exists(Assignment a, PropertyAccess pa |
1919
a.getLValue() = pa and
2020
pa.getTarget().hasName("EnableHeaderChecking") and
21-
pa
22-
.getTarget()
21+
pa.getTarget()
2322
.getDeclaringType()
2423
.hasQualifiedName("System.Web.Configuration", "HttpRuntimeSection") and
2524
a.getRValue().getValue() = "false" and

csharp/ql/src/Security Features/InadequateRSAPadding.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import csharp
1515
from MethodCall mc, BoolLiteral b
1616
where
1717
mc.getTarget().hasName("Encrypt") and
18-
mc
19-
.getTarget()
18+
mc.getTarget()
2019
.getDeclaringType()
2120
.hasQualifiedName("System.Security.Cryptography", "RSACryptoServiceProvider") and
2221
mc.getArgument(1) = b and

csharp/ql/src/Security Features/InsufficientKeySize.ql

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ predicate incorrectUseOfRC2(Assignment e, string msg) {
1515
exists(PropertyAccess pa |
1616
pa.getParent() = e and
1717
pa.getTarget().hasName("EffectiveKeySize") and
18-
pa
19-
.getTarget()
18+
pa.getTarget()
2019
.getDeclaringType()
2120
.hasQualifiedName("System.Security.Cryptography", "RC2CryptoServiceProvider")
2221
) and
@@ -25,17 +24,15 @@ predicate incorrectUseOfRC2(Assignment e, string msg) {
2524
}
2625

2726
predicate incorrectUseOfDSA(ObjectCreation e, string msg) {
28-
e
29-
.getTarget()
27+
e.getTarget()
3028
.getDeclaringType()
3129
.hasQualifiedName("System.Security.Cryptography", "DSACryptoServiceProvider") and
3230
exists(Expr i | e.getArgument(0) = i and i.getValue().toInt() < 2048) and
3331
msg = "Key size should be at least 2048 bits for DSA encryption."
3432
}
3533

3634
predicate incorrectUseOfRSA(ObjectCreation e, string msg) {
37-
e
38-
.getTarget()
35+
e.getTarget()
3936
.getDeclaringType()
4037
.hasQualifiedName("System.Security.Cryptography", "RSACryptoServiceProvider") and
4138
exists(Expr i | e.getArgument(0) = i and i.getValue().toInt() < 2048) and

csharp/ql/src/Security Features/WeakEncryption.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ predicate incorrectUseOfDES(ObjectCreation e, string msg) {
1818
}
1919

2020
predicate incorrectUseOfTripleDES(ObjectCreation e, string msg) {
21-
e
22-
.getType()
21+
e.getType()
2322
.(Class)
2423
.hasQualifiedName("System.Security.Cryptography", "TripleDESCryptoServiceProvider") and
2524
msg =

csharp/ql/src/semmle/code/csharp/Attribute.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ class Attributable extends @attributable {
3030
predicate hasLocationInfo(
3131
string filepath, int startline, int startcolumn, int endline, int endcolumn
3232
) {
33-
this
34-
.(Element)
33+
this.(Element)
3534
.getLocation()
3635
.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
3736
}

csharp/ql/src/semmle/code/csharp/commons/Collections.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ class CollectionType extends RefType {
8686
exists(RefType base | base = this.getABaseType*() |
8787
base.hasQualifiedName(collectionNamespaceName(), collectionTypeName())
8888
or
89-
base
90-
.(ConstructedType)
89+
base.(ConstructedType)
9190
.getUnboundGeneric()
9291
.hasQualifiedName(genericCollectionNamespaceName(), genericCollectionTypeName())
9392
)

0 commit comments

Comments
 (0)