The measurement scale of a metric’s value: which arithmetic on it
means anything (issue #1621).
Stevens’ classification of measurement scales (On the Theory of
Scales of Measurement, Science 103, 1946) is the reason this is a
separate axis from Direction. On a ratio scale zero means
“none of it”, so value / limit and “N percent worse” are
meaningful: 30 branches is twice 15. On an interval scale the
zero is arbitrary, so only differences are meaningful: a
Maintainability Index of -10 is not “twice as bad” as -5, and a drop
from 0.001 to -0.0097 is a hundredth of a point, not a 1069 % fall.
Every surface that ranks, scales or reports a change reads this
instead of assuming ratio arithmetic; Threshold is where that
arithmetic lives.
#[non_exhaustive], as is the Interval variant, so a scale or a
field can be added in a minor release. Match with a wildcard arm and
Interval { unit, .. }.
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
True zero, values >= 0: every count and count-derived metric
(cyclomatic, halstead.*, loc.*, …). Severity is the plain
value / limit ratio and a change is a percentage.
Arbitrary zero: the Maintainability Index family. Only
differences are meaningful, so severity and change are measured
in multiples of unit.
Fields
This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
One step of badness, in the metric’s own points: the
distance that plays the role a Ratio metric’s limit plays
in severity, soft-tier scaling and drift. Always finite and
positive.