Exporting the results
Export Results..., in the toolbar of a run, writes its values to a file that other tools can read.
Export
- Click Export Results...
- Choose the folder and type a name with its extension.
The extension decides the format: .xml writes XML and .csv writes CSV. A name without either of them gets
.csv.
The export runs in the background as Exporting metrics. If it fails, a dialog says Could not export the metrics to … with the reason, and the file you had before, if there was one with that name, is left as it was.
What the file contains
- The whole run: every category and every element, also the rows the filter of the tables hides.
- The current values only. While a comparison is shown, the export still contains the current run, not the reference and not the differences.
- No thresholds and no severities. The file has numbers, and judging them is left to whoever reads it.
- The profile and the time of the run, at the top.
A format made for programs
The export does not follow the language of the plugin or of the IDE, so that a script reads it the same on every machine:
- Metrics are identified by their abbreviation and categories by a fixed name:
Method,Class,Interface,Package,Module,FileType,Project. - Numbers are plain decimals with a point, without thousands separators.
- Metrics the tables show as a percentage are written as a fraction:
0.25, not25%. - The text is UTF-8.
The XML export also carries the name of each metric, and that name is in the language of the plugin.
Which format to choose
| CSV | XML | |
|---|---|---|
| Shape | One block per category: a header line and a line per element | One block per metric, with a line per element that has a value |
| Missing values | Written as n/a |
Left out |
| Good for | Spreadsheets, quick filters | Programs that prefer to read one metric at a time |
Both are described line by line in “File formats”.
Note. A CSV cell that begins with
=,+,-or@is written with an apostrophe in front, so that a spreadsheet does not take the name of an element for a formula.
Export or snapshot?
An export is for other tools. To compare a later run inside the plugin, save a snapshot instead (“Comparing two runs”): the plugin cannot read its own exports back.