Pattern Consistency Deviation
Detects mixed sync/async naming conventions and service locator anti-patterns introduced inconsistently within the same file.
Why this rule exists
Inconsistency confuses callers. A class with both GetUser and GetOrderAsync forces every caller to remember which is which, and the wrong choice can deadlock.
Code example
+ public Task<User> GetUser(int id) => ...;
+ public Task<Order> GetOrderAsync(int id) => ...;+ public Task<User> GetUserAsync(int id) => ...;
+ public Task<Order> GetOrderAsync(int id) => ...;Configuration
Disable or adjust the severity of this rule in .gauntletci.json:
{
"rules": {
"GCI0046": { "enabled": true, "severity": "Info" }
}
}See Configuration for the full schema.
Related rules
Concurrency and State Risk
Detects async void methods, blocking async calls (.Result, .Wait(), .GetAwaiter().GetResult()), lock(this), and Thread.Sleep in production code. Uses ForPatternScan to ignore matches inside // comments and string literals.
Dependency Injection Safety
Detects DI anti-patterns: service locator usage, direct instantiation of injectable types, and captive dependency violations.
Naming and Contract Alignment
Detects method renames where the new CRUD verb semantically contradicts the old verb, signaling an intent mismatch.
Discussed in
Why Code Review Misses Bugs
Code review catches style and obvious logic errors. It routinely misses behavioral drift, contract changes, and implicit assumptions.
Beyond SonarQube: A Behavioral Alternative to Code Smell Detection
Why linter rules and code smells miss behavioral regressions. A case for deterministic behavioral analysis as a gating criterion instead of counting violations.
Automated Code Review Tools for GitHub Pull Requests
How GitHub teams should choose automated code review tools for PR comments, required checks, Actions workflows, and deterministic merge protection.
CodeRabbit Alternative: Deterministic Pull Request Risk Analysis
A buyer-focused comparison for teams evaluating AI pull request reviewers and deterministic PR risk analysis before merge.
Implemented in src/GauntletCI.Core/Rules/Implementations/GCI0046_*.cs.
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.
