Java: Autoformat most queries.

This commit is contained in:
Anders Schack-Mulligen
2018-10-10 17:49:12 +02:00
parent 85cca69721
commit dd5a8f0c14
443 changed files with 2548 additions and 2043 deletions

View File

@@ -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()

View File

@@ -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 +
"."

View File

@@ -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()

View File

@@ -13,6 +13,7 @@
* statistical
* non-attributable
*/
import java
import CodeDuplication

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()