Skip to content

Commit ff3a390

Browse files
authored
Merge pull request #260 from JohT/feature/improve-external-modules-and-declarations-naming
Improve naming of external Typescript nodes
2 parents 77f31fe + e5b7600 commit ff3a390

19 files changed

+151
-72
lines changed

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- os: ubuntu-latest
4949
java: 17
5050
python: 3.11
51-
mambaforge: 24.9.0-0
51+
miniforge: 24.9.0-0
5252

5353
env:
5454
CI_COMMIT_MESSAGE: Automated code structure analysis reports (CI)
@@ -78,7 +78,7 @@ jobs:
7878
working-directory: graph-visualization
7979
run: npm ci
8080

81-
- name: Setup Cache for Conda package manager Mambaforge
81+
- name: Setup Cache for Conda package manager Miniforge
8282
uses: actions/cache@v4
8383
env:
8484
# Increase this value to reset cache if etc/example-environment.yml has not changed
@@ -90,13 +90,11 @@ jobs:
9090
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-environments-${{hashFiles('**/environment.yml', '.github/workflows/*.yml') }}
9191

9292
# "Setup Python" can be skipped if jupyter notebook reports aren't needed
93-
- name: Setup Python ${{ matrix.python }} with Conda package manager Mambaforge
93+
- name: Setup Python ${{ matrix.python }} with Conda package manager Miniforge
9494
uses: conda-incubator/setup-miniconda@v3
9595
with:
9696
python-version: ${{ matrix.python }}
97-
miniforge-variant: Mambaforge
98-
miniforge-version: ${{ matrix.mambaforge }}
99-
use-mamba: true
97+
miniforge-version: ${{ matrix.miniforge }}
10098
activate-environment: codegraph
10199
environment-file: ./jupyter/environment.yml
102100
auto-activate-base: false
@@ -144,7 +142,7 @@ jobs:
144142
if: failure()
145143
uses: actions/upload-artifact@v4
146144
with:
147-
name: code-analysis-logs-java-${{ matrix.java }}-python-${{ matrix.python }}-mambaforge-${{ matrix.mambaforge }}
145+
name: code-analysis-logs-java-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }}
148146
path: |
149147
./temp/**/runtime/*
150148
./temp/**/reports/*
@@ -155,7 +153,7 @@ jobs:
155153
if: success()
156154
uses: actions/upload-artifact@v4
157155
with:
158-
name: code-report-results-java-${{ matrix.java }}-python-${{ matrix.python }}-mambaforge-${{ matrix.mambaforge }}
156+
name: code-report-results-java-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }}
159157
path: ./results
160158
if-no-files-found: error
161159
retention-days: 5
@@ -166,7 +164,7 @@ jobs:
166164
#- name: Archive exported database
167165
# uses: actions/upload-artifact@v3
168166
# with:
169-
# name: code-report-database-export-${{ matrix.java }}-python-${{ matrix.python }}-mambaforge-${{ matrix.mambaforge }}
167+
# name: code-report-database-export-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }}
170168
# path: ./temp/**/import
171169
# if-no-files-found: error
172170
# retention-days: 5

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- os: ubuntu-latest
4949
java: 17
5050
python: 3.11
51-
mambaforge: 24.9.0-0
51+
miniforge: 24.9.0-0
5252

5353
env:
5454
CI_COMMIT_MESSAGE: Automated code structure analysis reports (CI)
@@ -69,7 +69,7 @@ jobs:
6969
distribution: 'adopt'
7070
java-version: ${{ matrix.java }}
7171

72-
- name: Setup Node.js
72+
- name: Setup Node.js for Graph Visualization
7373
uses: actions/setup-node@v4
7474
with:
7575
node-version-file: 'graph-visualization/.nvmrc'
@@ -78,7 +78,7 @@ jobs:
7878
working-directory: graph-visualization
7979
run: npm ci
8080

81-
- name: Setup Cache for Conda package manager Mambaforge
81+
- name: Setup Cache for Conda package manager Miniforge
8282
uses: actions/cache@v4
8383
env:
8484
# Increase this value to reset cache if etc/example-environment.yml has not changed
@@ -90,13 +90,11 @@ jobs:
9090
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-environments-${{hashFiles('**/environment.yml', '.github/workflows/*.yml') }}
9191

