{"results":{"result":{"added-files":{"code-health":10.0,"old-code-health":0.0,"files":[{"file":"src/Umbraco.Core/Models/PublishedContent/PublishedContentUrlSegmentResolver.cs","loc":23,"code-health":10.0}]},"external-review-url":"https://github.com/umbraco/Umbraco-CMS/pull/22682","old-code-health":7.994656406842466,"modified-files":{"code-health":8.044516165722321,"old-code-health":7.994656406842466,"files":[{"file":"src/Umbraco.Cms.Api.Delivery/Services/RequestRedirectService.cs","loc":77,"old-loc":70,"code-health":9.21744523236767,"old-code-health":9.387218218812514},{"file":"src/Umbraco.Cms.Api.Delivery/Services/RequestStartItemProvider.cs","loc":56,"old-loc":50,"code-health":9.6882083290695,"old-code-health":10.0},{"file":"src/Umbraco.Core/DeliveryApi/ApiContentRouteBuilder.cs","loc":156,"old-loc":155,"code-health":8.545379580978913,"old-code-health":8.545379580978913},{"file":"src/Umbraco.Core/Extensions/PublishedContentExtensions.cs","loc":1035,"old-loc":1058,"code-health":6.690924517213949,"old-code-health":6.690924517213949},{"file":"src/Umbraco.Core/Models/PublishedContent/PublishedContentBase.cs","loc":26,"old-loc":18,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs","loc":23,"old-loc":14,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Core/PublishedCache/Internal/InternalPublishedContent.cs","loc":78,"old-loc":77,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"src/Umbraco.Core/Security/PublishedExternalMember.cs","loc":132,"old-loc":131,"code-health":8.816158827775617,"old-code-health":8.816158827775617},{"file":"src/Umbraco.PublishedCache.HybridCache/PublishedContent.cs","loc":94,"old-loc":86,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.Common/Extensions/FriendlyPublishedContentExtensions.cs","loc":449,"old-loc":446,"code-health":9.096655465156704,"old-code-health":9.096655465156704},{"file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/ContentBuilderTests.cs","loc":118,"old-loc":118,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/ContentPickerValueConverterTests.cs","loc":180,"old-loc":180,"code-health":9.387218218812514,"old-code-health":9.387218218812514},{"file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/ContentRouteBuilderTests.cs","loc":450,"old-loc":417,"code-health":6.30344731029596,"old-code-health":6.493770865618227},{"file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/DeliveryApiTests.cs","loc":162,"old-loc":163,"code-health":9.096655465156704,"old-code-health":8.816158827775617},{"file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/MediaBuilderTests.cs","loc":90,"old-loc":94,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/MultiNodeTreePickerValueConverterTests.cs","loc":266,"old-loc":266,"code-health":7.552876135642913,"old-code-health":7.552876135642913},{"file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/OutputExpansionStrategyTestBase.cs","loc":390,"old-loc":392,"code-health":8.031638343271364,"old-code-health":8.031638343271364},{"file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/PropertyValueConverterTests.cs","loc":160,"old-loc":161,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/PublishedContentCacheTests.cs","loc":328,"old-loc":334,"code-health":8.031638343271364,"old-code-health":7.325861446783724}]},"removed-files":{"code-health":0.0,"old-code-health":0.0,"files":[]},"external-review-id":"22682","analysis-time":"2026-05-04T05:37:21Z","negative-impact-count":4,"suppressions":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"affected-hotspots":0,"commits":["2a2556b4c1b979e10bbcd19235c911cf244bde31"],"is-negative-review":true,"negative-findings":{"number-of-types":4,"number-of-files-touched":3,"findings":[{"method":"GetRedirectRoute","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the C# language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"src/Umbraco.Cms.Api.Delivery/Services/RequestRedirectService.cs","refactoring-examples":[{"diff":"diff --git a/complex_method.js b/complex_method.js\nindex 10cce78e6d..0c1a8cabaf 100644\n--- a/complex_method.js\n+++ b/complex_method.js\n@@ -1,15 +1,20 @@\n function postItem(item) {\n   if (!item.id) {\n-    if (item.x != null && item.y != null) {\n-      post(item);\n-    } else {\n-      throw Error(\"Item must have x and y\");\n-    }\n+    // extract a separate function for creating new item\n+    postNew(item);\n   } else {\n-    if (item.x < 10 && item.y > 25) {\n-      put(item);\n-    } else {\n-      throw Error(\"Item must have an x and y value between 10 and 25\");\n-    }\n+    // and one for updating existing items\n+    updateItem(item);\n   }\n }\n+\n+function postNew(item) {\n+  validateNew(item);\n+  post(item);\n+}\n+\n+function updateItem(item) {\n+  validateUpdate(item);\n+  put(item);\n+}\n+\n","language":"c#","improvement-type":"Complex Method"}],"change-level":"warning","is-hotspot?":false,"line":44,"what-changed":"GetRedirectRoute increases in cyclomatic complexity from 10 to 12, threshold = 9","how-to-fix":"There are many reasons for Complex Method. Sometimes, another design approach is beneficial such as a) modeling state using an explicit state machine rather than conditionals, or b) using table lookup rather than long chains of logic. In other scenarios, the function can be split using [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html). Just make sure you extract natural and cohesive functions. Complex Methods can also be addressed by identifying complex conditional expressions and then using the [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring.","change-type":"degraded"},{"method":"GetRedirectRoute","why-it-occurs":"A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.\n\nA bumpy code road represents a lack of encapsulation which becomes an obstacle to comprehension. In imperative languages there’s also an increased risk for feature entanglement, which leads to complex state management. CodeScene considers the following rules for the code health impact: 1) The deeper the nested conditional logic of each bump, the higher the tax on our working memory. 2) The more bumps inside a function, the more expensive it is to refactor as each bump represents a missing abstraction. 3) The larger each bump – that is, the more lines of code it spans – the harder it is to build up a mental model of the function. The nesting depth for what is considered a bump is  levels of conditionals.","name":"Bumpy Road Ahead","file":"src/Umbraco.Cms.Api.Delivery/Services/RequestRedirectService.cs","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":44,"what-changed":"GetRedirectRoute has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is 2 blocks per function","how-to-fix":"Bumpy Road implementations indicate a lack of encapsulation. Check out the detailed description of the [Bumpy Road code health issue](https://codescene.com/blog/bumpy-road-code-complexity-in-context/).\n\nA Bumpy Road often suggests that the function/method does too many things. The first refactoring step is to identify the different possible responsibilities of the function. Consider extracting those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring is the primary response.","change-type":"introduced"},{"method":"RequestStartItemProvider","why-it-occurs":"Counts the maximum number of arguments to each class' constructor. Too many arguments give a lower code health score. The rationale is that many constructor arguments indicate either a unit with low cohesion or an injection of dependencies on the wrong abstraction level.","name":"Constructor Over-Injection","file":"src/Umbraco.Cms.Api.Delivery/Services/RequestStartItemProvider.cs","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":23,"what-changed":"RequestStartItemProvider has 6 arguments, max arguments = 5","how-to-fix":"There are multiple ways of addressing constructor over-injection. Sometimes you can introduce [FACADE](https://en.wikipedia.org/wiki/Facade_pattern) services that encapsulate lower-level dependencies.\n\nIn many cases, Constructor Over-Injection is a symptom of a deeper problem. Make sure to investigate the root cause, and get some inspiration and examples from [Mark Seemann's article](https://blog.ploeh.dk/2018/08/27/on-constructor-over-injection/) on the issue.","change-type":"introduced"},{"why-it-occurs":"Duplicated code often leads to code that's harder to change since the same logical change has to be done in multiple functions. More duplication gives lower code health.","name":"Code Duplication","file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/ContentRouteBuilderTests.cs","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":43,"what-changed":"introduced similar code in: CanBuildForChild,CanUseCustomContentPathProvider","how-to-fix":"A certain degree of duplicated code might be acceptable. The problems start when it is the same behavior that is duplicated across the functions in the module, ie. a violation of the Don't Repeat Yourself (DRY) principle. DRY violations lead to code that is changed together in predictable patterns, which is both expensive and risky. DRY violations can be identified using CodeScene's X-Ray analysis to detect clusters of change coupled functions with high code similarity. [Read More](https://codescene.com/blog/software-revolution-part3/)\n\nOnce you have identified the similarities across functions, look to extract and encapsulate the concept that varies into its own function(s). These shared abstractions can then be re-used, which minimizes the amount of duplication and simplifies change.","change-type":"degraded"}]},"positive-impact-count":8,"repo":"Umbraco-CMS","code-health":8.054992785379527,"version":"3.0","authors":["Andy Butland"],"directives":{"added":[],"removed":[]},"positive-findings":{"number-of-types":5,"number-of-files-touched":4,"findings":[{"name":"Low Cohesion","file":"src/Umbraco.Core/Extensions/PublishedContentExtensions.cs","change-type":"improved","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Cohesion is a measure of how well the elements in a file belong together. CodeScene measures cohesion using the LCOM4 metric (Lack of Cohesion Measure). With LCOM4, the functions inside a module are related if a) they access the same data members, or b) they call each other. High Cohesion is desirable as it means that all functions are related and likely to represent the same responsibility. Low Cohesion is problematic since it means that the module contains multiple behaviors. Low Cohesion leads to code that's harder to understand, requires more tests, and very often become a coordination magnet for developers.","how-to-fix":"Look to modularize the code by splitting the file into more cohesive units; functions that belong together should still be located together. A common refactoring is [EXTRACT CLASS](https://refactoring.com/catalog/extractClass.html).","what-changed":"The number of different responsibilities decreases from 5 to 4, threshold = 3"},{"name":"Code Duplication","file":"src/Umbraco.Core/Extensions/PublishedContentExtensions.cs","change-type":"improved","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Duplicated code often leads to code that's harder to change since the same logical change has to be done in multiple functions. More duplication gives lower code health.","how-to-fix":"A certain degree of duplicated code might be acceptable. The problems start when it is the same behavior that is duplicated across the functions in the module, ie. a violation of the Don't Repeat Yourself (DRY) principle. DRY violations lead to code that is changed together in predictable patterns, which is both expensive and risky. DRY violations can be identified using CodeScene's X-Ray analysis to detect clusters of change coupled functions with high code similarity. [Read More](https://codescene.com/blog/software-revolution-part3/)\n\nOnce you have identified the similarities across functions, look to extract and encapsulate the concept that varies into its own function(s). These shared abstractions can then be re-used, which minimizes the amount of duplication and simplifies change.","what-changed":"reduced similar code in: Name,UrlSegment"},{"name":"Primitive Obsession","file":"src/Umbraco.Core/Extensions/PublishedContentExtensions.cs","change-type":"improved","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Code that uses a high degree of built-in, primitives such as integers, strings, floats, lacks a domain language that encapsulates the validation and semantics of function arguments. Primitive Obsession has several consequences: 1) In a statically typed language, the compiler will detect less erroneous assignments. 2) Security impact since the possible value range of a variable/argument isn't retricted.\n\nIn this module, 31 % of all functions have primitive types as arguments.","how-to-fix":"Primitive Obsession indicates a missing domain language. Introduce data types that encapsulate the details and constraints of your domain. For example, instead of `int userId`, consider `User clicked`.","what-changed":"The ratio of primitive types in function arguments decreases from 31.24% to 31.22%, threshold = 30.0%"},{"name":"Primitive Obsession","file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/ContentRouteBuilderTests.cs","change-type":"improved","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Code that uses a high degree of built-in, primitives such as integers, strings, floats, lacks a domain language that encapsulates the validation and semantics of function arguments. Primitive Obsession has several consequences: 1) In a statically typed language, the compiler will detect less erroneous assignments. 2) Security impact since the possible value range of a variable/argument isn't retricted.\n\nIn this module, 55 % of all functions have primitive types as arguments.","how-to-fix":"Primitive Obsession indicates a missing domain language. Introduce data types that encapsulate the details and constraints of your domain. For example, instead of `int userId`, consider `User clicked`.","what-changed":"The ratio of primitive types in function arguments decreases from 57.78% to 55.32%, threshold = 30.0%"},{"name":"Primitive Obsession","file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/DeliveryApiTests.cs","change-type":"fixed","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Code that uses a high degree of built-in, primitives such as integers, strings, floats, lacks a domain language that encapsulates the validation and semantics of function arguments. Primitive Obsession has several consequences: 1) In a statically typed language, the compiler will detect less erroneous assignments. 2) Security impact since the possible value range of a variable/argument isn't retricted.\n\nIn this module, 37 % of all functions have primitive types as arguments.","how-to-fix":"Primitive Obsession indicates a missing domain language. Introduce data types that encapsulate the details and constraints of your domain. For example, instead of `int userId`, consider `User clicked`.","what-changed":"The ratio of primivite types in function arguments is no longer above the threshold"},{"method":"ConfigurePublishedContentMock","why-it-occurs":"Functions with many arguments indicate either a) low cohesion where the function has too many responsibilities, or b) a missing abstraction that encapsulates those arguments.\n\nThe threshold for the C# language is 4 function arguments.","name":"Excess Number of Function Arguments","file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/DeliveryApiTests.cs","change-level":"improvement","is-hotspot?":false,"line":113,"what-changed":"ConfigurePublishedContentMock decreases from 6 to 5 arguments, max arguments = 4","how-to-fix":"Start by investigating the responsibilities of the function. Make sure it doesn't do too many things, in which case it should be split into smaller and more cohesive functions. Consider the refactoring [INTRODUCE PARAMETER OBJECT](https://refactoring.com/catalog/introduceParameterObject.html) to encapsulate arguments that refer to the same logical concept.","change-type":"improved"},{"method":"PublishedContentCache_CanGetByIds","why-it-occurs":"Duplicated code often leads to code that's harder to change since the same logical change has to be done in multiple functions. More duplication gives lower code health.","name":"Code Duplication","file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/PublishedContentCacheTests.cs","change-level":"improvement","is-hotspot?":false,"what-changed":"reduced similar code in: PublishedContentCache_CanGetByIds","how-to-fix":"A certain degree of duplicated code might be acceptable. The problems start when it is the same behavior that is duplicated across the functions in the module, ie. a violation of the Don't Repeat Yourself (DRY) principle. DRY violations lead to code that is changed together in predictable patterns, which is both expensive and risky. DRY violations can be identified using CodeScene's X-Ray analysis to detect clusters of change coupled functions with high code similarity. [Read More](https://codescene.com/blog/software-revolution-part3/)\n\nOnce you have identified the similarities across functions, look to extract and encapsulate the concept that varies into its own function(s). These shared abstractions can then be re-used, which minimizes the amount of duplication and simplifies change.","change-type":"improved"},{"name":"Large Assertion Blocks","file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/DeliveryApi/PublishedContentCacheTests.cs","change-type":"fixed","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Measures the number of lines with consecutive assert statements in a unit test. The more consecutive assert statements, the lower the code health. The threshold for the C# language is 4 consecutive lines of assert statements.","how-to-fix":"Consider to encapsulate the assertions (i.e. test criteria) in a custom assert statement. This simplifies the test by letting you communicate the test criteria in the language of your domain.  We also recommend to consider the granularity of the tests; sometimes a single test tests too many things; extracting smaller tests often help to simplify the test criteria. Finally, large assertion blocks can also signal missing functionality in the code under test: instead of fetching and comparing individual properties of an object, maybe that class should encapsulate what equality means in an Equals() method?","what-changed":"The test suite no longer contains large assertion blocks that exceed the threshold"}]},"notices":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"external-review-provider":"GitHub"},"analysistime":"2026-05-04T05:37:20.000Z","project-name":"Umbraco-CMS","repository":"https://github.com/umbraco/Umbraco-CMS.git"}}