DependaCharta Importer
Category: Importer (takes in a .dc.json file generated by DependaCharta and outputs cc.json)
Deprecated. Use the Dependency Parser instead: it runs DependaCharta’s analysis on the source itself and keeps the declaration kinds, levels, cycles and upward flags this importer flattens away. The command still works and says so on every run; it will be removed. DependaCharta itself names its output
.cg.json, so the shell’s parser suggestions, which look for.dc.json, do not offer this importer for it.
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. Besides the edge metric it writes two metrics per file that count those edges.
Supported Metrics
Section titled “Supported Metrics”| Metric | Kind | Description |
|---|---|---|
dependencies | edge | Number of code-level dependency links between two files |
outgoing_dependencies | file | Number of code-level dependency links from this file to other files |
incoming_dependencies | file | Number of code-level dependency links from other files to this file |
Usage and Parameters
Section titled “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>] FILEExample
Section titled “Example”-
Generate a
.dc.jsonfile from your project using DependaCharta -
Convert the
.dc.jsonfile to cc.json formatTerminal window ccsh dependachartaimport project.dc.json -o dependencies.cc.json -
Optionally aggregate edge attributes into nodes with EdgeFilter
Terminal window ccsh edgefilter dependencies.cc.json -o visual_dependencies.cc.json -
Merge the dependency data with your project metrics using the MergeFilter
Terminal window ccsh merge visual_dependencies.cc.json metrics.cc.json -o merged.cc.json -
Visualize
merged.cc.jsonwith the Visualization
Example File Content
Section titled “Example File Content”The cc.json file is formatted for readability and its attributeDescriptors are left out.
$ 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{ "meta": { "projectName": "", "apiVersion": "2.1", "checksum": "9b6ea0bb0bda479efea6e86c4c1c75af" }, "files": [ { "id": "164ddff4bb1345e1", "name": "root", "type": "Folder", "children": [ { "id": "fabeab231626f275", "name": "src", "type": "Folder", "children": [ { "id": "6720aa93a5d244cb", "name": "FileA.ts", "type": "File", "link": "" }, { "id": "e6e235c8e4a029fb", "name": "FileB.ts", "type": "File", "link": "" } ], "link": "" } ], "link": "" } ], "lenses": { "metrics": { "attributes": { "6720aa93a5d244cb": { "outgoing_dependencies": 1, "incoming_dependencies": 0 }, "e6e235c8e4a029fb": { "outgoing_dependencies": 0, "incoming_dependencies": 1 } }, "attributeTypes": { "outgoing_dependencies": "absolute", "incoming_dependencies": "absolute" } }, "dependency": { "edges": [ { "fromId": "6720aa93a5d244cb", "toId": "e6e235c8e4a029fb", "attributes": { "dependencies": 1 } } ], "attributeTypes": { "dependencies": "absolute" } } }}