Skip to content

Commit 1d4f894

Browse files
authored
Merge pull request #931 from aschackmull/java/autoformat
Approved by esben-semmle, hvitved, yh-semmle
2 parents f0cf576 + 15a6044 commit 1d4f894

File tree

183 files changed

+1087
-567
lines changed

Some content is hidden

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

183 files changed

+1087
-567
lines changed

csharp/ql/src/API Abuse/Dispose.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ class WebControl extends RefType {
1515
WebControl() { this.getBaseClass*() instanceof SystemWebUIControlClass }
1616
}
1717

18-
class WebPage extends RefType { WebPage() { this.getBaseClass*() instanceof SystemWebUIPageClass } }
18+
class WebPage extends RefType {
19+
WebPage() { this.getBaseClass*() instanceof SystemWebUIPageClass }
20+
}
1921

2022
/**
2123
* Holds if `f` is an auto-disposed web control.

csharp/ql/src/Concurrency/ThreadCreation.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ abstract class ConcurrentEntryPoint extends Callable { }
3131
/**
3232
* Methods annotated with the `async` keyword are concurrent entry points.
3333
*/
34-
class AsyncMethod extends ConcurrentEntryPoint { AsyncMethod() { this.(Modifiable).isAsync() } }
34+
class AsyncMethod extends ConcurrentEntryPoint {
35+
AsyncMethod() { this.(Modifiable).isAsync() }
36+
}
3537

3638
/**
3739
* Lambdas or methods passed into the thread or task creation library functions

csharp/ql/src/Documentation/Documentation.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import csharp
22

3-
class SourceDeclaration extends Declaration { SourceDeclaration() { this.isSourceDeclaration() } }
3+
class SourceDeclaration extends Declaration {
4+
SourceDeclaration() { this.isSourceDeclaration() }
5+
}
46

57
/** A parameter that has come from source code. */
68
class SourceParameter extends SourceDeclaration, Parameter { }

csharp/ql/src/Language Abuse/UselessUpcast.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
import csharp
1414

1515
/** A static callable. */
16-
class StaticCallable extends Callable { StaticCallable() { this.(Modifiable).isStatic() } }
16+
class StaticCallable extends Callable {
17+
StaticCallable() { this.(Modifiable).isStatic() }
18+
}
1719

1820
/** An instance callable, that is, a non-static callable. */
1921
class InstanceCallable extends Callable {

csharp/ql/src/Likely Bugs/Collections/ContainerSizeCmpZero.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ private predicate containerSizeAccess(PropertyAccess pa, string containerKind) {
3737
)
3838
}
3939

40-
class ZeroLiteral extends Expr { ZeroLiteral() { getValue() = "0" } }
40+
class ZeroLiteral extends Expr {
41+
ZeroLiteral() { getValue() = "0" }
42+
}
4143

