Skip to content

Commit af8c434

Browse files
authored
Merge pull request #466 from JohT/fix/verify-missing-typescript-modules
Verify missing typescript module dependencies with warnings
2 parents 7abed2f + a87fc03 commit af8c434

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
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

domains/anomaly-detection/summary/anomalyDetectionSummary.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ anomaly_detection_finalize_report() {
178178
source "${SCRIPTS_DIR}/cleanupAfterReportGeneration.sh" "${report_include_directory}"
179179

180180
# Collect static Markdown includes (after cleanup to not remove one-liner)
181+
cp -f "${ANOMALY_DETECTION_SUMMARY_DIR}/report_no_dependency_data.template.md" "${report_include_directory}/report_no_dependency_data.md"
181182
cp -f "${ANOMALY_DETECTION_SUMMARY_DIR}/report_no_anomaly_detection_treemaps.template.md" "${report_include_directory}/report_no_anomaly_detection_treemaps.md"
182183

183184
# Assemble final report by applying includes to the main template

domains/anomaly-detection/summary/report.template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ The goal is to detect potential **software quality, design, and architecture iss
2828

2929
### 1.3 Overview Charts
3030

31-
<!-- include:TreemapChartsReference.md|report_no_anomaly_detection_treemaps.md> -->
31+
<!-- include:TreemapChartsReference.md|report_no_anomaly_detection_treemaps.md -->
3232

3333
## 2. Deep Dives by Abstraction Level
3434

3535
Each abstraction level includes anomaly statistics, SHAP feature importance, archetype distribution, and example anomalies.
3636

37-
<!-- include:AnomalyDetectionDeepDive.md -->
37+
<!-- include:AnomalyDetectionDeepDive.md|report_no_dependency_data.md -->
3838

3939
## 3. Plot Interpretation Guide
4040

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
⚠️ _No dependent code units found to analyze._

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)