File formats
Stau Metro writes four kinds of file. All are text in UTF-8.
| File | Written by | Read back by the plugin |
|---|---|---|
| “CSV export” | Export Results... | No |
| “XML export” | Export Results... | No |
“Snapshot”, .met |
Save Snapshot... | Yes, by Compare with Snapshot... |
“Profile”, .xml |
Metrics Profiles... and Edit Thresholds... | Yes, when the IDE starts |
Every file is written to a temporary file first and then put in place, so a write that fails leaves the previous file as it was.
- Categories have a fixed name in every language:
Method,Class,Interface,Package,Module,FileType,Project. They always come in that order. - Elements are identified by the name of their row (“What is analyzed”).
A file type is identified by its name in the IDE, such as
JAVA, and the project byproject. - The time of the run is written in English with its offset and time zone:
Sat, 28 Nov 2026 10:15:02 +01:00 [Europe/Madrid]. - Values are plain numbers with a decimal point. A metric the interface shows as a percentage is written as a
fraction:
0.25for 25%.
CSV export
Complexity metrics,"Sat, 28 Nov 2026 10:15:02 +01:00 [Europe/Madrid]"
Method,CogC,v(G)
com.acme.core.Box.get(),0,1
"com.acme.core.Box.put(String, Object)",7,5
Class,OCavg,WMC
com.acme.core.Box,3,6
- The first line has the name of the profile and the time of the run.
- One block per category that has values: a header with the name of the category and the abbreviation of each metric, one line per element and an empty line.
- A missing value is written as
n/a. - Counts are written without decimals and the other values with the decimals they need.
- Quoting: a field with a comma, a quotation mark or a line break goes between quotation marks, and the quotation marks inside it are doubled. The names of methods with more than one parameter contain commas, so they are always quoted.
- Formulas: a field that starts with
=,+,-,@, a tab or a carriage return gets an apostrophe in front, so that a spreadsheet does not run it as a formula.
XML export
<METRICS profile="Complexity metrics" timestamp="Sat, 28 Nov 2026 10:15:02 +01:00 [Europe/Madrid]">
<METRIC category="Method" name="Cyclomatic Complexity" abbreviation="v(G)">
<VALUE measured="com.acme.core.Box.get()" value="1.0"/>
<VALUE measured="com.acme.core.Box.put(String, Object)" value="5.0"/>
</METRIC>
</METRICS>
| Element | Attributes |
|---|---|
METRICS |
profile, the name of the profile; timestamp, the time of the run |
METRIC |
category; name, the name of the metric in the language of the plugin; abbreviation |
VALUE |
measured, the element; value, the number |
There is one METRIC per metric with values and one VALUE per element that has a value: missing values are left
out. Every number has a decimal part, also the counts. To identify a metric, use category and abbreviation,
which do not change with the language.
Snapshot
A snapshot is an XML file with the .met extension.
<?xml version='1.0' encoding='UTF-8'?>
<SNAPSHOT profile="Complexity metrics" timestamp="Sat, 28 Nov 2026 10:15:02 +01:00 [Europe/Madrid]"
version="0.1.0-262" project="shop" scope="Project 'shop'">
<METRIC metric_id="method.cc">
<VALUE measured="com.acme.core.Box.get()" numerator="1.0" denominator="1.0"/>
</METRIC>
</SNAPSHOT>
| Element | Attributes |
|---|---|
SNAPSHOT |
profile; timestamp; version, the version of the plugin that wrote it; project and scope, what was measured |
METRIC |
metric_id, the internal identifier of the metric |
VALUE |
measured, the element; numerator and denominator, whose quotient is the value |
The value is kept as two numbers so that averages and percentages can be combined again exactly: a percentage keeps its two parts, and a plain value has a denominator of 1.
The snapshot is meant for the plugin, not for other tools: use an export for those. What a snapshot does not have is as relevant as what it has:
- It has no thresholds. A comparison judges the snapshot with the thresholds of the profile in use.
- It identifies metrics by an identifier that is stable between versions. When the plugin reads a snapshot it skips the metrics it does not know.
projectandscopeare used to warn you when you compare results of different origin.
Profile
Each profile of yours is a file <name>.xml in the stau-metro-profiles folder of the configuration directory of
the IDE.
<METRICS_PROFILE name="Team rules">
<METRIC metricId="method.cc" enabled="true" warnAbove="12.0" errorAbove="25.0" />
<METRIC metricId="method.cognitive-complexity" enabled="true" />
<METRIC metricId="class.cbo" enabled="false" errorAbove="off" />
</METRICS_PROFILE>
Attribute of METRIC |
Meaning |
|---|---|
metricId |
The internal identifier of the metric |
enabled |
true when the metric is checked |
warnAbove, errorAbove, warnBelow, errorBelow |
A custom limit, as a number, or off. Without the attribute, the limit is the reference |
The file lists every metric of the plugin, enabled or not. A custom limit of a metric shown as a percentage is
written as a percentage, as you type it: 80.0 for 80%.
It is safer to edit profiles in the dialog than by hand. If you do edit a file:
- Keep the name of the file equal to the
nameof the profile. - Restart the IDE to load it.
- A limit that is not a number goes back to the reference, and a file that is not a profile is ignored. The log of the IDE says which.
Entries of metrics the installed version does not know are kept in the file, so that a profile survives going back and forth between versions.