mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
Java: Autoformat most queries.
This commit is contained in:
@@ -8,12 +8,12 @@
|
||||
* @id java/authors-per-file
|
||||
* @tags maintainability
|
||||
*/
|
||||
|
||||
|
||||
import java
|
||||
|
||||
from CompilationUnit u, int num
|
||||
where
|
||||
num = strictcount(string s |
|
||||
exists(Documentable d | d.getAuthor() = s and d.getCompilationUnit() = u)
|
||||
)
|
||||
exists(Documentable d | d.getAuthor() = s and d.getCompilationUnit() = u)
|
||||
)
|
||||
select u, num
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
* complexity
|
||||
* maintainability
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from Callable c
|
||||
where c.fromSource()
|
||||
select c, c.getMetrics().getCyclomaticComplexity() as n
|
||||
order by n desc
|
||||
select c, c.getMetrics().getCyclomaticComplexity() as n order by n desc
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
* @tags maintainability
|
||||
* complexity
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from Callable c
|
||||
where c.fromSource()
|
||||
select c, c.getMetrics().getNumberOfLinesOfCode() as n
|
||||
order by n desc
|
||||
select c, c.getMetrics().getNumberOfLinesOfCode() as n order by n desc
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
* @tags maintainability
|
||||
* documentation
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from Callable c
|
||||
where c.fromSource()
|
||||
select c, c.getMetrics().getNumberOfCommentLines() as n
|
||||
order by n desc
|
||||
select c, c.getMetrics().getNumberOfCommentLines() as n order by n desc
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
* complexity
|
||||
* maintainability
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from Callable c, int n
|
||||
where c.fromSource() and
|
||||
n = count(Call call | call.getEnclosingCallable() = c)
|
||||
select c, n
|
||||
order by n desc
|
||||
where
|
||||
c.fromSource() and
|
||||
n = count(Call call | call.getEnclosingCallable() = c)
|
||||
select c, n order by n desc
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
* complexity
|
||||
* maintainability
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from Callable c
|
||||
where c.fromSource()
|
||||
select c, c.getMetrics().getNumberOfParameters() as n
|
||||
order by n desc
|
||||
select c, c.getMetrics().getNumberOfParameters() as n order by n desc
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
* @id java/statements-per-function
|
||||
* @tags maintainability
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from Callable c, int n
|
||||
where c.fromSource() and
|
||||
n = count(Stmt s | s.getEnclosingCallable() = c)
|
||||
select c, n
|
||||
order by n desc
|
||||
where
|
||||
c.fromSource() and
|
||||
n = count(Stmt s | s.getEnclosingCallable() = c)
|
||||
select c, n order by n desc
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
* @tags maintainability
|
||||
* complexity
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
/**
|
||||
@@ -18,10 +19,7 @@ import java
|
||||
* consider the second `if` nested. Blocks are also skipped.
|
||||
*/
|
||||
predicate realParent(Stmt inner, Stmt outer) {
|
||||
if skipParent(inner) then
|
||||
realParent(inner.getParent(), outer)
|
||||
else
|
||||
outer = inner.getParent()
|
||||
if skipParent(inner) then realParent(inner.getParent(), outer) else outer = inner.getParent()
|
||||
}
|
||||
|
||||
predicate skipParent(Stmt s) {
|
||||
@@ -37,6 +35,6 @@ predicate nestingDepth(Stmt s, int depth) {
|
||||
}
|
||||
|
||||
from Method m, int depth
|
||||
where depth = max(Stmt s, int aDepth | s.getEnclosingCallable() = m and nestingDepth(s, aDepth) | aDepth)
|
||||
select m, depth
|
||||
order by depth
|
||||
where
|
||||
depth = max(Stmt s, int aDepth | s.getEnclosingCallable() = m and nestingDepth(s, aDepth) | aDepth)
|
||||
select m, depth order by depth
|
||||
|
||||
@@ -28,7 +28,7 @@ import semmle.code.java.DependencyCounts
|
||||
* dashboard database, which is implicitly relative to the source
|
||||
* archive location.
|
||||
*/
|
||||
|
||||
from File sourceFile, int total, string entity
|
||||
where fileJarDependencyCount(sourceFile, total, entity)
|
||||
select entity, total
|
||||
order by total desc
|
||||
select entity, total order by total desc
|
||||
|
||||
@@ -16,6 +16,7 @@ import semmle.code.java.DependencyCounts
|
||||
* recover that information once we are in the dashboard database, using the
|
||||
* ExternalEntity.getASourceLink() method.
|
||||
*/
|
||||
|
||||
from File sourceFile, string entity
|
||||
where fileJarDependencyCount(sourceFile, _, entity)
|
||||
select entity, sourceFile
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
* @tags changeability
|
||||
* modularity
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from CompilationUnit f, int n
|
||||
where
|
||||
n = count(File g |
|
||||
exists(Class c | c.fromSource() and c.getCompilationUnit() = f |
|
||||
exists(Class d | d.fromSource() and d.getCompilationUnit() = g | depends(d,c))
|
||||
exists(Class c | c.fromSource() and c.getCompilationUnit() = f |
|
||||
exists(Class d | d.fromSource() and d.getCompilationUnit() = g | depends(d, c))
|
||||
)
|
||||
)
|
||||
)
|
||||
select f, n
|
||||
order by n desc
|
||||
select f, n order by n desc
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
* @tags maintainability
|
||||
* documentation
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from CompilationUnit f, float comments, float loc, float ratio
|
||||
where f.getTotalNumberOfLines() > 0
|
||||
and comments = f.getNumberOfCommentLines()
|
||||
and loc = f.getTotalNumberOfLines()
|
||||
and ratio = 100.0 * comments / loc
|
||||
select f, ratio
|
||||
order by ratio desc
|
||||
where
|
||||
f.getTotalNumberOfLines() > 0 and
|
||||
comments = f.getNumberOfCommentLines() and
|
||||
loc = f.getTotalNumberOfLines() and
|
||||
ratio = 100.0 * comments / loc
|
||||
select f, ratio order by ratio desc
|
||||
|
||||
@@ -9,11 +9,14 @@
|
||||
* @tags testability
|
||||
* complexity
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from CompilationUnit f, float n
|
||||
where n = avg(Callable c, int toAvg |
|
||||
c.getCompilationUnit() = f and toAvg = c.getMetrics().getCyclomaticComplexity() |
|
||||
toAvg
|
||||
)
|
||||
from CompilationUnit f, float n
|
||||
where
|
||||
n = avg(Callable c, int toAvg |
|
||||
c.getCompilationUnit() = f and toAvg = c.getMetrics().getCyclomaticComplexity()
|
||||
|
|
||||
toAvg
|
||||
)
|
||||
select f, n
|
||||
|
||||
@@ -10,13 +10,14 @@
|
||||
* modularity
|
||||
* maintainability
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from CompilationUnit f, int n
|
||||
where n = count(File g |
|
||||
exists(Class c | c.fromSource() and c.getCompilationUnit() = g |
|
||||
exists(Class d | d.fromSource() and d.getCompilationUnit() = f | depends(d,c))
|
||||
)
|
||||
where
|
||||
n = count(File g |
|
||||
exists(Class c | c.fromSource() and c.getCompilationUnit() = g |
|
||||
exists(Class d | d.fromSource() and d.getCompilationUnit() = f | depends(d, c))
|
||||
)
|
||||
select f, n
|
||||
order by n desc
|
||||
)
|
||||
select f, n order by n desc
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
* @metricType file
|
||||
* @metricAggregate avg sum max
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from File f, int n
|
||||
where n = f.getTotalNumberOfLines()
|
||||
select f, n
|
||||
order by n desc
|
||||
select f, n order by n desc
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
* @tags maintainability
|
||||
* complexity
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from File f, int n
|
||||
where n = f.getNumberOfLinesOfCode()
|
||||
select f, n
|
||||
order by n desc
|
||||
select f, n order by n desc
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
* @tags maintainability
|
||||
* documentation
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from File f, int n
|
||||
where n = f.getNumberOfCommentLines()
|
||||
select f, n
|
||||
order by n desc
|
||||
select f, n order by n desc
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
* @tags maintainability
|
||||
* documentation
|
||||
*/
|
||||
|
||||
|
||||
import Violations_of_Best_Practice.Comments.CommentedCode
|
||||
|
||||
from File f, int n
|
||||
where n = sum(CommentedOutCode comment | comment.getFile() = f | comment.getCodeLines())
|
||||
select f, n
|
||||
order by n desc
|
||||
select f, n order by n desc
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
* @tags testability
|
||||
* modularity
|
||||
*/
|
||||
|
||||
import external.CodeDuplication
|
||||
|
||||
from File f, int n
|
||||
where
|
||||
n = count(int line |
|
||||
exists(DuplicateBlock d | d.sourceFile() = f |
|
||||
line in [d.sourceStartLine()..d.sourceEndLine()] and
|
||||
not whitelistedLineForDuplication(f, line)
|
||||
exists(DuplicateBlock d | d.sourceFile() = f |
|
||||
line in [d.sourceStartLine() .. d.sourceEndLine()] and
|
||||
not whitelistedLineForDuplication(f, line)
|
||||
)
|
||||
)
|
||||
)
|
||||
select f, n
|
||||
order by n desc
|
||||
select f, n order by n desc
|
||||
|
||||
@@ -9,14 +9,15 @@
|
||||
* @id java/similar-lines-per-file
|
||||
* @tags testability
|
||||
*/
|
||||
|
||||
import external.CodeDuplication
|
||||
|
||||
from File f, int n
|
||||
where n = count(int line |
|
||||
exists(SimilarBlock d | d.sourceFile() = f |
|
||||
line in [d.sourceStartLine()..d.sourceEndLine()] and
|
||||
not whitelistedLineForDuplication(f, line)
|
||||
where
|
||||
n = count(int line |
|
||||
exists(SimilarBlock d | d.sourceFile() = f |
|
||||
line in [d.sourceStartLine() .. d.sourceEndLine()] and
|
||||
not whitelistedLineForDuplication(f, line)
|
||||
)
|
||||
)
|
||||
)
|
||||
select f, n
|
||||
order by n desc
|
||||
select f, n order by n desc
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
* @id java/classes-per-file
|
||||
* @tags maintainability
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from CompilationUnit f, int n
|
||||
where n = count(Class c | c.fromSource() and c.getCompilationUnit() = f)
|
||||
select f, n
|
||||
order by n desc
|
||||
select f, n order by n desc
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
* @id java/interfaces-per-file
|
||||
* @tags maintainability
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from CompilationUnit f, int n
|
||||
where n = count(Interface i | i.fromSource() and i.getCompilationUnit() = f)
|
||||
select f, n
|
||||
order by n desc
|
||||
select f, n order by n desc
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
* @id java/tests-in-files
|
||||
* @tags maintainability
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from CompilationUnit f, int n
|
||||
where n = strictcount(TestMethod test | test.fromSource() and test.getCompilationUnit() = f)
|
||||
select f, n
|
||||
order by n desc
|
||||
select f, n order by n desc
|
||||
|
||||
@@ -9,21 +9,22 @@
|
||||
* @tags portability
|
||||
* modularity
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from CompilationUnit f, float selfContaindness, int efferentSourceCoupling, int efferentCoupling
|
||||
where efferentSourceCoupling = count(CompilationUnit g |
|
||||
exists(RefType c | c.fromSource() and c.getCompilationUnit() = g |
|
||||
exists(RefType d | d.fromSource() and d.getCompilationUnit()= f | depends(d,c))
|
||||
)
|
||||
where
|
||||
efferentSourceCoupling = count(CompilationUnit g |
|
||||
exists(RefType c | c.fromSource() and c.getCompilationUnit() = g |
|
||||
exists(RefType d | d.fromSource() and d.getCompilationUnit() = f | depends(d, c))
|
||||
)
|
||||
and efferentCoupling = count(CompilationUnit g |
|
||||
exists(RefType c | c.getCompilationUnit() = g |
|
||||
exists(RefType d | d.fromSource() and d.getCompilationUnit() = f | depends(d,c))
|
||||
)
|
||||
) and
|
||||
efferentCoupling = count(CompilationUnit g |
|
||||
exists(RefType c | c.getCompilationUnit() = g |
|
||||
exists(RefType d | d.fromSource() and d.getCompilationUnit() = f | depends(d, c))
|
||||
)
|
||||
and if efferentCoupling = 0
|
||||
then selfContaindness = 100
|
||||
else selfContaindness = 100*(float)efferentSourceCoupling/efferentCoupling
|
||||
select f, selfContaindness
|
||||
order by selfContaindness desc
|
||||
) and
|
||||
if efferentCoupling = 0
|
||||
then selfContaindness = 100
|
||||
else selfContaindness = 100 * efferentSourceCoupling.(float) / efferentCoupling
|
||||
select f, selfContaindness order by selfContaindness desc
|
||||
|
||||
@@ -7,13 +7,15 @@
|
||||
* @metricAggregate avg sum max
|
||||
* @id java/vcs/churn-per-file
|
||||
*/
|
||||
|
||||
import java
|
||||
import external.VCS
|
||||
|
||||
from File f, int n
|
||||
where n = sum(Commit entry, int churn |
|
||||
churn = entry.getRecentChurnForFile(f) and not artificialChange(entry) |
|
||||
churn
|
||||
)
|
||||
select f, n
|
||||
order by n desc
|
||||
where
|
||||
n = sum(Commit entry, int churn |
|
||||
churn = entry.getRecentChurnForFile(f) and not artificialChange(entry)
|
||||
|
|
||||
churn
|
||||
)
|
||||
select f, n order by n desc
|
||||
|
||||
@@ -7,10 +7,15 @@
|
||||
* @metricAggregate avg sum max
|
||||
* @id java/vcs/added-lines-per-file
|
||||
*/
|
||||
|
||||
import java
|
||||
import external.VCS
|
||||
|
||||
from File f, int n
|
||||
where n = sum(Commit entry, int churn | churn = entry.getRecentAdditionsForFile(f) and not artificialChange(entry) | churn)
|
||||
select f, n
|
||||
order by n desc
|
||||
where
|
||||
n = sum(Commit entry, int churn |
|
||||
churn = entry.getRecentAdditionsForFile(f) and not artificialChange(entry)
|
||||
|
|
||||
churn
|
||||
)
|
||||
select f, n order by n desc
|
||||
|
||||
@@ -7,10 +7,15 @@
|
||||
* @metricAggregate avg sum max
|
||||
* @id java/vcs/deleted-lines-per-file
|
||||
*/
|
||||
|
||||
import java
|
||||
import external.VCS
|
||||
|
||||
from File f, int n
|
||||
where n = sum(Commit entry, int churn | churn = entry.getRecentDeletionsForFile(f) and not artificialChange(entry) | churn)
|
||||
select f, n
|
||||
order by n desc
|
||||
where
|
||||
n = sum(Commit entry, int churn |
|
||||
churn = entry.getRecentDeletionsForFile(f) and not artificialChange(entry)
|
||||
|
|
||||
churn
|
||||
)
|
||||
select f, n order by n desc
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* @metricAggregate avg min max
|
||||
* @id java/vcs/authors-per-file
|
||||
*/
|
||||
|
||||
import java
|
||||
import external.VCS
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* @metricAggregate avg min max sum
|
||||
* @id java/vcs/commits-per-file
|
||||
*/
|
||||
|
||||
import java
|
||||
import external.VCS
|
||||
|
||||
|
||||
@@ -7,14 +7,15 @@
|
||||
* @metricAggregate avg min max sum
|
||||
* @id java/vcs/recent-commits-per-file
|
||||
*/
|
||||
|
||||
import java
|
||||
import external.VCS
|
||||
|
||||
from File f, int n
|
||||
where n = count(Commit e |
|
||||
e.getAnAffectedFile() = f and
|
||||
e.daysToNow() <= 180 and
|
||||
not artificialChange(e)
|
||||
)
|
||||
select f, n
|
||||
order by n desc
|
||||
where
|
||||
n = count(Commit e |
|
||||
e.getAnAffectedFile() = f and
|
||||
e.daysToNow() <= 180 and
|
||||
not artificialChange(e)
|
||||
)
|
||||
select f, n order by n desc
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* @metricType callable
|
||||
* @id java/callable-display-strings
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
private string prefix(Callable c) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* @metricType callable
|
||||
* @id java/callable-extents
|
||||
*/
|
||||
|
||||
import java
|
||||
import Extents
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* @metricType callable
|
||||
* @id java/callable-source-links
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from Callable c
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
* @metricType reftype
|
||||
* @id java/reference-type-display-strings
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
private string suffix(RefType t) {
|
||||
if t instanceof AnonymousClass
|
||||
then result = "<anonymous class>"
|
||||
else result = ""
|
||||
if t instanceof AnonymousClass then result = "<anonymous class>" else result = ""
|
||||
}
|
||||
|
||||
from RefType t
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* @metricType reftype
|
||||
* @id java/reference-type-extents
|
||||
*/
|
||||
|
||||
import java
|
||||
import Extents
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* @metricType reftype
|
||||
* @id java/reference-type-source-links
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
* @tags changeability
|
||||
* modularity
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t
|
||||
where t.fromSource()
|
||||
select t, t.getMetrics().getAfferentCoupling() as n
|
||||
order by n desc
|
||||
select t, t.getMetrics().getAfferentCoupling() as n order by n desc
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
* modularity
|
||||
* maintainability
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t
|
||||
where t.fromSource()
|
||||
select t, t.getMetrics().getEfferentCoupling() as n
|
||||
order by n desc
|
||||
select t, t.getMetrics().getEfferentCoupling() as n order by n desc
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
* maintainability
|
||||
* modularity
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t
|
||||
where t.fromSource()
|
||||
select t, t.getMetrics().getEfferentSourceCoupling() as n
|
||||
order by n desc
|
||||
select t, t.getMetrics().getEfferentSourceCoupling() as n order by n desc
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
* @tags changeability
|
||||
* modularity
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t
|
||||
where t.fromSource()
|
||||
select t, t.getMetrics().getInheritanceDepth() as n
|
||||
order by n desc
|
||||
select t, t.getMetrics().getInheritanceDepth() as n order by n desc
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
* @tags modularity
|
||||
* maintainability
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t
|
||||
where t.fromSource()
|
||||
select t, t.getMetrics().getLackOfCohesionCK() as n
|
||||
order by n desc
|
||||
select t, t.getMetrics().getLackOfCohesionCK() as n order by n desc
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
* @id java/lack-of-cohesion-hs
|
||||
* @tags modularity
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t
|
||||
where t.fromSource()
|
||||
select t, t.getMetrics().getLackOfCohesionHS() as n
|
||||
order by n desc
|
||||
select t, t.getMetrics().getLackOfCohesionHS() as n order by n desc
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
* @id java/lines-of-code-per-type
|
||||
* @tags maintainability
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t
|
||||
where t.fromSource()
|
||||
select t, t.getMetrics().getNumberOfLinesOfCode() as n
|
||||
order by n desc
|
||||
select t, t.getMetrics().getNumberOfLinesOfCode() as n order by n desc
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
* @tags maintainability
|
||||
* documentation
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t
|
||||
where t.fromSource()
|
||||
select t, t.getMetrics().getNumberOfCommentLines() as n
|
||||
order by n desc
|
||||
select t, t.getMetrics().getNumberOfCommentLines() as n order by n desc
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
* @id java/functions-per-type
|
||||
* @tags maintainability
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t
|
||||
where t.fromSource()
|
||||
select t, t.getMetrics().getNumberOfCallables() as n
|
||||
order by n desc
|
||||
select t, t.getMetrics().getNumberOfCallables() as n order by n desc
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
* @tags maintainability
|
||||
* complexity
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t
|
||||
where t.fromSource()
|
||||
select t, t.getMetrics().getNumberOfExplicitFields() as n
|
||||
order by n desc
|
||||
select t, t.getMetrics().getNumberOfExplicitFields() as n order by n desc
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
* @id java/statements-per-type
|
||||
* @tags maintainability
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t, int n
|
||||
where t.fromSource() and
|
||||
n = count(Stmt s | s.getEnclosingCallable() = t.getACallable())
|
||||
select t, n
|
||||
order by n desc
|
||||
where
|
||||
t.fromSource() and
|
||||
n = count(Stmt s | s.getEnclosingCallable() = t.getACallable())
|
||||
select t, n order by n desc
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
* @tags maintainability
|
||||
* documentation
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t, int n
|
||||
where t.fromSource()
|
||||
and n = (100 * t.getMetrics().getNumberOfCommentLines()) /
|
||||
(t.getMetrics().getNumberOfCommentLines() + t.getMetrics().getNumberOfLinesOfCode())
|
||||
select t, n
|
||||
order by n desc
|
||||
where
|
||||
t.fromSource() and
|
||||
n = (100 * t.getMetrics().getNumberOfCommentLines()) /
|
||||
(t.getMetrics().getNumberOfCommentLines() + t.getMetrics().getNumberOfLinesOfCode())
|
||||
select t, n order by n desc
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
* @tags testability
|
||||
* complexity
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
pragma[noopt]
|
||||
@@ -19,10 +20,10 @@ int complexCallableLines(MetricCallable c, RefType owner) {
|
||||
}
|
||||
|
||||
from MetricRefType t, int ccLoc, int loc
|
||||
where t.fromSource() and
|
||||
not (t instanceof GeneratedClass) and
|
||||
ccLoc = sum(Callable c, int cLoc | cLoc = complexCallableLines(c, t) | cLoc) and
|
||||
loc = t.getNumberOfLinesOfCode() and
|
||||
loc != 0
|
||||
select t, ((float)ccLoc*100)/loc as n
|
||||
order by n desc
|
||||
where
|
||||
t.fromSource() and
|
||||
not (t instanceof GeneratedClass) and
|
||||
ccLoc = sum(Callable c, int cLoc | cLoc = complexCallableLines(c, t) | cLoc) and
|
||||
loc = t.getNumberOfLinesOfCode() and
|
||||
loc != 0
|
||||
select t, (ccLoc.(float) * 100) / loc as n order by n desc
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
* @tags maintainability
|
||||
* complexity
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t
|
||||
where t.fromSource()
|
||||
select t, t.getMetrics().getResponse() as n
|
||||
order by n desc
|
||||
select t, t.getMetrics().getResponse() as n order by n desc
|
||||
|
||||
@@ -9,9 +9,11 @@
|
||||
* @tags portability
|
||||
* modularity
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t, float n
|
||||
where t.fromSource()
|
||||
and n = 100 * t.getMetrics().getEfferentSourceCoupling() / t.getMetrics().getEfferentCoupling()
|
||||
where
|
||||
t.fromSource() and
|
||||
n = 100 * t.getMetrics().getEfferentSourceCoupling() / t.getMetrics().getEfferentCoupling()
|
||||
select t, n
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
* @tags testability
|
||||
* modularity
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from Class c, int n
|
||||
where c.fromSource() and
|
||||
c.isPublic() and
|
||||
n = count(Method m | c.getAMethod() = m and m.isPublic())
|
||||
select c, n
|
||||
order by n desc
|
||||
where
|
||||
c.fromSource() and
|
||||
c.isPublic() and
|
||||
n = count(Method m | c.getAMethod() = m and m.isPublic())
|
||||
select c, n order by n desc
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
* @tags modularity
|
||||
* maintainability
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from RefType t
|
||||
where t.fromSource() and
|
||||
(t instanceof ParameterizedType implies t instanceof GenericType) and
|
||||
not t instanceof AnonymousClass
|
||||
select t, t.getMetrics().getSpecialisationIndex() as n
|
||||
order by n desc
|
||||
where
|
||||
t.fromSource() and
|
||||
(t instanceof ParameterizedType implies t instanceof GenericType) and
|
||||
not t instanceof AnonymousClass
|
||||
select t, t.getMetrics().getSpecialisationIndex() as n order by n desc
|
||||
|
||||
Reference in New Issue
Block a user