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

  1. Generate a .dc.json file from your project using DependaCharta

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

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

    ccsh edgefilter dependencies.cc.json -o visual_dependencies.cc.json
    
  4. Merge the dependency data with your project metrics using the MergeFilter

    ccsh merge visual_dependencies.cc.json metrics.cc.json -o merged.cc.json
    
  5. Visualize merged.cc.json with 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"
    }
  }
}

Updated: