dartrics library
Programmatic entry for embedding dartrics — the function-level metric calculators only.
lib/main.dart is the analyzer-plugin entrypoint; consumers of the
plugin do not need anything from this library.
Class- and library-level metrics, the report / regression / coverage
/ dismissal / unused-detector model shapes, and MetricEngine itself
are intentionally not exported. The supported integration point
for those scopes is dartrics analyze --reporter json, parsed in
your own pipeline. This keeps the public Dart API tight enough that
internal evolution doesn't trigger breaking changes for consumers we
don't yet have. If you need a Dart-level handle on a shape that
isn't exported here, please file an issue describing the use case
before reaching into package:dartrics/src/.
Classes
- CognitiveComplexity
- Cognitive Complexity (G. Ann Campbell, SonarSource 2017, rev.).
- CyclomaticComplexity
-
Cyclomatic Complexity (McCabe, 1976) —
1 + dwheredis the number of linearly independent decision points in the control-flow graph. - FunctionMetric
- Function/method-level metric.
- FunctionMetricInput
- Bundle of inputs every function-level metric receives.
- HalsteadCounts
- Counts of Halstead operators and operands within a single function body.
- HalsteadVolume
-
Halstead Volume —
N · log2(η). (Halstead, 1977.) - MethodLength
- Method Length (LOC) — total number of source lines spanned by the function body, including blank lines and comments.
- NumberOfParameters
- Number of positional formal parameters declared by the function.
- SourceLinesOfCode
-
Source Lines of Code — non-blank, non-comment-only lines inside the
function body. Lines that are entirely a
//comment, entirely inside a/* … */block, or whitespace are excluded; lines with code followed by a trailing comment count once.
Enums
- MetricPolarity
-
Direction in which a metric value moves when the underlying code
gets healthier. Used by
dartrics regressionto classify before / after diffs asimproved/regressed/unchanged.
Constants
- dartricsVersion → const String
-
Build-time version string. Kept in sync with
pubspec.yaml'sversion:field by hand; bump both files together.