All rules

Guard Deletion Remote Use

Detects removed null or validation guards where the guarded symbol is still used later in the same method.

Why this rule exists

Deleting a guard while retaining downstream use reintroduces NullReferenceException or invalid-state paths that tests may not exercise.

Code example

Triggers the rule
- if (order is null) throw new ArgumentNullException(nameof(order));
  return order.Total;
Passes the rule
- if (order is null) throw new ArgumentNullException(nameof(order));
+ if (order is null) return 0;
  return order.Total;

Configuration

Disable or adjust the severity of this rule in .gauntletci.json:

{
  "rules": {
    "GCI0059": { "enabled": true, "severity": "Block" }
  }
}

See Configuration for the full schema.

Related rules

Implemented in src/GauntletCI.Core/Rules/Implementations/GCI0059_*.cs.

About the author

Eric Cogen -- Founder, GauntletCI

Twenty years as a senior technical consultant building and modernizing enterprise platforms across .NET, AWS, serverless, microservices, and AI-driven systems.