Routing: Add DocumentUrlAliasService for optimized URL alias lookups (closes #21383) - #21396
CodeScene PR Check
Quality Gate Failed
Gates Failed
New code is healthy
(1 new file with code health below 8.00)
Enforce critical code health rules
(2 files with Bumpy Road Ahead, Deep, Nested Complexity, Low Cohesion)
Enforce advisory code health rules
(7 files with Large Method, Complex Method, Constructor Over-Injection, Primitive Obsession, Complex Conditional, Code Duplication, Large Assertion Blocks)
Gates Passed
1 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| New code is healthy | Violations | Code Health Impact | |
|---|---|---|---|
| DocumentUrlAliasServiceTests.cs | 3 rules | 7.55 | Suppress |
| Enforce critical code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| DocumentUrlAliasServiceTests.cs | 1 critical rule | 7.55 | Suppress |
| DocumentUrlAliasService.cs | 2 critical rules | 8.03 | Suppress |
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| DocumentUrlAliasServiceTests.cs | 2 advisory rules | 7.55 | Suppress |
| DocumentUrlAliasService.cs | 4 advisory rules | 8.03 | Suppress |
| ContentFinderByUrlAlias.cs | 2 advisory rules | 9.84 → 9.39 | Suppress |
| UmbracoBuilder.Repositories.cs | 1 advisory rule | 10.00 → 9.61 | Suppress |
| UmbracoBuilder.cs | 1 advisory rule | 8.59 → 8.58 | Suppress |
| UmbracoPlan.cs | 1 advisory rule | 9.60 → 9.60 | Suppress |
| ContentFinderByUrlAliasTests.cs | 1 advisory rule | no change | Suppress |
Quality Gate Profile: Clean Code Collective
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.
Details
🚩 Declining Code Health (highest to lowest):
- Low Cohesion DocumentUrlAliasServiceTests.cs
- Large Method UmbracoBuilder.cs: AddCoreServices
- Large Assertion Blocks DocumentUrlAliasServiceTests.cs
- Code Duplication DocumentUrlAliasServiceTests.cs
- Large Method UmbracoPlan.cs: UmbracoPlan
- Large Method UmbracoBuilder.Repositories.cs: AddRepositories
- Complex Method ContentFinderByUrlAlias.cs: FindContentByAlias
- Constructor Over-Injection ContentFinderByUrlAlias.cs: ContentFinderByUrlAlias
- Complex Method DocumentUrlAliasService.cs: ExtractAliasesFromDocumentAsync
- Complex Conditional DocumentUrlAliasService.cs: CreateOrUpdateAliasesInternalAsync
- Deep, Nested Complexity DocumentUrlAliasService.cs: RebuildAllAliasesAsync
- Deep, Nested Complexity DocumentUrlAliasService.cs: ExtractAliasesFromDocumentAsync
- Primitive Obsession DocumentUrlAliasService.cs
- Constructor Over-Injection DocumentUrlAliasService.cs: DocumentUrlAliasService
- Primitive Obsession ContentFinderByUrlAliasTests.cs
- Bumpy Road Ahead DocumentUrlAliasService.cs: RebuildAllAliasesAsync
- Bumpy Road Ahead DocumentUrlAliasService.cs: ExtractAliasesFromDocumentAsync
✅ Improving Code Health:
- Overall Code Complexity ContentCacheRefresher.cs
- Bumpy Road Ahead ContentFinderByUrlAlias.cs: FindContentByAlias
- Excess Number of Function Arguments ContentFinderByUrlAliasTests.cs: Lookup_By_Url_Alias
Annotations
Check notice on line 1 in src/Umbraco.Core/Cache/Refreshers/Implement/ContentCacheRefresher.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ Getting better: Overall Code Complexity
The mean cyclomatic complexity decreases from 4.50 to 4.33, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
Check warning on line 443 in src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ Getting worse: Large Method
AddCoreServices increases from 213 to 215 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 193 in src/Umbraco.Core/Routing/ContentFinderByUrlAlias.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Complex Method
FindContentByAlias has a cyclomatic complexity of 10, 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 notice on line 209 in src/Umbraco.Core/Routing/ContentFinderByUrlAlias.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ No longer an issue: Bumpy Road Ahead
FindContentByAlias is no longer above the threshold for logical blocks with deeply nested code
Check warning on line 76 in src/Umbraco.Core/Routing/ContentFinderByUrlAlias.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Constructor Over-Injection
ContentFinderByUrlAlias has 7 arguments, max arguments = 5. This constructor has too many arguments, indicating an object with low cohesion or missing function argument abstraction. Avoid adding more arguments.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Large Method
AddRepositories has 70 lines, 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 152 in src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ Getting worse: Large Method
UmbracoPlan increases from 71 to 72 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: Primitive Obsession
In this module, 91.7% of all function arguments are primitive types, threshold = 30.0%. The functions in this file have too many primitive types (e.g. int, double, float) in their function argument lists. Using many primitive types lead to the code smell Primitive Obsession. Avoid adding more primitive arguments.
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ No longer an issue: Excess Number of Function Arguments
Lookup_By_Url_Alias is no longer above the threshold for number of arguments
Check warning on line 432 in src/Umbraco.Core/Services/DocumentUrlAliasService.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Complex Method
ExtractAliasesFromDocumentAsync has a cyclomatic complexity of 9, 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 257 in src/Umbraco.Core/Services/DocumentUrlAliasService.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Complex Conditional
CreateOrUpdateAliasesInternalAsync has 1 complex conditionals with 2 branches, threshold = 2. A complex conditional is an expression inside a branch (e.g. if, for, while) which consists of multiple, logical operators such as AND/OR. The more logical operators in an expression, the more severe the code smell.
Check warning on line 378 in src/Umbraco.Core/Services/DocumentUrlAliasService.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Bumpy Road Ahead
RebuildAllAliasesAsync 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 432 in src/Umbraco.Core/Services/DocumentUrlAliasService.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Bumpy Road Ahead
ExtractAliasesFromDocumentAsync 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 378 in src/Umbraco.Core/Services/DocumentUrlAliasService.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Deep, Nested Complexity
RebuildAllAliasesAsync has a nested complexity depth of 4, threshold = 4. This function contains deeply nested logic such as if statements and/or loops. The deeper the nesting, the lower the code health.
Check warning on line 432 in src/Umbraco.Core/Services/DocumentUrlAliasService.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Deep, Nested Complexity
ExtractAliasesFromDocumentAsync has a nested complexity depth of 4, threshold = 4. This function contains deeply nested logic such as if statements and/or loops. The deeper the nesting, the lower the code health.
Check warning on line 1 in src/Umbraco.Core/Services/DocumentUrlAliasService.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Primitive Obsession
In this module, 48.4% of all function arguments are primitive types, threshold = 30.0%. The functions in this file have too many primitive types (e.g. int, double, float) in their function argument lists. Using many primitive types lead to the code smell Primitive Obsession. Avoid adding more primitive arguments.
Check warning on line 108 in src/Umbraco.Core/Services/DocumentUrlAliasService.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Constructor Over-Injection
DocumentUrlAliasService has 7 arguments, max arguments = 5. This constructor has too many arguments, indicating an object with low cohesion or missing function argument abstraction. Avoid adding more arguments.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Low Cohesion
This module has at least 6 different responsibilities amongst its 33 functions, threshold = 3. Cohesion is calculated using the LCOM4 metric. Low cohesion means that the module/class has multiple unrelated responsibilities, doing too many things and breaking the Single Responsibility Principle.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Code Duplication
The module contains 6 functions with similar structure: CreateContentTypeWithUrlAlias,CreateCultureVariantContentTypeWithUrlAlias,CreateOrUpdateAliasesAsync_Removes_Alias_When_Cleared,CreateOrUpdateAliasesAsync_Updates_Alias_When_Changed 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: Large Assertion Blocks
The test suite contains 5 assertion blocks with at least 4 assertions, threshold = 4. This test file has several blocks of large, consecutive assert statements. Avoid adding more.