Skip to content

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.

MetricKindDescription
dependenciesedgeNumber of code-level dependency links between two files
outgoing_dependenciesfileNumber of code-level dependency links from this file to other files
incoming_dependenciesfileNumber of code-level dependency links from other files to this file
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

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