Skip to content

SizeBudget

Namespace: Dotsider.Core.Analysis.Models

Assembly: Dotsider.Core.dll

One size budget: a scope plus at least one limit. Parsed from the spec grammar ([scope:]limit(,limit)* — for example total:max=25mb,growth=1% or ns=System.Text.Json:growth=10kb) by SizeBudgetParser, or from a budget file’s object form which can also carry a name, description, severity, and per-budget contributor count.

public sealed record SizeBudget : IEquatable<SizeBudget>

ObjectSizeBudget

SizeBudget(SizeBudgetScope, string?, long?, long?, double?, SizeBudgetSeverity, string?, string?, int?)

Section titled “SizeBudget(SizeBudgetScope, string?, long?, long?, double?, SizeBudgetSeverity, string?, string?, int?)”

One size budget: a scope plus at least one limit. Parsed from the spec grammar ([scope:]limit(,limit)* — for example total:max=25mb,growth=1% or ns=System.Text.Json:growth=10kb) by SizeBudgetParser, or from a budget file’s object form which can also carry a name, description, severity, and per-budget contributor count.

Parameters:

  • Scope (SizeBudgetScope): What the budget measures.
  • Target (String): The namespace prefix or assembly simple name, or null for Total.
  • MaxBytes (Nullable<Int64>): The absolute cap on the current value in bytes, or null when not limited.
  • MaxGrowthBytes (Nullable<Int64>): The cap on growth versus the baseline in bytes, or null when not limited.
  • MaxGrowthPercent (Nullable<Double>): The cap on growth versus the baseline as a percentage, or null when not limited.
  • Severity (SizeBudgetSeverity): Whether a breach fails the check or only warns.
  • Name (String): A stable display name for reports, or null to render the spec itself.
  • Description (String): An explanation shown alongside a breach, or null.
  • TopN (Nullable<Int32>): A per-budget override for how many contributors a breach lists, or null for the caller’s default.
public SizeBudget(SizeBudgetScope Scope, string? Target, long? MaxBytes, long? MaxGrowthBytes, double? MaxGrowthPercent, SizeBudgetSeverity Severity = SizeBudgetSeverity.Error, string? Name = null, string? Description = null, int? TopN = null)

An explanation shown alongside a breach, or null.

Returns: String

public string? Description { get; init; }

The absolute cap on the current value in bytes, or null when not limited.

Returns: Nullable<Int64>

public long? MaxBytes { get; init; }

The cap on growth versus the baseline in bytes, or null when not limited.

Returns: Nullable<Int64>

public long? MaxGrowthBytes { get; init; }

The cap on growth versus the baseline as a percentage, or null when not limited.

Returns: Nullable<Double>

public double? MaxGrowthPercent { get; init; }

A stable display name for reports, or null to render the spec itself.

Returns: String

public string? Name { get; init; }

What the budget measures.

Returns: SizeBudgetScope

public SizeBudgetScope Scope { get; init; }

Whether a breach fails the check or only warns.

Returns: SizeBudgetSeverity

public SizeBudgetSeverity Severity { get; init; }

The namespace prefix or assembly simple name, or null for Total.

Returns: String

public string? Target { get; init; }

A per-budget override for how many contributors a breach lists, or null for the caller’s default.

Returns: Nullable<Int32>

public int? TopN { get; init; }

Deconstruct(out SizeBudgetScope, out string?, out long?, out long?, out double?, out SizeBudgetSeverity, out string?, out string?, out int?)

Section titled “Deconstruct(out SizeBudgetScope, out string?, out long?, out long?, out double?, out SizeBudgetSeverity, out string?, out string?, out int?)”

Parameters:

public void Deconstruct(out SizeBudgetScope Scope, out string? Target, out long? MaxBytes, out long? MaxGrowthBytes, out double? MaxGrowthPercent, out SizeBudgetSeverity Severity, out string? Name, out string? Description, out int? TopN)

Parameters:

Returns: Boolean

public override bool Equals(object? obj)

Parameters:

Returns: Boolean

public bool Equals(SizeBudget? other)

Returns: Int32

public override int GetHashCode()

Renders the budget back into spec-grammar form, for display when it has no Name.

Returns: String

The spec string.

public override string ToString()

Parameters:

Returns: Boolean

public static bool operator !=(SizeBudget? left, SizeBudget? right)

Parameters:

Returns: Boolean

public static bool operator ==(SizeBudget? left, SizeBudget? right)