9292
# "Setup Python" can be skipped if jupyter notebook reports aren't needed
93-
- name: Setup Python ${{ matrix.python }} with Conda package manager Mambaforge
93+
- name: Setup Python ${{ matrix.python }} with Conda package manager Miniforge
9494
uses: conda-incubator/setup-miniconda@v3
9595
with:
9696
python-version: ${{ matrix.python }}
97-
miniforge-variant: Mambaforge
98-
miniforge-version: ${{ matrix.mambaforge }}
99-
use-mamba: true
97+
miniforge-version: ${{ matrix.miniforge }}
10098
activate-environment: codegraph
10199
environment-file: ./jupyter/environment.yml
102100
auto-activate-base: false
@@ -153,7 +151,7 @@ jobs:
153151
if: failure()
154152
uses: actions/upload-artifact@v4
155153
with:
156-
name: code-analysis-logs-java-${{ matrix.java }}-python-${{ matrix.python }}-mambaforge-${{ matrix.mambaforge }}
154+
name: code-analysis-logs-java-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }}
157155
path: |
158156
./temp/**/runtime/*
159157
./temp/**/reports/*
@@ -164,7 +162,7 @@ jobs:
164162
if: success()
165163
uses: actions/upload-artifact@v4
166164
with:
167-
name: code-report-results-java-${{ matrix.java }}-python-${{ matrix.python }}-mambaforge-${{ matrix.mambaforge }}
165+
name: code-report-results-java-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }}
168166
path: ./results
169167
if-no-files-found: error
170168
retention-days: 5
@@ -175,7 +173,7 @@ jobs:
175173
#- name: Archive exported database
176174
# uses: actions/upload-artifact@v3
177175
# with:
178-
# name: code-report-database-export-${{ matrix.java }}-python-${{ matrix.python }}-mambaforge-${{ matrix.mambaforge }}
176+
# name: code-report-database-export-${{ matrix.java }}-python-${{ matrix.python }}-miniforge-${{ matrix.miniforge }}
179177
# path: ./temp/**/import
180178
# if-no-files-found: error
181179
# retention-days: 5

