diff --git a/cypher/Typescript_Enrichment/Verify_module_dependencies.cypher b/cypher/Typescript_Enrichment/Verify_module_dependencies.cypher new file mode 100644 index 000000000..2c5caaf5d --- /dev/null +++ b/cypher/Typescript_Enrichment/Verify_module_dependencies.cypher @@ -0,0 +1,10 @@ +// Verify that there are either no Typescript modules at all or that there is at least one module dependency. + +MATCH (source:TS:Module) +OPTIONAL MATCH (source)-[moduleDependency:DEPENDS_ON2]->(:TS:Module) + WITH count(DISTINCT source) AS moduleCount + ,count(moduleDependency) AS moduleDependencyCount + WITH *, ((moduleCount = 0) OR (moduleDependencyCount > 0)) AS valid +RETURN moduleCount AS typescriptModuleCount + ,moduleDependencyCount AS typescriptModuleDependencyCount + ,toInteger(valid) AS typescriptModuleDependenciesValid \ No newline at end of file diff --git a/domains/anomaly-detection/summary/anomalyDetectionSummary.sh b/domains/anomaly-detection/summary/anomalyDetectionSummary.sh index 6335c8b9f..c542c22cd 100755 --- a/domains/anomaly-detection/summary/anomalyDetectionSummary.sh +++ b/domains/anomaly-detection/summary/anomalyDetectionSummary.sh @@ -178,6 +178,7 @@ anomaly_detection_finalize_report() { source "${SCRIPTS_DIR}/cleanupAfterReportGeneration.sh" "${report_include_directory}" # Collect static Markdown includes (after cleanup to not remove one-liner) + cp -f "${ANOMALY_DETECTION_SUMMARY_DIR}/report_no_dependency_data.template.md" "${report_include_directory}/report_no_dependency_data.md" cp -f "${ANOMALY_DETECTION_SUMMARY_DIR}/report_no_anomaly_detection_treemaps.template.md" "${report_include_directory}/report_no_anomaly_detection_treemaps.md" # Assemble final report by applying includes to the main template diff --git a/domains/anomaly-detection/summary/report.template.md b/domains/anomaly-detection/summary/report.template.md index 59275eb46..407cfc5a1 100644 --- a/domains/anomaly-detection/summary/report.template.md +++ b/domains/anomaly-detection/summary/report.template.md @@ -28,13 +28,13 @@ The goal is to detect potential **software quality, design, and architecture iss ### 1.3 Overview Charts - + ## 2. Deep Dives by Abstraction Level Each abstraction level includes anomaly statistics, SHAP feature importance, archetype distribution, and example anomalies. - + ## 3. Plot Interpretation Guide diff --git a/domains/anomaly-detection/summary/report_no_dependency_data.template.md b/domains/anomaly-detection/summary/report_no_dependency_data.template.md new file mode 100644 index 000000000..9d0fa7fbf --- /dev/null +++ b/domains/anomaly-detection/summary/report_no_dependency_data.template.md @@ -0,0 +1 @@ +⚠️ _No dependent code units found to analyze._ \ No newline at end of file diff --git a/scripts/prepareAnalysis.sh b/scripts/prepareAnalysis.sh index a5b684a08..2b86569d9 100644 --- a/scripts/prepareAnalysis.sh +++ b/scripts/prepareAnalysis.sh @@ -94,6 +94,15 @@ execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Add_IS_IMPLEMENTED_IN_relationship_for_ execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Add_IS_IMPLEMENTED_IN_relationship_for_matching_declarations.cypher" execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Add_DEPENDS_ON_relationship_to_resolved_modules.cypher" +dataVerificationResult=$( execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Verify_module_dependencies.cypher" "${@}") +if ! is_csv_column_greater_zero "${dataVerificationResult}" "typescriptModuleDependenciesValid"; then + # Warning: Very small Typescript projects might not have dependencies between their modules. + # Therefore, it will only be a warning even though for example anomaly detection will not lead to any useable results. + echo -e "${COLOR_YELLOW}prepareAnalysis: Data verification warning: Typescript module dependencies are missing! Results based on those will be missing or empty:${COLOR_DEFAULT}" + echo -e "${COLOR_YELLOW}${dataVerificationResult}${COLOR_DEFAULT}" + # Since this is now only a warning, execution will be continued. +fi + # Preparation - Add weights to Java Package DEPENDS_ON relationships execute_cypher_summarized "${DEPENDS_ON_CYPHER_DIR}/Add_weight_property_for_Java_Interface_Dependencies_to_Package_DEPENDS_ON_Relationship.cypher" execute_cypher_summarized "${DEPENDS_ON_CYPHER_DIR}/Add_weight_property_to_Java_Package_DEPENDS_ON_Relationship.cypher"