You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Download Maven Artifacts to analyze](#download-maven-artifacts-to-analyze)
@@ -51,13 +52,16 @@
51
52
52
53
## Start an Analysis
53
54
54
-
An analysis is started with the script [analyze.sh](./scripts/analysis/analyze.sh).
55
+
Before starting an analysis, setup your analysis as described in the [Getting Started](./GETTING_STARTED.md) guide.
56
+
An analysis is then started with the script [analyze.sh](./scripts/analysis/analyze.sh).
55
57
To run all analysis steps simple execute the following command:
56
58
57
59
```shell
58
60
./../../scripts/analysis/analyze.sh
59
61
```
60
62
63
+
**Hint:** Within the analysis workspace directory you can simply run `analyze.sh` directly without the `../../` prefix since the script is also available in the analysis workspace.
64
+
61
65
👉 See [scripts/examples/analyzeAxonFramework.sh](./scripts/examples/analyzeAxonFramework.sh) as an example script that combines all the above steps for a Java Project.
62
66
👉 See [scripts/examples/analyzeReactRouter.sh](./scripts/examples/analyzeReactRouter.sh) as an example script that combines all the above steps for a Typescript Project.
63
67
👉 See [Code Structure Analysis Pipeline](./.github/workflows/internal-java-code-analysis.yml) on how to do this within a GitHub Actions Workflow.
@@ -183,11 +187,23 @@ If any of the script are not allowed to be executed use `chmod +x ./scripts/` fo
183
187
Use [setupNeo4j.sh](./scripts/setupNeo4j.sh) to download [Neo4j](https://neo4j.com/download-center) and install the plugins [APOC](https://neo4j.com/labs/apoc/4.4) and [Graph Data Science](https://neo4j.com/product/graph-data-science).
184
188
This script requires the environment variable NEO4J_INITIAL_PASSWORD to be set. It sets the initial password with a temporary `NEO4J_HOME` environment variable to not interfere with a possibly globally installed Neo4j installation.
185
189
190
+
### Change Neo4j configuration template
191
+
192
+
Use [configureNeo4j.sh](./scripts/configureNeo4j.sh) to apply a different Neo4j configuration template from the [scripts/configuration](./scripts/configuration/) directory. This can be useful to optimize Neo4j for different workloads. Example:
**Hint:** In case you want to switch to the high memory profile as in the example, there is a simpler solution. Just run `useNeo4jHighMemoryProfile.sh` from the analysis workspace directory which will set the environment variable `NEO4J_CONFIG_TEMPLATE` and run `configureNeo4j.sh` for you.
199
+
186
200
### Start Neo4j Graph Database
187
201
188
202
Use [startNeo4j.sh](./scripts/startNeo4j.sh) to start the locally installed [Neo4j](https://neo4j.com/download-center) Graph database.
189
203
It runs the script with a temporary `NEO4J_HOME` environment variable to not interfere with a possibly globally installed Neo4j installation.
190
204
205
+
**Hint:** Within the analysis workspace directory you can simply run `startNeo4j.sh` directly without the `../../` prefix since the script is also available in the analysis workspace.
206
+
191
207
### Setup jQAssistant Java Code Analyzer
192
208
193
209
Use [setupJQAssistant.sh](./scripts/setupJQAssistant.sh) to download [jQAssistant](https://jqassistant.github.io/jqassistant/current).
Use [stopNeo4j.sh](./scripts/stopNeo4j.sh) to stop the locally running Neo4j Graph Database. It does nothing if the database is already stopped. It runs the script with a temporary `NEO4J_HOME` environment variable to not interfere with a possibly globally installed Neo4j installation.
348
364
365
+
**Hint:** Within the analysis workspace directory you can run `startNeo4j.sh` directly without the `../../` prefix since the script is also directly available in the analysis workspace.
366
+
349
367
## Jupyter Notebook
350
368
351
369
### Create a report with executeJupyterNotebookReport.sh
NEO4J_HTTP_PORT=${NEO4J_HTTP_PORT:-"7474"}# Neo4j HTTP API port for executing queries
46
+
NEO4J_HTTPS_PORT=${NEO4J_HTTPS_PORT:-"7473"}# Neo4j HTTPS port for encrypted querying
47
+
NEO4J_BOLT_PORT=${NEO4J_BOLT_PORT:-"7687"}# Neo4j's own "Bolt Protocol" port
48
+
49
+
NEO4J_CONFIG_TEMPLATE=${NEO4J_CONFIG_TEMPLATE:-"template-neo4j.conf"}# Name of the template file ("configuration" folder) for the Neo4j configuration. Defaults to "template-neo4j.conf".
50
+
51
+
## Get this "scripts" directory if not already set
52
+
# Even if $BASH_SOURCE is made for Bourne-like shells it is also supported by others and therefore here the preferred solution.
53
+
# CDPATH reduces the scope of the cd command to potentially prevent unintended directory changes.
54
+
# This way non-standard tools like readlink aren't needed.
55
+
SCRIPTS_DIR=${SCRIPTS_DIR:-$( CDPATH=. cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P )}# Repository directory containing the shell scripts
print "# This file had been configured with the configureNeo4j.sh script of code-graph-analysis-pipeline."
93
+
print "# Manual changes to this file might be overwritten when the script is executed again since the script is designed to update the configuration according to the template configuration."
94
+
print "# Please check the documentation of the configureNeo4j.sh script for more details."
local EYE_CATCHER_COMMENT_PREFIX="# The following configuration entries were taken from"
106
+
107
+
# Check if a template configuration had already been appended by looking for the eye-catcher comment.
108
+
# If it is already there, then delete the old template configuration including the eye-catcher and append the new one again to update it.
109
+
# This way this function is idempotent, the configuration is always up to date with the template and there are no duplicate entries.
110
+
if grep -q "^${EYE_CATCHER_COMMENT_PREFIX}""${NEO4J_CONFIG}";then
111
+
echo"${SCRIPT_NAME}: Deleting old configuration that had been appended from the template before since the eye-catcher comment was found. This ensures that there are no duplicate entries and that the configuration is up to date with the template."
112
+
sed -i.edit.backup "/^${EYE_CATCHER_COMMENT_PREFIX}/,/^# End of configuration from ${NEO4J_CONFIG_TEMPLATE}/d""${NEO4J_CONFIG}"
113
+
if grep -q '^$'"${NEO4J_CONFIG}";then
114
+
sed -i.edit.backup '$d'"${NEO4J_CONFIG}"# Delete the last line of the config if it is an empty line
115
+
fi
116
+
rm -f "${NEO4J_CONFIG}.edit.backup"# The backup is created even if not needed to be compatible with both GNU sed and BSD sed (e.g. on
117
+
fi
118
+
119
+
# Append first an eye-catcher comment to the configuration file to indicate that the configuration is script-managed
120
+
# and that manual changes might be overwritten.
121
+
{
122
+
echo""
123
+
echo"${EYE_CATCHER_COMMENT_PREFIX} '${NEO4J_CONFIG_TEMPLATE}' by the script ${SCRIPT_NAME}."
124
+
echo"# WARNING: Manual changes below this line might be overwritten when the script is executed again."
NEO4J_INSTALLATION_ADVICE="Please install Neo4j first by running an analysis or by executing the setupNeo4j.sh script directly."
132
+
133
+
if [ -z"${TOOLS_DIRECTORY}" ];then
134
+
fail "Requires variable TOOLS_DIRECTORY to be set. If it is the current directory, then use a dot to reflect that."
135
+
fi
136
+
if [ !-d"${TOOLS_DIRECTORY}" ];then
137
+
fail "Tools directory <${TOOLS_DIRECTORY}> does not exist. ${NEO4J_INSTALLATION_ADVICE}"
138
+
fi
139
+
140
+
# Check if SHARED_DOWNLOADS_DIRECTORY variable is set
141
+
if [ -z"${SHARED_DOWNLOADS_DIRECTORY}" ];then
142
+
fail "Requires variable SHARED_DOWNLOADS_DIRECTORY to be set. If it is the current directory, then use a dot to reflect that."
143
+
fi
144
+
if [ !-d"${SHARED_DOWNLOADS_DIRECTORY}" ];then
145
+
fail "Shared downloads directory <${SHARED_DOWNLOADS_DIRECTORY}> does not exist. ${NEO4J_INSTALLATION_ADVICE}"
146
+
fi
147
+
148
+
# Fail if Neo4j hadn't been downloaded yet
149
+
if [ !-d"${NEO4J_INSTALLATION_DIRECTORY}" ] ;then
150
+
fail "${NEO4J_INSTALLATION_NAME} is not installed into ${TOOLS_DIRECTORY} yet. ${NEO4J_INSTALLATION_ADVICE}"
151
+
fi
152
+
153
+
if [ !-f"${NEO4J_CONFIG_TEMPLATE_PATH}" ];then
154
+
fail "Configuration template file ${NEO4J_CONFIG_TEMPLATE} does not exist in the scripts/configuration folder. Please make sure it exists and is correctly named:\n${NEO4J_CONFIG_TEMPLATE_PATH}"
155
+
fi
156
+
157
+
# Create a backup of the original configuration file before any modification in case there is none yet.
0 commit comments