Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dd5a8f0

Browse files
committed
Java: Autoformat most queries.
1 parent 85cca69 commit dd5a8f0

443 files changed

Lines changed: 2547 additions & 2042 deletions

File tree

Some content is hidden

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

java/ql/src/Advisory/Declarations/MissingOverrideAnnotation.ql

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
* @id java/missing-override-annotation
99
* @tags maintainability
1010
*/
11+
1112
import java
1213

1314
class OverridingMethod extends Method {
14-
OverridingMethod() {
15-
exists(Method m | this.overrides(m))
16-
}
15+
OverridingMethod() { exists(Method m | this.overrides(m)) }
1716

18-
predicate isOverrideAnnotated() {
19-
this.getAnAnnotation() instanceof OverrideAnnotation
20-
}
17+
predicate isOverrideAnnotated() { this.getAnAnnotation() instanceof OverrideAnnotation }
2118
}
2219

2320
from OverridingMethod m, Method overridden
@@ -26,5 +23,5 @@ where
2623
m.overrides(overridden) and
2724
not m.isOverrideAnnotated() and
2825
not exists(FunctionalExpr mref | mref.asMethod() = m)
29-
select m, "This method overrides $@; it is advisable to add an Override annotation.",
30-
overridden, overridden.getDeclaringType() + "." + overridden.getName()
26+
select m, "This method overrides $@; it is advisable to add an Override annotation.", overridden,
27+
overridden.getDeclaringType() + "." + overridden.getName()

java/ql/src/Advisory/Declarations/NonFinalImmutableField.ql

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* @id java/non-final-immutable-field
1010
* @tags reliability
1111
*/
12+
1213
import java
1314

1415
class Initialization extends Callable {
@@ -41,12 +42,14 @@ class ImmutableField extends Field {
4142
forall(FieldAccess fw, AnyAssignment ae |
4243
fw.getField().getSourceDeclaration() = this and
4344
fw = ae.getDest()
44-
| ae.getEnclosingCallable().getDeclaringType() = this.getDeclaringType() and
45+
|
46+
ae.getEnclosingCallable().getDeclaringType() = this.getDeclaringType() and
4547
ae.getEnclosingCallable() instanceof Initialization
4648
)
4749
}
4850
}
4951

5052
from ImmutableField f
5153
where not f.isFinal()
52-
select f, "This immutable field is not declared final but is only assigned to during initialization."
54+
select f,
55+
"This immutable field is not declared final but is only assigned to during initialization."

java/ql/src/Advisory/Declarations/NonPrivateField.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* @id java/non-private-field
99
* @tags maintainability
1010
*/
11+
1112
import java
1213
import semmle.code.java.JDKAnnotations
1314

java/ql/src/Advisory/Deprecated Code/AvoidDeprecatedCallableAccess.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
* non-attributable
1111
* external/cwe/cwe-477
1212
*/
13+
1314
import java
1415

15-
private
16-
predicate isDeprecatedCallable(Callable c) {
16+
private predicate isDeprecatedCallable(Callable c) {
1717
c.getAnAnnotation() instanceof DeprecatedAnnotation or
1818
exists(c.getDoc().getJavadoc().getATag("@deprecated"))
1919
}
@@ -24,5 +24,5 @@ where
2424
isDeprecatedCallable(c) and
2525
// Exclude deprecated calls from within deprecated code.
2626
not isDeprecatedCallable(ca.getCaller())
27-
select ca, "Invoking $@ should be avoided because it has been deprecated.",
28-
c, c.getDeclaringType() + "." + c.getName()
27+
select ca, "Invoking $@ should be avoided because it has been deprecated.", c,
28+
c.getDeclaringType() + "." + c.getName()

java/ql/src/Advisory/Documentation/ImpossibleJavadocThrows.ql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ RefType getTaggedType(ThrowsTag tag) {
1919
predicate canThrow(Callable callable, RefType exception) {
2020
exists(string uncheckedException |
2121
uncheckedException = "RuntimeException" or uncheckedException = "Error"
22-
|
22+
|
2323
exception.getASupertype*().hasQualifiedName("java.lang", uncheckedException)
24-
) or
24+
)
25+
or
2526
callable.getAnException().getType().getASubtype*() = exception
2627
}
2728

@@ -31,4 +32,5 @@ where
3132
docMethod.getDoc().getJavadoc().getAChild*() = throwsTag and
3233
not canThrow(docMethod, thrownType)
3334
select throwsTag,
34-
"Javadoc for " + docMethod + " claims to throw " + thrownType.getName() + " but this is impossible."
35+
"Javadoc for " + docMethod + " claims to throw " + thrownType.getName() +
36+
" but this is impossible."

java/ql/src/Advisory/Documentation/MissingJavadocMethods.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
* @id java/undocumented-function
99
* @tags maintainability
1010
*/
11+
1112
import java
1213
import JavadocCommon
1314

1415
from DocuCallable c
1516
where not c.hasAcceptableDocText()
16-
select c, "This " + c.toMethodOrConstructorString() + " does not have a non-trivial Javadoc comment."
17+
select c,
18+
"This " + c.toMethodOrConstructorString() + " does not have a non-trivial Javadoc comment."

java/ql/src/Advisory/Documentation/MissingJavadocParameters.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* @id java/undocumented-parameter
99
* @tags maintainability
1010
*/
11+
1112
import java
1213
import JavadocCommon
1314

java/ql/src/Advisory/Documentation/MissingJavadocReturnValues.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* @id java/undocumented-return-value
99
* @tags maintainability
1010
*/
11+
1112
import java
1213
import JavadocCommon
1314

java/ql/src/Advisory/Documentation/MissingJavadocThrows.ql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* @id java/undocumented-exception
99
* @tags maintainability
1010
*/
11+
1112
import java
1213
import JavadocCommon
1314

@@ -18,5 +19,6 @@ where
1819
e.getType() = t and
1920
not c.hasAcceptableThrowsTag(e)
2021
)
21-
select c, "This " + c.toMethodOrConstructorString() + " throws $@ but does not have a corresponding Javadoc tag.",
22-
t, t.getName()
22+
select c,
23+
"This " + c.toMethodOrConstructorString() +
24+
" throws $@ but does not have a corresponding Javadoc tag.", t, t.getName()

java/ql/src/Advisory/Documentation/MissingJavadocTypes.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* @id java/undocumented-type
99
* @tags maintainability
1010
*/
11+
1112
import java
1213
import JavadocCommon
1314

0 commit comments

Comments
 (0)