CSV Exporter
The CSV exporter writes the metrics of a cc.json map as a CSV table: one row per file, one column per metric. Use it to sort and filter metrics in a spreadsheet, to compare runs with your own scripts or to hand numbers to a tool that does not read cc.json.
Quick start
Section titled “Quick start”ccsh csvexport project.cc.json.gz -o project.csvLeave out -o to print the CSV to the console.
Options
Section titled “Options”| Option | Description |
|---|---|
FILE or FOLDER... | one or more cc.json files, or folders that contain them |
--depth-of-hierarchy=<maxHierarchy> | number of dir columns that split up the path (default 10, at least 0) |
-o, --output-file=<outputFile> | output file; .csv is added when missing; prints to stdout when omitted |
-h, --help | show the help and exit |
Usage: ccsh csvexport [-h] [--depth-of-hierarchy=<maxHierarchy>] [-o=<outputFile>] FILE or FOLDER...Output
Section titled “Output”- Every node that carries at least one metric gets one row.
pathholds the path of the node below the root, with/between folders,nameits name andtypewhether it is aFileor aFolder.- One column per metric follows. A node without a value for a metric leaves that cell empty.
dir0,dir1, and so on hold the folders of the path one by one, so you can group rows by folder in a spreadsheet.--depth-of-hierarchysets how many of these columns there are. A negative value is rejected.
path,name,type,rloc,mcc,coverage,dir0,dir1README.md,README.md,File,3.0,,,,src/a.ts,a.ts,File,10.0,2.0,80.0,src,src/lib/b.ts,b.ts,File,20.0,5.0,,src,libThe example above comes from --depth-of-hierarchy=2.
Several inputs
Section titled “Several inputs”With several files, or a folder, each map is written one after another into the same CSV file, every map with its own
header line. Pass -o for several inputs: printed to the console, only the first map appears.
Related
Section titled “Related”- CSV Importer: the way back, from CSV to cc.json
- Inspection Tool: look at the folder structure of a map in the console