Description
The build reports 6 Cognitive Complexity violations from analyzers:
| Method |
Complexity |
Allowed |
File |
PatchForResolutionContextTracking |
20 |
15 |
DetectIncorrectUsageOfTransientDisposables.cs |
PatchForDetectIncorrectUsageOfTransientDisposables |
27 |
15 |
DetectIncorrectUsageOfTransientDisposables.cs |
CreatePatchedDescriptor |
16 |
15 |
DetectIncorrectUsageOfTransientDisposables.cs |
DependsOnResolutionFunc |
16 |
15 |
ServiceCollectionExtensions.KeyedService.cs |
KeyedDependsOnResolutionFunc |
16 |
15 |
ServiceCollectionExtensions.KeyedService.cs |
CreateServiceProvider |
18 |
15 |
ServiceProviderFactory.cs |
Suggested Approach
- Extract keyed vs non-keyed handling into separate helper methods in patching code
- Extract common parameter resolution logic from
DependsOnResolutionFunc/KeyedDependsOnResolutionFunc
- Extract open-generic logging into a helper in
CreateServiceProvider
Description
The build reports 6 Cognitive Complexity violations from analyzers:
PatchForResolutionContextTrackingPatchForDetectIncorrectUsageOfTransientDisposablesCreatePatchedDescriptorDependsOnResolutionFuncKeyedDependsOnResolutionFuncCreateServiceProviderSuggested Approach
DependsOnResolutionFunc/KeyedDependsOnResolutionFuncCreateServiceProvider