GETTING_STARTED.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,35 @@ For more details on how the commands work in detail see [COMMANDS](./COMMANDS.md
88

99
Please read through the [Prerequisites](./README.md#hammer_and_wrench-prerequisites) in the [README](./README.md) file for what is required to run the scripts.
1010

11-
## Start an analysis
11+
## The easiest way to get started
12+
13+
Just run one of the following examples in the directory of this file:
14+
15+
- [./scripts/examples/analyzeAxonFramework.sh](./scripts/examples/analyzeAxonFramework.sh) (Java event-sourcing library)
16+
- [./scripts/examples/analyzeAntDesign.sh](./scripts/examples/analyzeAntDesign.sh) (Typescript UI library)
17+
- [./scripts/examples/analyzeReactRouter.sh](./scripts/examples/analyzeReactRouter.sh) (Typescript React library)
18+
19+
Use these optional command line options as you like:
20+
21+
- (Recommended) Only create CSV reports and skip Python and Node.js dependent reports. Example:
22+
23+
```shell
24+
./scripts/examples/analyzeAxonFramework.sh --report CSV
25+
```
26+
27+
- Only explore the graph manually in the [browser](http://localhost:7474/browser). Skip all automated reports. Example:
28+
29+
```shell
30+
./scripts/examples/analyzeAxonFramework.sh --explore
31+
```
32+
33+
- Add the version number of the project to pick a specific one. Example:
34+
35+
```shell
36+
./scripts/examples/analyzeAxonFramework.sh 4.10.1
37+
```
38+
39+
## Start an own analysis
1240

1341
1. Create a directory for all analysis projects.
1442

cypher/Dependencies_Projection/Dependencies_0_Verify_Projectable.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
,(dependency[$dependencies_projection_weight_property]) AS weightPropertyValue
88
,(dependency[$dependencies_projection_weight_property] < 1) AS nonPositiveWeightPropertyValue
99
,coalesce(dependency.resolved, false) AS resolvedDependency
10-
,EXISTS { (target)<-[:RESOLVES_TO]-(resolvedTarget:ExternalModule) } AS resolvedTarget
10+
,EXISTS { (target)<-[:IS_IMPLEMENTED_IN]-(resolvedTarget:ExternalModule) } AS resolvedTarget
1111
,(source.incomingDependencies IS NULL OR
1212
target.incomingDependencies IS NULL) AS missingIncomingDependencies
1313
,(source.outgoingDependencies IS NULL OR

cypher/DependsOn_Relationship_Weights/Add_fine_grained_weights_for_Typescript_external_module_dependencies.cypher

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
MATCH (source:TS:Module)-[moduleDependency:DEPENDS_ON]->(target:ExternalModule)
55
// Exclude all targets where an ExternalModule was found that resolves to them
66
// because those are covered in the fine grained weights for "ExternalModule"s.
7-
WHERE NOT EXISTS { (target)-[:RESOLVES_TO]->(source) }
8-
OPTIONAL MATCH (source)-[resolvedModuleDependency:DEPENDS_ON]->(resolvedTarget:TS:Module)<-[:RESOLVES_TO]-(target)
7+
WHERE NOT EXISTS { (target)-[:IS_IMPLEMENTED_IN]->(source) }
8+
OPTIONAL MATCH (source)-[resolvedModuleDependency:DEPENDS_ON]->(resolvedTarget:TS:Module)<-[:IS_IMPLEMENTED_IN]-(target)
99
WITH source
1010
,target
1111
,moduleDependency
@@ -24,7 +24,7 @@ OPTIONAL MATCH (source)-[rd:DEPENDS_ON]->(declaration:ExternalDeclaration)<-[:EX
2424
,collect(declaration) AS declarations
2525
// Get optional low coupling elements (TypeAlias, Interface) that the source module contains and defines (low level) that depend on the external module (target)
2626
UNWIND declarations AS declaration
27-
OPTIONAL MATCH (source)-[ra:DEPENDS_ON]->(declaration)-[:RESOLVES_TO]->(abstractType:TypeAlias|Interface)
27+
OPTIONAL MATCH (source)-[ra:DEPENDS_ON]->(declaration)-[:IS_IMPLEMENTED_IN]->(abstractType:TypeAlias|Interface)
2828
WITH source
2929
,target
3030
,moduleDependency

cypher/DependsOn_Relationship_Weights/Add_fine_grained_weights_for_Typescript_internal_module_dependencies.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
WHERE moduleDependency.declarationCount IS NULL
88
// Ruling out resolved targets also filters out entries that aren't covered by the fine grained weights for "ExternalModule"s.
99
// Therefore, the exists filter is commented out for now and replaced by focussing on missing detailed weight properties to catch them all.
10-
//WHERE NOT EXISTS { (target)<-[:RESOLVES_TO]-(resolvedTarget:ExternalModule) }
10+
//WHERE NOT EXISTS { (target)<-[:IS_IMPLEMENTED_IN]-(resolvedTarget:ExternalModule) }
1111
WITH source
1212
,target
1313
,moduleDependency

cypher/External_Dependencies/List_external_modules_resolved_to_internal_ones_for_Typescript.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Statistics about how many ExternalModule nodes were found that match internal Module nodes
22

3-
MATCH (module:TS:Module)<-[resolved:RESOLVES_TO]-(external:TS:ExternalModule)
3+
MATCH (module:TS:Module)<-[resolved:IS_IMPLEMENTED_IN]-(external:TS:ExternalModule)
44
OPTIONAL MATCH (project:TS:Project)-[:CONTAINS]->(module)
55
WITH project.name AS projectName
66
,count(DISTINCT module) AS resolvedModuleCount

cypher/GitLog/Delete_plain_git_directory_file_nodes.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Delete plain file nodes in "/.git" directory
22

3-
MATCH (git_metadata_file:File)<-[:CONTAINS*]-(git_directory:Directory)
3+
MATCH (git_metadata_file:File&!Repository)<-[:CONTAINS*]-(git_directory:Directory&!Repository)
44
WHERE git_directory.fileName ENDS WITH '/.git'
55
WITH git_directory.fileName AS gitDirectory
66
,count(DISTINCT git_metadata_file.fileName) AS numberOfFiles

cypher/Metrics/Set_Outgoing_Typescript_Module_Dependencies.cypher

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
// Get the top level dependency between a Typescript module and an external modules it uses
44
MATCH (source:TS:Module)
55
OPTIONAL MATCH (source)-[moduleDependency:DEPENDS_ON]->(target:ExternalModule)
6-
WHERE NOT EXISTS {(target)-[:RESOLVES_TO]->(source)}
6+
WHERE NOT EXISTS {(target)-[:IS_IMPLEMENTED_IN]->(source)}
77
// Get the project of the external module if available
8-
OPTIONAL MATCH (projectdir:Directory)<-[:HAS_ROOT]-(project:TS:Project)-[:CONTAINS]->(:TS:Module)<-[:RESOLVES_TO]-(target)
8+
OPTIONAL MATCH (projectdir:Directory)<-[:HAS_ROOT]-(project:TS:Project)-[:CONTAINS]->(:TS:Module)<-[:IS_IMPLEMENTED_IN]-(target)
99
// Aggregate all gathered information for each (grouped by) source module
1010
WITH source
1111
,collect(DISTINCT projectdir.absoluteFileName) AS projectNames

cypher/Typescript_Enrichment/Add_DEPENDS_ON_relationship_to_resolved_modules.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Inspired by https://github.com/jQAssistant/jqassistant/blob/4cd7face5d6d2953449d8e6ff5b484f00ffbdc2f/plugin/java/src/main/resources/META-INF/jqassistant-rules/java-classpath.xml#L5
33

44
MATCH (module:TS:Module)-[dependsOn:DEPENDS_ON]->(externalModule:TS:ExternalModule)
5-
MATCH (externalModule)-[:RESOLVES_TO]->(resolvedModule:TS:Module)
5+
MATCH (externalModule)-[:IS_IMPLEMENTED_IN]->(resolvedModule:TS:Module)
66
WHERE module <> resolvedModule
77
CALL { WITH module, dependsOn, resolvedModule
88
MERGE (module)-[resolvedDependsOn:DEPENDS_ON]->(resolvedModule)

0 commit comments

Comments
 (0)