4244
/**
4345
* Whether `smaller` is checked to be no greater than `greater` by `e` being `trueOrFalse`

csharp/ql/src/Likely Bugs/Statements/UseBraces.ql

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ Stmt getASuccessorStmt(Stmt s) {
2525
result = findSuccessorStmt(s.getAControlFlowNode().getASuccessor())
2626
}
2727

28-
class IfThenStmt extends IfStmt { IfThenStmt() { not exists(Stmt s | getElse() = s) } }
28+
class IfThenStmt extends IfStmt {
29+
IfThenStmt() { not exists(Stmt s | getElse() = s) }
30+
}
2931

30-
class IfThenElseStmt extends IfStmt { IfThenElseStmt() { exists(Stmt s | getElse() = s) } }
32+
class IfThenElseStmt extends IfStmt {
33+
IfThenElseStmt() { exists(Stmt s | getElse() = s) }
34+
}
3135

3236
Stmt getTrailingBody(Stmt s) {
3337
result = s.(ForStmt).getBody() or

csharp/ql/src/Performance/StringConcatenationInLoop.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
import csharp
1313

1414
// any use of + that has string type
15-
class StringCat extends AddExpr { StringCat() { this.getType() instanceof StringType } }
15+
class StringCat extends AddExpr {
16+
StringCat() { this.getType() instanceof StringType }
17+
}
1618

1719
/**
1820
* Holds if `e` is an assignment of the form

csharp/ql/src/Stubs/Stubs.qll

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ abstract private class GeneratedType extends ValueOrRefType, GeneratedElement {
110110
t = this.getAnInterestingBaseType() and
111111
(if t instanceof Class then i = 0 else i = 1)
112112
|
113-
stubClassName(t), ", "
114-
order by
115-
i
113+
stubClassName(t), ", " order by i
116114
)
117115
else result = ""
118116
}
@@ -265,7 +263,10 @@ private string stubAccessibility(Member m) {
265263
else
266264
if m.isPrivate()
267265
then result = "private "
268-
else if m.isInternal() then result = "internal " else result = "unknown-accessibility"
266+
else
267+
if m.isInternal()
268+
then result = "internal "
269+
else result = "unknown-accessibility"
269270
}
270271

271272
private string stubModifiers(Member m) {
@@ -285,7 +286,10 @@ private string stubOverride(Member m) {
285286
else
286287
if m.(Virtualizable).isAbstract()
287288
then result = "abstract "
288-
else if m.(Virtualizable).isOverride() then result = "override " else result = ""
289+
else
290+
if m.(Virtualizable).isOverride()
291+
then result = "override "
292+
else result = ""
289293
}
290294

291295
private string stubQualifiedNamePrefix(ValueOrRefType t) {
@@ -338,9 +342,7 @@ private string stubClassName(Type t) {
338342
concat(int i, Type element |
339343
element = t.(TupleType).getElementType(i)
340344
|
341-
stubClassName(element), ","
342-
order by
343-
i
345+
stubClassName(element), "," order by i
344346
) + ")"
345347
else
346348
if t instanceof ValueOrRefType
@@ -358,9 +360,7 @@ private string stubGenericArguments(ValueOrRefType t) {
358360
concat(int n |
359361
exists(t.(UnboundGenericType).getTypeParameter(n))
360362
|
361-
t.(UnboundGenericType).getTypeParameter(n).getName(), ","
362-
order by
363-
n
363+
t.(UnboundGenericType).getTypeParameter(n).getName(), "," order by n
364364
) + ">"
365365
else
366366
if t instanceof ConstructedType
@@ -369,9 +369,7 @@ private string stubGenericArguments(ValueOrRefType t) {
369369
concat(int n |
370370
exists(t.(ConstructedType).getTypeArgument(n))
371371
|
372-
stubClassName(t.(ConstructedType).getTypeArgument(n)), ","
373-
order by
374-
n
372+
stubClassName(t.(ConstructedType).getTypeArgument(n)), "," order by n
375373
) + ">"
376374
else result = ""
377375
}
@@ -383,9 +381,7 @@ private string stubGenericMethodParams(Method m) {
383381
concat(int n, TypeParameter param |
384382
param = m.(UnboundGenericMethod).getTypeParameter(n)
385383
|
386-
param.getName(), ","
387-
order by
388-
n
384+
param.getName(), "," order by n
389385
) + ">"
390386
else result = ""
391387
}
@@ -419,7 +415,10 @@ private string stubParameterModifiers(Parameter p) {
419415
else
420416
if p.isIn()
421417
then result = "" // Only C# 7.1 so ignore
422-
else if p.hasExtensionMethodModifier() then result = "this " else result = ""
418+
else
419+
if p.hasExtensionMethodModifier()
420+
then result = "this "
421+
else result = ""
423422
}
424423

425424
private string stubDefaultValue(Parameter p) {

csharp/ql/src/semmle/code/asp/AspNet.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ class AspQuotedString extends AspAttribute, @asp_quoted_string {
165165
}
166166

167167
/** Arbitrary text. It will be inserted into the document as is. */
168-
class AspText extends AspElement, @asp_text { override string toString() { result = getBody() } }
168+
class AspText extends AspElement, @asp_text {
169+
override string toString() { result = getBody() }
170+
}
169171

170172
/** An XML directive, such as a `DOCTYPE` declaration. */
171173
class AspXmlDirective extends AspElement, @asp_xml_directive {

csharp/ql/src/semmle/code/asp/WebConfig.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import csharp
77
/**
88
* A `Web.config` file.
99
*/
10-
class WebConfigXML extends XMLFile { WebConfigXML() { getName().matches("%Web.config") } }
10+
class WebConfigXML extends XMLFile {
11+
WebConfigXML() { getName().matches("%Web.config") }
12+
}
1113

1214
/** A `<configuration>` tag in an ASP.NET configuration file. */
1315
class ConfigurationXMLElement extends XMLElement {

0 commit comments

Comments
 (0)