Skip to content

Commit 6c63cb7

Browse files
committed
Optimize overview reports
1 parent be6330d commit 6c63cb7

File tree

5 files changed

+431
-115
lines changed

5 files changed

+431
-115
lines changed

cypher/Overview/Effective_lines_of_method_code_per_package.cypher

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
,package.fqn AS fullPackageName
99
,package.name AS packageName
1010
,sum(method.effectiveLineCount) AS sumEffectiveLinesOfMethodCode
11+
,sum(method.cyclomaticComplexity) AS sumCyclomaticComplexity
1112
,COUNT(DISTINCT method) AS numberOfMethods
1213
,reduce( // Get the max effectiveLineCount of all methods in the package with the name and type of the method
1314
loc = {max:-1}, // initial object with max lines of code = -1
@@ -16,7 +17,7 @@
1617
THEN {max: m.method.effectiveLineCount, method: m.method, type: m.type} // then update the object
1718
ELSE loc // otherwise keep the object as it was
1819
END
19-
) AS methodWithMaxLoc
20+
) AS methodWithMaxLinesOfCode
2021
,reduce( // Get the max cyclomaticComplexity of all methods in the package with the name and type of the method
2122
cmplx = {max:-1}, // initial object with max cyclomatic complexity = -1
2223
m IN collect({method:method, type:type}) | // collect all methods and their types as objects
@@ -27,12 +28,13 @@
2728
) AS methodWithMaxCyclomaticComplexity
2829
RETURN artifactName, fullPackageName
2930
,sumEffectiveLinesOfMethodCode AS linesInPackage
31+
,sumCyclomaticComplexity AS complexityInPackage
3032
,numberOfMethods AS methodCount
31-
,methodWithMaxLoc.max AS maxLinesMethod
32-
,methodWithMaxLoc.type.name AS maxLinesMethodType
33-
,methodWithMaxLoc.method.name AS maxLinesMethodName
33+
,methodWithMaxLinesOfCode.max AS maxLinesMethod
34+
,methodWithMaxLinesOfCode.type.name AS maxLinesMethodType
35+
,methodWithMaxLinesOfCode.method.name AS maxLinesMethodName
3436
,methodWithMaxCyclomaticComplexity.max AS maxComplexity
3537
,methodWithMaxCyclomaticComplexity.type.name AS maxComplexityType
3638
,methodWithMaxCyclomaticComplexity.method.name AS maxComplexityMethod
3739
,packageName
38-
ORDER BY sumEffectiveLinesOfMethodCode DESC, artifactName ASC, fullPackageName
40+
ORDER BY linesInPackage DESC, artifactName ASC, fullPackageName

cypher/Overview/Number_of_types_per_artifact.cypher

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@
22

33
MATCH (artifact:Artifact)-[:CONTAINS]->(type:Type)
44
WITH replace(last(split(artifact.fileName, '/')), '.jar', '') AS artifactName
5+
,count(DISTINCT type.fqn) AS numberOfArtifactTypes
6+
,collect(DISTINCT type) AS types
7+
UNWIND types AS type
8+
WITH artifactName
9+
,numberOfArtifactTypes
510
,type
611
,labels(type) AS typeLabels
712
UNWIND typeLabels AS typeLabel
8-
WITH artifactName, type, typeLabel
13+
WITH artifactName
14+
,numberOfArtifactTypes
15+
,type
16+
,typeLabel
917
WHERE typeLabel IN ['Class', 'Interface', 'Annotation', 'Enum']
1018
RETURN artifactName
19+
,numberOfArtifactTypes
1120
,typeLabel AS languageElement
12-
,count(type) AS numberOfTypes
21+
,count(type) AS numberOfTypes
22+
ORDER BY numberOfArtifactTypes DESC, artifactName ASC
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Overview size
2+
3+
MATCH (n)
4+
WITH COUNT(n) AS nodeCount
5+
MATCH ()-[]->()
6+
WITH nodeCount
7+
,count(*) AS relationshipCount
8+
MATCH (a:Artifact:Archive)
9+
WITH nodeCount
10+
,relationshipCount
11+
,count(DISTINCT a.fileName) AS artifactCount
12+
MATCH (p:Package)
13+
WITH nodeCount
14+
,relationshipCount
15+
,artifactCount
16+
,count(DISTINCT p.fqn) AS packageCount
17+
MATCH (t:Type)
18+
WITH nodeCount
19+
,relationshipCount
20+
,artifactCount
21+
,packageCount
22+
,count(DISTINCT t.fqn) AS typeCount
23+
MATCH (m:Method)
24+
WITH nodeCount
25+
,relationshipCount
26+
,artifactCount
27+
,packageCount
28+
,typeCount
29+
,count(DISTINCT m.signature) AS methodCount
30+
MATCH (member:Member)
31+
WITH nodeCount
32+
,relationshipCount
33+
,artifactCount
34+
,packageCount
35+
,typeCount
36+
,methodCount
37+
,count(DISTINCT member.signature) AS memberCount
38+
RETURN nodeCount
39+
,relationshipCount
40+
,artifactCount
41+
,packageCount
42+
,typeCount
43+
,methodCount
44+
,memberCount

0 commit comments

Comments
 (0)