DependaCharta Importer
Category: Importer (takes in a .dc.json file generated by DependaCharta and outputs cc.json)
The DependaChartaImporter generates visualization data from DependaCharta .dc.json files. DependaCharta analyzes code-level dependencies between classes, functions, and other code entities and records them with their physical file paths. The importer aggregates these entity-level dependencies into file-level edges so they can be visualized in CodeCharta. Note that the metrics generated here are edge metrics.
Supported (Edge) Metrics
| Metric | Description |
|---|---|
dependencies |
Number of code-level dependency links between two files |
Usage and Parameters
| Parameter | Description |
|---|---|
FILE |
DependaCharta .dc.json file |
-h, --help |
displays help |
-o, --output-file=<outputFile> |
output File (or empty for stdout) |
-nc, --not-compressed |
save uncompressed output file |
Usage: ccsh dependachartaimport [-h] [-nc] [-o=<outputFile>] FILE
Example
-
Generate a
.dc.jsonfile from your project using DependaCharta -
Convert the
.dc.jsonfile to cc.json formatccsh dependachartaimport project.dc.json -o dependencies.cc.json -
Optionally aggregate edge attributes into nodes with EdgeFilter
ccsh edgefilter dependencies.cc.json -o visual_dependencies.cc.json -
Merge the dependency data with your project metrics using the MergeFilter
ccsh merge visual_dependencies.cc.json metrics.cc.json -o merged.cc.json -
Visualize
merged.cc.jsonwith the Visualization
Example File Content
$ cat project.dc.json
{
"projectTreeRoots": [],
"leaves": {
"a.ClassA": {
"id": "a.ClassA",
"name": "ClassA",
"physicalPath": "src/FileA.ts",
"nodeType": "CLASS",
"language": "TypeScript",
"dependencies": {
"b.ClassB": {
"isCyclic": false,
"weight": 1,
"type": "usage",
"isPointingUpwards": false
}
}
},
"b.ClassB": {
"id": "b.ClassB",
"name": "ClassB",
"physicalPath": "src/FileB.ts",
"nodeType": "CLASS",
"language": "TypeScript",
"dependencies": {}
}
}
}
$ cat dependencies.cc.json
{
"projectName": "",
"apiVersion": "1.5",
"nodes": [
{
"name": "root",
"type": "Folder",
"attributes": {},
"children": []
}
],
"edges": [
{
"fromNodeName": "/root/src/FileA.ts",
"toNodeName": "/root/src/FileB.ts",
"attributes": {
"dependencies": 1
}
}
],
"attributeTypes": {
"edges": {
"dependencies": "absolute"
}
}
}