Skip to content

Commit b2e5480

Browse files
authored
Merge pull request #209 from JohT/feature/detect-and-mark-test-modules-for-typescript
Detect, mark and filter test related modules in Typescript analysis
2 parents ee2949c + 5c65aec commit b2e5480

22 files changed

+90
-95
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Prepare projection by e.g. filling in default values for missing properties
2+
3+
MATCH (source)-[DEPENDS_ON]->(target)
4+
WHERE $dependencies_projection_node IN labels(source)
5+
AND $dependencies_projection_node IN labels(target)
6+
SET source.testMarkerInteger = coalesce(source.testMarkerInteger, 0)
7+
,target.testMarkerInteger = coalesce(target.testMarkerInteger, 0)
8+
RETURN count(*) AS numberOfDependencies

cypher/Dependencies_Projection/Dependencies_3_Create_Projection.cypher

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
$dependencies_projection_node,
66
'DEPENDS_ON', {
77
relationshipProperties: [$dependencies_projection_weight_property],
8-
nodeProperties: ['incomingDependencies', 'outgoingDependencies']
9-
})
8+
nodeProperties: ['incomingDependencies', 'outgoingDependencies', 'testMarkerInteger']
9+
}
10+
)
1011
YIELD graphName, nodeCount, relationshipCount
1112
RETURN graphName, nodeCount, relationshipCount

cypher/Dependencies_Projection/Dependencies_3b_Create_Multi_Relationship_Projection.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
defaultValue: 1.0
1717
}
1818
},
19-
nodeProperties: ['incomingDependencies', 'outgoingDependencies']
19+
nodeProperties: ['incomingDependencies', 'outgoingDependencies', 'testMarkerInteger']
2020
}
2121
)
2222
YIELD graphName, nodeCount, relationshipCount

cypher/Dependencies_Projection/Dependencies_4_Create_Undirected_Projection.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CALL gds.graph.project(
1010
},
1111
{
1212
relationshipProperties: [$dependencies_projection_weight_property],
13-
nodeProperties: ['incomingDependencies', 'outgoingDependencies']
13+
nodeProperties: ['incomingDependencies', 'outgoingDependencies', 'testMarkerInteger']
1414
}
1515
)
1616
YIELD graphName, nodeCount, relationshipCount

cypher/Dependencies_Projection/Dependencies_5_Create_Subgraph.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
CALL gds.graph.filter(
44
$dependencies_projection + '-cleaned',
55
$dependencies_projection,
6-
'n.outgoingDependencies > 0 OR n.incomingDependencies > 0',
6+
'n.testMarkerInteger = 0 AND (n.outgoingDependencies > 0 OR n.incomingDependencies > 0)',
77
'*'
88
)
99
YIELD graphName, fromGraphName, nodeCount, relationshipCount, nodeFilter

cypher/External_Dependencies/External_module_usage_overall_for_Typescript.cypher

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// External Typescript module usage overall
22

33
MATCH (internalModule:TS:Module)-[:EXPORTS]->(internalElement:TS)
4+
WHERE NOT internalModule:TestRelated
45
WITH count(DISTINCT internalElement.globalFqn) AS allInternalElements
56
,count(DISTINCT internalModule.globalFqn) AS allModules
67
,collect(DISTINCT internalElement) AS internalElementList

cypher/External_Dependencies/External_module_usage_per_internal_module_aggregated_for_Typescript.cypher

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
// External Typescript module usage per interal module aggregated
1+
// External Typescript module usage per internal module aggregated
22

33
// Get the overall internal module statistics first
44
MATCH (internalModule:TS:Module)-[:EXPORTS]->(internalElement:TS)
5+
WHERE NOT internalModule:TestRelated
56
WITH internalModule.name AS internalModuleName
67
,internalModule.communityLeidenId AS leidenCommunityId
78
,count(DISTINCT internalElement.globalFqn) AS internalModuleElementsCount

cypher/External_Dependencies/External_module_usage_per_internal_module_distribution_for_Typescript.cypher

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// External Typescript module usage distribution for internal modules
22

33
MATCH (internalModule:TS:Module)-[:EXPORTS]->(internalElement:TS)
4+
WHERE NOT internalModule:TestRelated
45
WITH internalModule.name AS internalModuleName
56
,count(DISTINCT internalElement.globalFqn) AS numberOfAllInternalElements
67
,collect(DISTINCT internalElement) AS internalElementList

cypher/External_Dependencies/External_module_usage_per_internal_module_sorted_for_Typescript.cypher

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// External Typescript module usage per internal module sorted by external usage descending
22

33
MATCH (internalModule:TS:Module)-[:EXPORTS]->(internalElement:TS)
4+
WHERE NOT internalModule:TestRelated
45
OPTIONAL MATCH (internalElement)-[:DEPENDS_ON]->(externalDeclaration:ExternalDeclaration)
56
WHERE externalDeclaration.isExternalImport = true
67
OPTIONAL MATCH (externalModule:ExternalModule)-[:EXPORTS]->(externalDeclaration)

cypher/External_Dependencies/External_module_usage_spread_for_Typescript.cypher

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
// Get the overall internal modules statistics first
44
MATCH (internalModule:TS:Module)-[:EXPORTS]->(internalElement:TS)
5+
WHERE NOT internalModule:TestRelated
56
WITH count(DISTINCT internalModule.globalFqn) AS internalModulesCountOverall
67
,count(DISTINCT internalElement.globalFqn) AS internalElementsCountOverall
78
,collect(DISTINCT internalElement) AS internalElementList

0 commit comments

Comments
 (0)