Metrics profiles
A profile is a named list of the metrics of the plugin, each one enabled or not and with its thresholds. A calculation uses one profile: it calculates the enabled metrics and judges their values with those thresholds.
There are two kinds:
- Built-in profiles come with the plugin and are read-only. They are listed in “Built-in profiles”.
- Your profiles are the ones you create, usually as a copy of a built-in one.
Open the dialog
Choose Code | Calculate Metrics... and click Metrics Profiles... next to the profile list.
The dialog has the profile at the top, the tree of its metrics on the left and, on the right, the help of the selected metric over the editor of its thresholds.
Create a profile
- In Profile:, choose the profile you want to start from.
- Click Add and choose:
- Duplicate Current Profile, for a copy with the same metrics and thresholds, or
- Blank Profile, for a profile with every metric unchecked.
- Type the name in New Metrics Profile and accept.
The new profile is saved at once and becomes the one shown. A copy is made from the profile as it was last saved, without the changes you may have pending in the dialog.
Names
A profile is stored in a file named after it, so its name must be valid as a file name on every system:
| Message | Rule |
|---|---|
| Enter a name | The name cannot be empty |
| Enter a name without / \ : * ? " < > | | None of those characters |
| The name cannot end with a dot or a space | |
| This name is reserved by the operating system | Not a device name of Windows, such as CON or NUL |
| A profile named "…" already exists. | Names differing only in upper and lower case count as the same |
Choose the metrics
Each metric of the tree has a checkbox. To enable or disable metrics:
- click the checkbox, or double-click the metric,
- select one or several metrics and press Space,
- click the checkbox of a group to check all its metrics. If all are checked already, it unchecks them.
A group shows a checked box when all its metrics are enabled and a partly filled one when only some are.
Groups
The toolbar over the tree has Expand All, Collapse All and Group by Aspect:
- With Group by Aspect on, which is how the dialog starts, metrics are grouped by quality aspect: size,
complexity, coupling and the rest. Each metric says its category after its name, as in
Cyclomatic Complexity · method. Selecting a group shows the description of the aspect. - With it off, metrics are grouped by category: method metrics, class metrics and so on.
Filter
The field over the tree keeps only the metrics that contain every word you type, in their name, their abbreviation
or their description. It ignores upper and lower case and accents. Put several words in quotes to search for them
together: "lines of code".
You can also click the tree and start typing to jump to a metric by its name.
Help and thresholds
Selecting a metric shows its help on the right, the same text as Explain This Metric (“Help for a metric”). Under it is the editor of its thresholds, which is enabled for an enabled metric of a profile of yours (“Thresholds”).
Save or discard
- Apply saves the changes and leaves the dialog open. It is enabled when there is something to save.
- The button that accepts the dialog saves and closes.
- Cancel discards the changes made since the last save.
You can switch to another profile and edit it before saving: the changes of all of them are saved, or discarded, together.
Note. Creating and deleting a profile take effect at once. Cancel does not undo them.
If a custom threshold is not a valid number, the dialog does not save and points to it (“Thresholds”).
Delete a profile
Show the profile and click Delete. The dialog asks Delete the profile '…'? This cannot be undone., and removes its file when you accept.
Built-in profiles are read-only
With a built-in profile shown, the checkboxes and the threshold editor are disabled, and so is Delete. To change one, duplicate it and edit the copy. Its name and its help follow the language of the plugin.
The selected profile
The profile shown in this dialog is also the one selected for the next calculation: choosing a profile here is the same as choosing it in the calculation dialog. Cancel goes back to the one that was selected when you opened the dialog.
Profiles and open results
When you save a profile, the open runs that were calculated with it apply its new thresholds at once. The metrics you enable need a new calculation to get values (“The results window”).
Where profiles are stored
Each of your profiles is an XML file, <name>.xml, in the stau-metro-profiles folder of the configuration
directory of the IDE. That means:
- Your profiles belong to the IDE, not to a project. Every project you open with it sees the same ones.
- To pass a profile to someone else, give them the file to put in the same folder of their IDE. The plugin reads the folder when the IDE starts.
- Updating or removing the plugin does not touch them.
The format of the file is in “File formats”.