Migrations: Run unattended upgrades in background, add liveness/readiness health probes (closes #21987) - #22020
CodeScene PR Check
Quality Gate Failed
Gates Failed
Enforce critical code health rules
(1 file with Bumpy Road Ahead)
Enforce advisory code health rules
(6 files with Large Method, Complex Method, Code Duplication)
Gates Passed
2 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Enforce critical code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| UnattendedUpgradeBackgroundService.cs | 1 critical rule | 9.54 | Suppress |
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| UnattendedUpgradeBackgroundServiceTests.cs | 1 advisory rule | 9.39 | Suppress |
| MaintenanceModeActionFilterAttributeTests.cs | 1 advisory rule | 9.39 | Suppress |
| UnattendedUpgradeBackgroundService.cs | 1 advisory rule | 9.54 | Suppress |
| CoreRuntime.cs | 1 advisory rule | 9.17 → 9.14 | Suppress |
| UmbracoBuilder.CoreServices.cs | 1 advisory rule | 8.79 → 8.78 | Suppress |
| RuntimeState.cs | 1 advisory rule | 8.52 → 8.52 | 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):
- Large Method UmbracoBuilder.CoreServices.cs: AddCoreInitialServices
- Code Duplication UnattendedUpgradeBackgroundServiceTests.cs
- Code Duplication MaintenanceModeActionFilterAttributeTests.cs
- Complex Method RuntimeState.cs: DetermineRuntimeLevel
- Complex Method CoreRuntime.cs: StartAsync
- Complex Method UnattendedUpgradeBackgroundService.cs: RunMigrationsAsync
- Bumpy Road Ahead UnattendedUpgradeBackgroundService.cs: RunMigrationsAsync
Annotations
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ Getting worse: Large Method
AddCoreInitialServices increases from 123 to 124 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.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Complex Method
RunMigrationsAsync has a cyclomatic complexity of 11, 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.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Bumpy Road Ahead
RunMigrationsAsync 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 146 in src/Umbraco.Infrastructure/Runtime/CoreRuntime.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ Getting worse: Complex Method
StartAsync increases in cyclomatic complexity from 14 to 15, 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 255 in src/Umbraco.Infrastructure/Runtime/RuntimeState.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ Getting worse: Complex Method
DetermineRuntimeLevel already has high cyclomatic complexity, and now it increases in Lines of Code from 88 to 89. 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.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Code Duplication
The module contains 2 functions with similar structure: ExecuteAsync_WhenPremigrationsHasErrorsAndBootFailedExceptionExists_SetsBootFailed,ExecuteAsync_WhenUnattendedUpgradeHasErrorsAndBootFailedExceptionExists_SetsBootFailed. 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 2 functions with similar structure: OnActionExecuting_MvcController_WhenUpgradeAndMaintenanceEnabled_SetsMaintenanceResult,OnActionExecuting_MvcController_WhenUpgradingAndMaintenanceEnabled_SetsMaintenanceResultWithUpgradingViewPath. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.