Skip to content

Commit 410ce16

Browse files
committed
Restrict external module resolving to matching local module path
1 parent f686f83 commit 410ce16

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

cypher/Typescript_Enrichment/Add_RESOLVES_TO_relationship_for_matching_modules.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ WHERE module.globalFqn IS NOT NULL
1313
AND externalModule.moduleName = module.moduleName
1414
AND externalModule.namespace = module.namespace
1515
AND externalModule.extensionExtended = module.extensionExtended
16+
AND externalModule.globalFqn ENDS WITH module.localModulePath
1617
)
17-
)
1818
AND module <> externalModule
1919
CALL { WITH module, externalModule
2020
MERGE (externalModule)-[:RESOLVES_TO]->(module)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
// Set local root path of Typescript modules
3+
4+
MATCH (module:TS:Module)
5+
WITH *, ltrim(module.localFqn, '.') AS trimmedLocalFqn
6+
WITH *, split(module.globalFqn, trimmedLocalFqn)[0] AS rootPath
7+
WITH *, reverse(split(reverse(rootPath), reverse('source/'))[0]) AS localProjectPath
8+
SET module.localProjectPath = localProjectPath
9+
,module.localModulePath = localProjectPath + trimmedLocalFqn
10+
RETURN count(DISTINCT localProjectPath) AS identifiedLocalProjectPaths
11+
// Debugging
12+
//RETURN rootPath
13+
// ,localProjectPath
14+
// ,count(*)
15+
// ,collect(DISTINCT module.localFqn)[0..2] AS exampleModuleLocalFqn
16+
// ,collect(DISTINCT trimmedLocalFqn)[0..2] AS exampleTrimmedModuleLocalFqn

scripts/prepareAnalysis.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ execute_cypher "${GENERAL_ENRICHMENT_CYPHER_DIR}/Add_file_name and_extension.cyp
6565
# Preparation - Enrich Graph for Typescript by adding "module" and "name" properties
6666
execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Index_module_name.cypher"
6767
execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Add_module_properties.cypher"
68+
execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Set_localRootPath_for_modules.cypher"
6869
execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Mark_test_modules.cypher"
6970

7071
# Preparation - Enrich Graph for Typescript by adding a name properties

0 commit comments

Comments
 (0)