Skip to content

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.

MetricDescription
dependenciesNumber of code-level dependency links between two files
ParameterDescription
FILEDependaCharta .dc.json file
-h, --helpdisplays help
-o, --output-file=<outputFile>output File (or empty for stdout)
-nc, --not-compressedsave uncompressed output file
Usage: ccsh dependachartaimport [-h] [-nc] [-o=<outputFile>] FILE
  1. Generate a .dc.json file from your project using DependaCharta

  2. Convert the .dc.json file to cc.json format

    Terminal window
    ccsh dependachartaimport project.dc.json -o dependencies.cc.json
  3. Optionally aggregate edge attributes into nodes with EdgeFilter

    Terminal window
    ccsh edgefilter dependencies.cc.json -o visual_dependencies.cc.json
  4. 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
  5. Visualize merged.cc.json with the Visualization

$ 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"
}
}
}