mirror of
https://github.com/github/codeql.git
synced 2026-05-02 20:25:13 +02:00
Java: Autoformat most queries.
This commit is contained in:
5
java/ql/src/external/DuplicateAnonymous.ql
vendored
5
java/ql/src/external/DuplicateAnonymous.ql
vendored
@@ -12,6 +12,7 @@
|
||||
* statistical
|
||||
* non-attributable
|
||||
*/
|
||||
|
||||
import java
|
||||
import CodeDuplication
|
||||
|
||||
@@ -19,5 +20,5 @@ from AnonymousClass c, AnonymousClass other
|
||||
where
|
||||
duplicateAnonymousClass(c, other) and
|
||||
not fileLevelDuplication(c.getCompilationUnit(), other.getCompilationUnit())
|
||||
select c, "Anonymous class is identical to $@.",
|
||||
other, "another anonymous class in " + other.getFile().getStem()
|
||||
select c, "Anonymous class is identical to $@.", other,
|
||||
"another anonymous class in " + other.getFile().getStem()
|
||||
|
||||
7
java/ql/src/external/DuplicateBlock.ql
vendored
7
java/ql/src/external/DuplicateBlock.ql
vendored
@@ -6,6 +6,7 @@
|
||||
* @precision low
|
||||
* @id java/duplicate-block
|
||||
*/
|
||||
|
||||
import CodeDuplication
|
||||
|
||||
from DuplicateBlock d, DuplicateBlock other, int lines, File otherFile, int otherLine
|
||||
@@ -16,6 +17,6 @@ where
|
||||
other != d and
|
||||
otherFile = other.sourceFile() and
|
||||
otherLine = other.sourceStartLine()
|
||||
select
|
||||
d,
|
||||
"Duplicate code: " + lines + " lines are duplicated at " + otherFile.getStem() + ":" + otherLine + "."
|
||||
select d,
|
||||
"Duplicate code: " + lines + " lines are duplicated at " + otherFile.getStem() + ":" + otherLine +
|
||||
"."
|
||||
|
||||
8
java/ql/src/external/DuplicateMethod.ql
vendored
8
java/ql/src/external/DuplicateMethod.ql
vendored
@@ -13,11 +13,13 @@
|
||||
* statistical
|
||||
* non-attributable
|
||||
*/
|
||||
|
||||
import java
|
||||
import CodeDuplication
|
||||
|
||||
predicate relevant(Method m) {
|
||||
m.getNumberOfLinesOfCode() > 5 and not m.getName().matches("get%") or
|
||||
m.getNumberOfLinesOfCode() > 5 and not m.getName().matches("get%")
|
||||
or
|
||||
m.getNumberOfLinesOfCode() > 10
|
||||
}
|
||||
|
||||
@@ -27,5 +29,5 @@ where
|
||||
relevant(m) and
|
||||
not fileLevelDuplication(m.getCompilationUnit(), other.getCompilationUnit()) and
|
||||
not classLevelDuplication(m.getDeclaringType(), other.getDeclaringType())
|
||||
select m, "Method " + m.getName() + " is duplicated in $@.",
|
||||
other, other.getDeclaringType().getQualifiedName()
|
||||
select m, "Method " + m.getName() + " is duplicated in $@.", other,
|
||||
other.getDeclaringType().getQualifiedName()
|
||||
|
||||
1
java/ql/src/external/MostlyDuplicateClass.ql
vendored
1
java/ql/src/external/MostlyDuplicateClass.ql
vendored
@@ -13,6 +13,7 @@
|
||||
* statistical
|
||||
* non-attributable
|
||||
*/
|
||||
|
||||
import java
|
||||
import CodeDuplication
|
||||
|
||||
|
||||
5
java/ql/src/external/MostlyDuplicateFile.ql
vendored
5
java/ql/src/external/MostlyDuplicateFile.ql
vendored
@@ -13,10 +13,11 @@
|
||||
* statistical
|
||||
* non-attributable
|
||||
*/
|
||||
|
||||
import java
|
||||
import CodeDuplication
|
||||
|
||||
from File f, File other, int percent
|
||||
where duplicateFiles(f, other, percent)
|
||||
select f, percent + "% of the lines in " + f.getStem() + " are copies of lines in $@.",
|
||||
other, other.getStem()
|
||||
select f, percent + "% of the lines in " + f.getStem() + " are copies of lines in $@.", other,
|
||||
other.getStem()
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* statistical
|
||||
* non-attributable
|
||||
*/
|
||||
|
||||
import java
|
||||
import CodeDuplication
|
||||
|
||||
@@ -26,5 +27,5 @@ where
|
||||
not duplicateMethod(m, other) and
|
||||
not classLevelDuplication(m.getDeclaringType(), other.getDeclaringType()) and
|
||||
not fileLevelDuplication(m.getCompilationUnit(), other.getCompilationUnit())
|
||||
select m, percent + "% of the statements in " + m.getName() + " are duplicated in $@.",
|
||||
other, other.getDeclaringType().getName() + "." + other.getStringSignature()
|
||||
select m, percent + "% of the statements in " + m.getName() + " are duplicated in $@.", other,
|
||||
other.getDeclaringType().getName() + "." + other.getStringSignature()
|
||||
|
||||
5
java/ql/src/external/MostlySimilarFile.ql
vendored
5
java/ql/src/external/MostlySimilarFile.ql
vendored
@@ -13,10 +13,11 @@
|
||||
* statistical
|
||||
* non-attributable
|
||||
*/
|
||||
|
||||
import java
|
||||
import CodeDuplication
|
||||
|
||||
from File f, File other, int percent
|
||||
where similarFiles(f, other, percent)
|
||||
select f, percent + "% of the lines in " + f.getStem() + " are similar to lines in $@.",
|
||||
other, other.getStem()
|
||||
select f, percent + "% of the lines in " + f.getStem() + " are similar to lines in $@.", other,
|
||||
other.getStem()
|
||||
|
||||
Reference in New Issue
Block a user