Skip to content

Metrics in the editor

Updated on 5 December 2026

While you write, Stau Metro measures the code you have open without starting a calculation or opening the results window. It does so in two ways:

  • Hints above each method, class and interface, with a few metrics and the threshold each value goes beyond.
  • An inspection, Stau Metro: threshold exceeded, that reports the values beyond a threshold in the editor, in the Problems tool window and in Code | Inspect Code.

Both work in Java files, and in Kotlin files for the JVM when the Kotlin plugin is enabled. They give exactly the values a calculation would give, but only for the metrics that can be computed from the code of the element itself (“Which metrics are computed here”).

The hints

Each hint goes above the first line of the declaration, under its doc comment and with its indentation. It shows the values in the language of the plugin and, when one goes beyond a threshold, which one and of which level:

  • Above a method: v(G) 12 > warning 10 · CogC 8.
  • Above a class: WMC 34.

Rest the mouse on a hint to read it with the full names of the metrics and the profile the thresholds come from:

Stau Metro, thresholds of the profile 'Quick health check': Cyclomatic Complexity 12, beyond the warning threshold > 10 · Cognitive Complexity 8

Choose which metrics show

The hints are set up in Settings | Editor | Inlay Hints | Other, under Java and under Kotlin, with the name Stau Metro metrics. Uncheck it to remove them. Its options, in the order they appear in each hint:

Option Shows Default
Cyclomatic complexity of methods v(G) of each method On
Cognitive complexity of methods CogC of each method On
Nested block depth of methods NBD of each method Off
Source lines of methods NCLOC of each method Off
Weighted method complexity of classes WMC of each class On
Source lines of classes and interfaces NCLOC of each class and interface Off
Only values beyond a threshold A hint only above the elements with some value beyond a threshold, and only with those values Off

That settings page belongs to the IDE, so it shows these names in the language of the IDE. The hints, instead, follow the language of the plugin.

The thresholds of the hints

The hints judge the values with the thresholds of the last used profile: the one selected in Code | Calculate Metrics..., which the first time is Quick health check. The profile only gives the thresholds: the metrics shown are the ones you turn on in the hint settings, whether the profile enables them or not.

When you choose another profile in the calculation dialog, change its thresholds or change the language of the plugin, the hints of the open files are updated at once.

The inspection

Stau Metro: threshold exceeded reports each value beyond a threshold of a profile, on the name of its method, class or interface:

Cyclomatic Complexity is 23: beyond the error threshold (> 20)

It is on by default, with the severity of a warning, in Settings | Editor | Inspections, in the Stau Metro group. As any inspection, its problems are highlighted in the editor, in the Problems tool window and in the results of Code | Inspect Code, and you can change its severity or turn it off on that page. There its name shows in the language of the IDE; its messages, in that of the plugin.

It checks the metrics that the profile enables and that have a threshold in it, among those computed in the editor. Its options are on the same page:

Option What it does
Thresholds of the profile: The profile whose metrics and thresholds are checked. By default, Last used (in Calculate Metrics). You can choose any built-in profile or one of yours; the project ones carry (project)
Only error thresholds Leaves out the values that only go beyond a warning threshold

For the inspection to use the profile the team shares, choose a project profile in Thresholds of the profile: (“Metrics profiles”).

Suppress a problem

A problem is suppressed as one of any other inspection: with the Alt+Enter menu on it, or by hand, @SuppressWarnings("StauMetroThreshold") in Java and @Suppress("StauMetroThreshold") in Kotlin.

Which metrics are computed here

The editor computes only the metrics whose value comes from the code of the element itself, which are cheap enough to compute while you write: complexity, nesting, size, comments and documentation, statements, Halstead and the like.

Those that need the rest of the project stay with Calculate Metrics...:

  • the calls and the methods that override or implement one,
  • the inheritance tree: depth, children, inherited and overridden operations,
  • the test metrics, which judge a class by its superclasses,
  • coupling and dependencies,
  • every package, module, file type and project metric.

The row that gathers the top-level functions and properties of a Kotlin file, such as p.UtilsKt (“What is analyzed”), has no hint and no problems: it has no declaration to put them on.

The values are computed once per version of the file: editing it computes them again, and editing another one does not.