|
7 | 7 | # Fail on any error ("-e" = exit on first error, "-o pipefail" exist on errors within piped commands) |
8 | 8 | set -o errexit -o pipefail |
9 | 9 |
|
| 10 | +# Overrideable Defaults |
10 | 11 | IMPORT_GIT_LOG_DATA_IF_SOURCE_IS_PRESENT=${IMPORT_GIT_LOG_DATA_IF_SOURCE_IS_PRESENT:-"full"} # Select how to import git log data. Options: "none", "aggregated", "full". Default="full". |
11 | 12 |
|
12 | 13 | ## Get this "scripts" directory if not already set |
@@ -40,10 +41,14 @@ ARTIFACT_DEPENDENCIES_CYPHER_DIR="$CYPHER_DIR/Artifact_Dependencies" |
40 | 41 | TYPES_CYPHER_DIR="$CYPHER_DIR/Types" |
41 | 42 | TYPESCRIPT_CYPHER_DIR="$CYPHER_DIR/Typescript_Enrichment" |
42 | 43 |
|
| 44 | +COLOR_RED='\033[0;31m' |
| 45 | +COLOR_DEFAULT='\033[0m' |
| 46 | + |
43 | 47 | # Preparation - Data verification: DEPENDS_ON relationships |
44 | 48 | dataVerificationResult=$( execute_cypher "${CYPHER_DIR}/Data_verification_DEPENDS_ON_relationships.cypher" "${@}") |
45 | 49 | if ! is_csv_column_greater_zero "${dataVerificationResult}" "sourceNodeCount"; then |
46 | | - echo "prepareAnalysis: Error: Data verification failed. At least one DEPENDS_ON relationship required. Check if the artifacts directory is empty or if the scan failed." |
| 50 | + echo -e "${COLOR_RED}prepareAnalysis: Error: Data verification failed. At least one DEPENDS_ON relationship is required. Check if the artifacts directory is empty or if the scan failed.${COLOR_DEFAULT}" |
| 51 | + echo -e "${COLOR_RED}${dataVerificationResult}${COLOR_DEFAULT}" |
47 | 52 | exit 1 |
48 | 53 | fi |
49 | 54 |
|
@@ -71,6 +76,13 @@ execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Remove_duplicate_CONTAINS_relations_bet |
71 | 76 |
|
72 | 77 | # Preparation - Enrich Graph for Typescript by adding relationships between corresponding TS:Project and NPM:Package nodes |
73 | 78 | execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Link_projects_to_npm_packages.cypher" |
| 79 | +dataVerificationResult=$( execute_cypher "${TYPESCRIPT_CYPHER_DIR}/Verify_projects_linked_to_npm_packages.cypher" "${@}") |
| 80 | +if is_csv_column_greater_zero "${dataVerificationResult}" "unresolvedProjectsCount"; then |
| 81 | + # There are Typescript projects and the unresolvedProjectsCount is greater than zero |
| 82 | + echo -e "${COLOR_RED}prepareAnalysis: Error: Data verification failed. There are Typescript projects without a linked npm package:${COLOR_DEFAULT}" |
| 83 | + echo -e "${COLOR_RED}${dataVerificationResult}${COLOR_DEFAULT}" |
| 84 | + exit 1 |
| 85 | +fi |
74 | 86 |
|
75 | 87 | # Preparation - Add weights to Java Package DEPENDS_ON relationships |
76 | 88 | execute_cypher_summarized "${DEPENDS_ON_CYPHER_DIR}/Add_weight_property_for_Java_Interface_Dependencies_to_Package_DEPENDS_ON_Relationship.cypher" |
|
0 commit comments