Skip to content

Code Tidy: Remove obsolete code scheduled for removal in Umbraco 18 (UrlSegment extension method) - #22682

Merged
kjac merged 7 commits into
v18/devfrom
v18/task/further-todos-and-obsoletes-11
May 4, 2026
Merged

Code Tidy: Remove obsolete code scheduled for removal in Umbraco 18 (UrlSegment extension method)#22682
kjac merged 7 commits into
v18/devfrom
v18/task/further-todos-and-obsoletes-11

Remove obsolete UrlSegment extension methods and update callers. Clar…

2a2556b
Select commit
Loading
Failed to load commit list.
CodeScene Delta Analysis / CodeScene Code Health Review (v18/dev) failed May 4, 2026 in 1m 0s

CodeScene PR Check

Quality Gate Failed

Code Health Improved (2 files improve in Code Health)

Gates Failed
Enforce critical code health rules (1 file with Bumpy Road Ahead)
Enforce advisory code health rules (3 files with Complex Method, Constructor Over-Injection, 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
RequestRedirectService.cs 1 critical rule 9.39 → 9.22 Suppress
Enforce advisory code health rules Violations Code Health Impact
RequestStartItemProvider.cs 1 advisory rule 10.00 → 9.69 Suppress
ContentRouteBuilderTests.cs 1 advisory rule 6.49 → 6.30 Suppress
RequestRedirectService.cs 1 advisory rule 9.39 → 9.22 Suppress
View Improvements
File Code Health Impact Categories Improved
DeliveryApiTests.cs 8.82 → 9.10 Primitive Obsession, Excess Number of Function Arguments
PublishedContentCacheTests.cs 7.33 → 8.03 Code Duplication, Large Assertion Blocks

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 ContentRouteBuilderTests.cs
  • Complex Method RequestRedirectService.cs: GetRedirectRoute
  • Constructor Over-Injection RequestStartItemProvider.cs: RequestStartItemProvider
  • Bumpy Road Ahead RequestRedirectService.cs: GetRedirectRoute

✅ Improving Code Health:

  • Code Duplication PublishedContentExtensions.cs
  • Code Duplication PublishedContentCacheTests.cs: PublishedContentCache_CanGetByIds
  • Low Cohesion PublishedContentExtensions.cs
  • Primitive Obsession PublishedContentExtensions.cs
  • Primitive Obsession ContentRouteBuilderTests.cs
  • Excess Number of Function Arguments DeliveryApiTests.cs: ConfigurePublishedContentMock
  • Primitive Obsession DeliveryApiTests.cs
  • Large Assertion Blocks PublishedContentCacheTests.cs

Annotations

Check warning on line 61 in src/Umbraco.Cms.Api.Delivery/Services/RequestRedirectService.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ Getting worse: Complex Method

GetRedirectRoute increases in cyclomatic complexity from 10 to 12, 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 61 in src/Umbraco.Cms.Api.Delivery/Services/RequestRedirectService.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ New issue: Bumpy Road Ahead

GetRedirectRoute 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 36 in src/Umbraco.Cms.Api.Delivery/Services/RequestStartItemProvider.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ New issue: Constructor Over-Injection

RequestStartItemProvider has 6 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.

Check notice on line 1 in src/Umbraco.Core/Extensions/PublishedContentExtensions.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

✅ Getting better: Low Cohesion

The number of different responsibilities decreases from 5 to 4, 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.

Check notice on line 1 in src/Umbraco.Core/Extensions/PublishedContentExtensions.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

✅ Getting better: Code Duplication

reduced similar code in: Name,UrlSegment. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check notice on line 1 in src/Umbraco.Core/Extensions/PublishedContentExtensions.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

✅ Getting better: Primitive Obsession

The ratio of primitive types in function arguments decreases from 31.24% to 31.22%, 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 62 in tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/ContentRouteBuilderTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ Getting worse: Code Duplication

introduced similar code in: CanBuildForChild,CanUseCustomContentPathProvider. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check notice on line 1 in tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/ContentRouteBuilderTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

✅ Getting better: Primitive Obsession

The ratio of primitive types in function arguments decreases from 57.78% to 55.32%, 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 notice on line 1 in tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/DeliveryApiTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

✅ No longer an issue: Primitive Obsession

The ratio of primivite types in function arguments is no longer above the threshold

Check notice on line 123 in tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/DeliveryApiTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

✅ Getting better: Excess Number of Function Arguments

ConfigurePublishedContentMock decreases from 6 to 5 arguments, max arguments = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check notice on line 1 in tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/PublishedContentCacheTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

✅ Getting better: Code Duplication

reduced similar code in: PublishedContentCache_CanGetByIds. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check notice on line 1 in tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/PublishedContentCacheTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

✅ No longer an issue: Large Assertion Blocks

The test suite no longer contains large assertion blocks that exceed the threshold