Skip to content

Commit 8e104af

Browse files
authored
Merge pull request #57 from JohT/feature/windows-support
Support windows tested in git bash
2 parents 20dc664 + 831fb8d commit 8e104af

38 files changed

+526
-270
lines changed

.github/workflows/code-structure-analysis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ jobs:
9797
auto-activate-base: false
9898
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
9999

100+
- name: Conda environment info
101+
shell: bash -el {0}
102+
run: conda info
103+
100104
- name: Setup temp directory if missing
101105
run: mkdir -p ./temp
102106

COMMANDS.md

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,11 @@
22

33
## Start an analysis
44

5-
1. Create a directory for all analysis projects
6-
7-
```shell
8-
mkdir temp
9-
cd temp
10-
```
11-
12-
1. Create a working directory for your specific analysis
13-
14-
```shell
15-
mkdir MyFirstAnalysis
16-
cd MyFirstAnalysis
17-
```
18-
19-
1. Choose an initial password for Neo4j
20-
21-
```shell
22-
export NEO4J_INITIAL_PASSWORD=theinitialpasswordthatihavechosenforneo4j
23-
```
24-
25-
1. Create the `artifacts` directory for the code to be analyzed (without `cd` afterwards)
26-
27-
```shell
28-
mkdir artifacts
29-
```
30-
31-
1. Move the artifacts you want to analyze into the `artifacts` directory
32-
33-
1. Optionally run a predefined script to download artifacts
34-
35-
```shell
36-
./../../scripts/downloader/downloadAxonFramework.sh <version>
37-
```
38-
39-
1. Optionally use a script to download artifacts from Maven ([details](#download-maven-artifacts-to-analyze))
40-
41-
1. Start the analysis
42-
43-
```shell
44-
./../../scripts/analysis/analyze.sh
45-
```
5+
An analysis is started with the script [analyze.sh](./scripts/analysis/analyze.sh).
6+
To run all analysis steps simple execute the following command:
7+
```shell
8+
./../../scripts/analysis/analyze.sh
9+
```
4610

4711
👉 See [scripts/examples/analyzeAxonFramework.sh](./scripts/examples/analyzeAxonFramework.sh) as an example script that combines all the above steps.
4812
👉 See [Code Structure Analysis Pipeline](./.github/workflows/code-structure-analysis.yml) on how to do this within a GitHub Actions Workflow.

GETTING_STARTED.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Code Graph Analysis Pipeline - Getting started guide
2+
3+
This document describes the steps to get started as quickly as possible.
4+
For more details on what you can do with this pipeline see [README](./README.md).
5+
For more details on how the commands work in detail see [COMMANDS](./COMMANDS.md).
6+
7+
## 🛠 Prerequisites
8+
9+
Please read through the [Prerequisites](./README.md#🛠-prerequisites) in the [README](./README.md) file for what is required to run the scripts.
10+
11+
## Start an analysis
12+
13+
1. Create a directory for all analysis projects
14+
15+
```shell
16+
mkdir temp
17+
cd temp
18+
```
19+
20+
1. Create a working directory for your specific analysis
21+
22+
```shell
23+
mkdir MyFirstAnalysis
24+
cd MyFirstAnalysis
25+
```
26+
27+
1. Choose an initial password for Neo4j
28+
29+
```shell
30+
export NEO4J_INITIAL_PASSWORD=theinitialpasswordthatihavechosenforneo4j
31+
```
32+
33+
1. Create the `artifacts` directory for the code to be analyzed (without `cd` afterwards)
34+
35+
```shell
36+
mkdir artifacts
37+
```
38+
39+
1. Move the artifacts you want to analyze into the `artifacts` directory
40+
41+
1. Optionally run a predefined script to download artifacts
42+
43+
```shell
44+
./../../scripts/downloader/downloadAxonFramework.sh <version>
45+
```
46+
47+
1. Optionally use a script to download artifacts from Maven ([details](#download-maven-artifacts-to-analyze))
48+
49+
1. Start the analysis
50+
51+
- Without any additional dependencies:
52+
```shell
53+
./../../scripts/analysis/analyze.sh --report Csv
54+
```
55+
- Jupyter notebook reports when Python and Conda are installed:
56+
```shell
57+
./../../scripts/analysis/analyze.sh --report Jupyter
58+
```
59+
- Graph visualizations when Node.js and npm are installed:
60+
```shell
61+
./../../scripts/analysis/analyze.sh --report Jupyter
62+
```
63+
- All reports with Python, Conda, Node.js and npm installed:
64+
```shell
65+
./../../scripts/analysis/analyze.sh
66+
```
67+
- To explore the database yourself without any automatically generated reports and no additional requirements:
68+
```shell
69+
./../../scripts/analysis/analyze.sh
70+
```
71+
72+
👉 See [scripts/examples/analyzeAxonFramework.sh](./scripts/examples/analyzeAxonFramework.sh) as an example script that combines all the above steps.
73+
👉 See [Code Structure Analysis Pipeline](./.github/workflows/code-structure-analysis.yml) on how to do this within a GitHub Actions Workflow.

README.md

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Contained within this repository is a comprehensive and automated code graph ana
66

77
---
88

9-
## 🚀 Features
9+
## Features
1010

1111
- Analyze static code structure as a graph
1212
- Fully automated [pipeline](./.github/workflows/code-structure-analysis.yml) from tool installation to report generation
@@ -37,13 +37,36 @@ Here are some reports that utilize Neo4j's [Graph Data Science Library](https://
3737

3838
## 🛠 Prerequisites
3939

40-
- Java 17 is required (June 2023 Neo4j 5.x requirement)
41-
- Python and a conda package manager are required for Jupyter Notebook reports
42-
- Chromium will automatically be downloaded if needed for Jupyter Notebook reports in PDF format
40+
- Java 17 is [required for Neo4j](https://neo4j.com/docs/operations-manual/current/installation/requirements/#deployment-requirements-software) (Neo4j 5.x requirement).
41+
- On Windows it is recommended to use the git bash provided by [git for windows](https://gitforwindows.org).
42+
- [jq](https://github.com/jqlang/jq) the "lightweight and flexible command-line JSON processor" needs to be installed. Latest releases: https://github.com/jqlang/jq/releases/latest. Check using `jq --version`.
43+
- Set environment variable `NEO4J_INITIAL_PASSWORD` to a password of your choice. For example:
44+
```shell
45+
export NEO4J_INITIAL_PASSWORD=neo4j_password_of_my_choice
46+
```
47+
To run Jupyter notebooks, create an `.env` file in the folder from where you open the notebook containing for example: `NEO4J_INITIAL_PASSWORD=neo4j_password_of_my_choice`
48+
49+
### Further Prerequisites for Python and Jupyter Notebooks
50+
51+
- Python is required for Jupyter Notebook reports.
52+
- A conda package manager like [Miniconda](https://docs.conda.io/projects/miniconda/en/latest) or [Anaconda](https://www.anaconda.com/download)(Recommended for Windows) is required for Jupyter Notebook reports.
53+
- Chromium will automatically be downloaded if needed for Jupyter Notebook PDF reports generation.
54+
55+
### Further Prerequisites for Graph Visualization
56+
57+
These tools are needed to run the graph visualization scripts of directory [graph-visualization](./graph-visualization):
58+
59+
- [Node.js](https://nodejs.org/en)
60+
- [npm](https://www.npmjs.com)
61+
62+
### Hints for Windows
63+
64+
- Add this line to your `~/.bashrc` file if you are using Anaconda3: `/c/ProgramData/Anaconda3/etc/profile.d/conda.sh`. Try to find a similar script for other conda package managers or versions.
65+
- Run `conda init` in the git bash opened as administrator. Running it in normal mode usually leads to an error message.
4366

44-
## Getting Started
67+
## 🚀 Getting Started
4568

46-
See [Start an analysis](./COMMANDS.md#start-an-analysis) in the [Commands Reference](./COMMANDS.md) on how to start an analysis on your local machine.
69+
See [GETTING_STARTED.md](./GETTING_STARTED.md) on how to get started on your local machine.
4770

4871
## 🏗 Pipeline and Tools
4972

cypher/Community_Detection/Community_Detection_3a_WeaklyConnectedComponents_Estimate.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ RETURN requiredMemory
2323
,heapPercentageMin
2424
,heapPercentageMax
2525
,treeView
26-
,mapView
26+
//,mapView //doesn't work on Windows with git bash jq version jq-1.7-dirty

cypher/Community_Detection/Community_Detection_4a_Label_Propagation_Estimate.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ RETURN requiredMemory
2323
,heapPercentageMin
2424
,heapPercentageMax
2525
,treeView
26-
,mapView
26+
//,mapView //doesn't work on Windows with git bash jq version jq-1.7-dirty

cypher/Community_Detection/Community_Detection_5a_K_Core_Decomposition_Estimate.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ RETURN requiredMemory
2121
,heapPercentageMin
2222
,heapPercentageMax
2323
,treeView
24-
,mapView
24+
//,mapView //doesn't work on Windows with git bash jq version jq-1.7-dirty

cypher/Community_Detection/Community_Detection_6a_Approximate_Maximum_k_cut_Estimate.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ RETURN requiredMemory
2323
,heapPercentageMin
2424
,heapPercentageMax
2525
,treeView
26-
,mapView
26+
//,mapView //doesn't work on Windows with git bash jq version jq-1.7-dirty

cypher/External_Dependencies/External_package_usage_per_artifact_sorted_top.cypher

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ RETURN artifactName
4646
,externalTypeRate
4747
,numberOfExternalTypeCaller
4848
,numberOfExternalTypeCalls
49-
,size(externalPackageNames) AS numberOfExternalPackages
50-
,externalPackageNames[0..4] AS top5ExternalPackages
51-
,externalTypeNames[0..1] AS someExternalTypes
52-
LIMIT 40
49+
,size(externalPackageNames) AS numberOfExternalPackages
50+
,externalPackageNames[0..4] AS top5ExternalPackages
51+
,apoc.coll.flatten(externalTypeNames)[0..9] AS someExternalTypes

cypher/Node_Embeddings/Node_Embeddings_1a_Fast_Random_Projection_Estimate.cypher

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ CALL gds.fastRP.stream.estimate(
66
,relationshipWeightProperty: $dependencies_projection_weight_property
77
}
88
)
9-
YIELD requiredMemory, nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView, mapView
10-
RETURN requiredMemory, nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView, mapView
9+
YIELD requiredMemory, nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView
10+
RETURN requiredMemory, nodeCount, relationshipCount, bytesMin, bytesMax, heapPercentageMin, heapPercentageMax, treeView

0 commit comments

Comments
 (0)