Skip to content

Commit c4a9143

Browse files
committed
Verify existing Typescript module dependencies
1 parent 7abed2f commit c4a9143

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Verify that there are either no Typescript modules at all or that there is at least one module dependency.
2+
3+
MATCH (source:TS:Module)
4+
OPTIONAL MATCH (source)-[moduleDependency:DEPENDS_ON2]->(:TS:Module)
5+
WITH count(DISTINCT source) AS moduleCount
6+
,count(moduleDependency) AS moduleDependencyCount
7+
WITH *, ((moduleCount = 0) OR (moduleDependencyCount > 0)) AS valid
8+
RETURN moduleCount AS typescriptModuleCount
9+
,moduleDependencyCount AS typescriptModuleDependencyCount
10+
,toInteger(valid) AS typescriptModuleDependenciesValid

scripts/prepareAnalysis.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Add_IS_IMPLEMENTED_IN_relationship_for_
9494
execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Add_IS_IMPLEMENTED_IN_relationship_for_matching_declarations.cypher"
9595
execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Add_DEPENDS_ON_relationship_to_resolved_modules.cypher"
9696

97+
dataVerificationResult=$( execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Verify_module_dependencies.cypher" "${@}")
98+
if ! is_csv_column_greater_zero "${dataVerificationResult}" "typescriptModuleDependenciesValid"; then
99+
# Warning: Very small Typescript projects might not have dependencies between their modules.
100+
# Therefore, it will only be a warning even though for example anomaly detection will not lead to any useable results.
101+
echo -e "${COLOR_YELLOW}prepareAnalysis: Data verification warning: Typescript module dependencies are missing! Results based on those will be missing or empty:${COLOR_DEFAULT}"
102+
echo -e "${COLOR_YELLOW}${dataVerificationResult}${COLOR_DEFAULT}"
103+
# Since this is now only a warning, execution will be continued.
104+
fi
105+
97106
# Preparation - Add weights to Java Package DEPENDS_ON relationships
98107
execute_cypher_summarized "${DEPENDS_ON_CYPHER_DIR}/Add_weight_property_for_Java_Interface_Dependencies_to_Package_DEPENDS_ON_Relationship.cypher"
99108
execute_cypher_summarized "${DEPENDS_ON_CYPHER_DIR}/Add_weight_property_to_Java_Package_DEPENDS_ON_Relationship.cypher"

0 commit comments

Comments
 (0)