Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Global relative visibility statistics for elements for Typescript

MATCH (project:Directory)<-[:HAS_ROOT]-(:Project)-[:CONTAINS]->(module:TS:Module)
MATCH (module)-[:DECLARES]->(anyElement:TS)
OPTIONAL MATCH (module)-[:EXPORTS]->(exportedElement:TS)
WITH project.absoluteFileName AS projectPath
,module
,COUNT(DISTINCT exportedElement) AS exportedElements
,COUNT(DISTINCT anyElement) AS allElements
WITH projectPath
,module
,exportedElements
,allElements
,toFloat(exportedElements) / allElements AS relativeVisibility
WITH projectPath
,SUM(exportedElements) AS exported
,SUM(allElements) AS all
,AVG(relativeVisibility) AS average
,MIN(relativeVisibility) AS min
,MAX(relativeVisibility) AS max
,percentileCont(relativeVisibility, 0.25) AS percentile25
,percentileCont(relativeVisibility, 0.5) AS percentile50
,percentileCont(relativeVisibility, 0.75) AS percentile75
,percentileCont(relativeVisibility, 0.90) AS percentile90
,percentileCont(relativeVisibility, 0.95) AS percentile95
,percentileCont(relativeVisibility, 0.99) AS percentile99
RETURN projectPath
,all
,exported
,min
,max
,average
,percentile25
,percentile50
,percentile75
,percentile90
,percentile95
,percentile99
ORDER BY projectPath
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Relative visibility: exported elements to all elements per module

MATCH (project:Directory)<-[:HAS_ROOT]-(:Project)-[:CONTAINS]->(module:TS:Module)
MATCH (module)-[:DECLARES]->(moduleElement:TS)
// Check if element is not only declared but also exported.
// Only EXPORTS refers to re-exported elements.
OPTIONAL MATCH (module)-[export:EXPORTS]->(moduleElement)
WITH project.absoluteFileName AS projectPath
,module
,count(DISTINCT export) AS exportedElements
,count(DISTINCT moduleElement) AS allElements
WITH projectPath
,module
,exportedElements
,allElements
,toFloat(exportedElements) / allElements AS relativeVisibility
RETURN projectPath
,replace(module.fileName, './', '') AS modulePath
,module.name AS moduleName
,exportedElements
,allElements
,relativeVisibility
ORDER BY relativeVisibility DESC, allElements DESC, projectPath ASC, moduleName ASC
4 changes: 2 additions & 2 deletions jupyter/VisibilityMetricsJava.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"id": "2f0eabc4",
"metadata": {},
"source": [
"# Visibility Metrics\n",
"# Visibility Metrics for Java\n",
"<br> \n",
"\n",
"### References\n",
Expand Down Expand Up @@ -436,7 +436,7 @@
"pygments_lexer": "ipython3",
"version": "3.11.4"
},
"title": "Object Oriented Design Quality Metrics for Java with Neo4j"
"title": "Visibility Metrics for Java"
},
"nbformat": 4,
"nbformat_minor": 5
Expand Down
Loading