Open sandboxFocus

Class LinesOfCodeMetricProvider

Provides the implementation for the LinesOfCode metric.

Inheritance
LinesOfCodeMetricProvider
Namespace: Metalama.Extensions.Metrics
Assembly: Metalama.Extensions.Metrics.dll
Syntax
[MetalamaPlugIn]
public sealed class LinesOfCodeMetricProvider : MetricProvider<LinesOfCode>, IMetricProvider<LinesOfCode>, IProjectService, IService
Remarks

This provider computes lines of code directly from syntax nodes without aggregation, which correctly handles cases where multiple declarations share the same line (e.g., fields).

The implementation uses an O(1) space algorithm that tracks the maximum line number seen while iterating through tokens in document order. Multi-line tokens (such as verbatim strings or raw string literals) are correctly counted as multiple lines.

Constructors

Name Description
LinesOfCodeMetricProvider()

Methods

Name Description
Aggregate(ref LinesOfCode, in LinesOfCode)

Aggregates a new value into an aggregate value.

ComputeMetricForMember(IMember)

Computes the metric for a member.

ComputeMetricForType(INamedType)

Computes the metric for a whole type.

Extension Methods

See Also