Website Rendering: Add configurable output caching for template rendered pages#22338
CodeScene PR Check
Quality Gate Failed
Gates Failed
Enforce critical code health rules
(2 files with Bumpy Road Ahead)
Enforce advisory code health rules
(5 files with Large Method, Complex Method, Code Duplication, Excess Number of Function Arguments)
Gates Passed
2 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Enforce critical code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| WebsiteOutputCachePolicy.cs | 1 critical rule | 9.39 | Suppress |
| WebsiteOutputCacheEvictionHandler.cs | 1 critical rule | 9.84 | Suppress |
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| WebsiteOutputCachePolicyTests.cs | 2 advisory rules | 9.10 | Suppress |
| WebsiteOutputCacheEvictionHandlerTests.cs | 1 advisory rule | 9.39 | Suppress |
| RelationOutputCacheEvictionProviderTests.cs | 1 advisory rule | 9.39 | Suppress |
| WebsiteOutputCachePolicy.cs | 1 advisory rule | 9.39 | Suppress |
| UmbracoBuilder.Configuration.cs | 1 advisory rule | 9.61 → 9.60 | Suppress |
Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
Details
🚩 Declining Code Health (highest to lowest):
- Code Duplication RelationOutputCacheEvictionProviderTests.cs
- Code Duplication WebsiteOutputCacheEvictionHandlerTests.cs
- Code Duplication WebsiteOutputCachePolicyTests.cs
- Complex Method WebsiteOutputCachePolicy.cs: IOutputCachePolicy.CacheRequestAsync
- Large Method UmbracoBuilder.Configuration.cs: AddConfiguration
- Excess Number of Function Arguments WebsiteOutputCachePolicyTests.cs: CreateOutputCacheContext
- Bumpy Road Ahead WebsiteOutputCacheEvictionHandler.cs: EvictForPayloadAsync
- Bumpy Road Ahead WebsiteOutputCachePolicy.cs: IOutputCachePolicy.CacheRequestAsync
Annotations
Check warning on line 106 in src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Configuration.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ Getting worse: Large Method
AddConfiguration increases from 70 to 71 lines of code, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.
Check warning on line 103 in src/Umbraco.Web.Website/Caching/WebsiteOutputCacheEvictionHandler.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Bumpy Road Ahead
EvictForPayloadAsync has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is 2 blocks per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.
Check warning on line 137 in src/Umbraco.Web.Website/Caching/WebsiteOutputCachePolicy.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Complex Method
IOutputCachePolicy.CacheRequestAsync has a cyclomatic complexity of 14, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
Check warning on line 137 in src/Umbraco.Web.Website/Caching/WebsiteOutputCachePolicy.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Bumpy Road Ahead
IOutputCachePolicy.CacheRequestAsync has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is 2 blocks per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Code Duplication
The module contains 6 functions with similar structure: HandleAsync_MultiplePayloads_EvictsAll,HandleAsync_RefreshAll_EvictsAllTag,HandleAsync_RefreshBranch_EvictsContentKeyAndAncestorTag,HandleAsync_RefreshNode_EvictsContentKey and 2 more functions. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Code Duplication
The module contains 3 functions with similar structure: CacheRequestAsync_FallsBackToConfigDuration_WhenProviderReturnsNull,CacheRequestAsync_UsesDurationProvider_WhenNonNull,CacheRequestAsync_WhenDurationProviderReturnsZero_DoesNotCache. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Excess Number of Function Arguments
CreateOutputCacheContext has 6 arguments, max arguments = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Code Duplication
The module contains 2 functions with similar structure: GetAdditionalEvictionTagsAsync_WhenDocumentRelationExists_ReturnsParentTag,GetAdditionalEvictionTagsAsync_WhenMediaRelationExists_ReturnsEmpty. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.