Skip to content

Children/Descendants: improve traversal performance (closes #22646) - #22742

Merged
AndyButland merged 13 commits into
v17/devfrom
v17/improvement/children-and-descendent-retrieval-performance
May 19, 2026
Merged

Children/Descendants: improve traversal performance (closes #22646)#22742
AndyButland merged 13 commits into
v17/devfrom
v17/improvement/children-and-descendent-retrieval-performance

Addressed code review feedback.

b57783d
Select commit
Loading
Failed to load commit list.
CodeScene Delta Analysis / CodeScene Code Health Review (main) failed May 7, 2026 in 1m 38s

CodeScene PR Check

Quality Gate Failed

Gates Failed
Enforce advisory code health rules (7 files with Large Method, Overall Code Complexity, Code Duplication, Excess Number of Function Arguments, Primitive Obsession)

Gates Passed
3 Quality Gates Passed

See analysis details in CodeScene

Reason for failure
Enforce advisory code health rules Violations Code Health Impact
NavigationNode.cs 1 advisory rule 10.00 → 9.39 Suppress
NavigationNodeTests.cs 1 advisory rule 9.39 Suppress
ContentNavigationDescendantsCacheTests.cs 1 advisory rule 9.39 Suppress
PublishedContent.cs 1 advisory rule 9.69 → 9.10 Suppress
SyntheticPublishedTreeFixture.cs 1 advisory rule 9.44 Suppress
ContentNavigationServiceBase.cs 1 advisory rule 9.69 → 9.39 Suppress
MediaCacheService.cs 1 advisory rule 9.69 → 9.39 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 NavigationNode.cs
  • Overall Code Complexity PublishedContent.cs
  • Code Duplication NavigationNodeTests.cs
  • Code Duplication ContentNavigationDescendantsCacheTests.cs
  • Large Method SyntheticPublishedTreeFixture.cs: InitialiseAsync
  • Excess Number of Function Arguments ContentNavigationServiceBase.cs: TryGetDescendantsKeysFromStructure
  • Primitive Obsession MediaCacheService.cs

✅ Improving Code Health:

  • Lines of Code in a Single File PublishedContentExtensions.cs
  • Primitive Obsession ContentNavigationServiceBase.cs

Annotations

Check warning on line 169 in tests/Umbraco.Tests.Benchmarks/Fixtures/SyntheticPublishedTreeFixture.cs

See this annotation in the file changed.

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

❌ New issue: Large Method

InitialiseAsync has 101 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 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 (main)

✅ Getting better: Lines of Code in a Single File

The lines of code decreases from 1003 to 1001, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.

Check warning on line 1 in src/Umbraco.PublishedCache.HybridCache/PublishedContent.cs

See this annotation in the file changed.

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

❌ New issue: Overall Code Complexity

This module has a mean cyclomatic complexity of 4.50 across 8 functions. The mean complexity threshold is 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 107 in src/Umbraco.Core/Models/Navigation/NavigationNode.cs

See this annotation in the file changed.

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

❌ New issue: Code Duplication

The module contains 2 functions with similar structure: AddChild,RemoveChild. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check notice on line 1 in src/Umbraco.Core/Services/Navigation/ContentNavigationServiceBase.cs

See this annotation in the file changed.

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

✅ Getting better: Primitive Obsession

The ratio of primitive types in function arguments decreases from 58.06% to 54.55%, 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 788 in src/Umbraco.Core/Services/Navigation/ContentNavigationServiceBase.cs

See this annotation in the file changed.

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

❌ New issue: Excess Number of Function Arguments

TryGetDescendantsKeysFromStructure has 5 arguments, max arguments = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check warning on line 78 in tests/Umbraco.Tests.UnitTests/Umbraco.Core/Models/Navigation/NavigationNodeTests.cs

See this annotation in the file changed.

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

❌ New issue: Code Duplication

The module contains 2 functions with similar structure: GetOrderedChildren_AddChild_InvalidatesCacheAndIncludesNewChild,GetOrderedChildren_RemoveChild_InvalidatesCacheAndExcludesChild. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check warning on line 88 in tests/Umbraco.Tests.UnitTests/Umbraco.Core/Services/Navigation/ContentNavigationDescendantsCacheTests.cs

See this annotation in the file changed.

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

❌ New issue: Code Duplication

The module contains 4 functions with similar structure: TryGetDescendantsKeysInBin_AfterRemoveFromBin_RebuildsBinDescendantsCache,TryGetDescendantsKeysInBin_AfterRestoreFromBin_RebuildsBinDescendantsCache,TryGetDescendantsKeysOfType_AfterAdd_RebuildsAndIncludesMatchingNewNode,TryGetDescendantsKeys_AfterAdd_RebuildsAndIncludesNewNode. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check warning on line 1 in src/Umbraco.PublishedCache.HybridCache/Services/MediaCacheService.cs

See this annotation in the file changed.

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

❌ New issue: Primitive Obsession

In this module, 35.5% 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.