{"results":{"result":{"added-files":{"code-health":0.0,"old-code-health":0.0,"files":[]},"external-review-url":"https://github.com/umbraco/Umbraco-CMS/pull/23060","old-code-health":6.198109943418161,"modified-files":{"code-health":6.17215411074527,"old-code-health":6.198109943418161,"files":[{"file":"src/Umbraco.Cms.Api.Management/Factories/ContentEditingPresentationFactory.cs","loc":25,"old-loc":25,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Core/Models/Validation/PropertyValidationContext.cs","loc":15,"old-loc":16,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Core/Services/ContentEditingServiceBase.cs","loc":553,"old-loc":564,"code-health":6.49183422235367,"old-code-health":6.43980212743119},{"file":"src/Umbraco.Core/Services/ContentPublishingServiceBase.cs","loc":361,"old-loc":362,"code-health":7.128280289378631,"old-code-health":7.128280289378631},{"file":"src/Umbraco.Core/Services/ContentValidationServiceBase.cs","loc":172,"old-loc":192,"code-health":8.768354547547272,"old-code-health":7.948828583254637},{"file":"src/Umbraco.Core/Services/PropertyValidationService.cs","loc":214,"old-loc":216,"code-health":6.493770865618227,"old-code-health":6.493770865618227},{"file":"src/Umbraco.Infrastructure/PropertyEditors/BlockEditorValidatorBase.cs","loc":146,"old-loc":130,"code-health":8.004419920565056,"old-code-health":8.071417696154342},{"file":"src/Umbraco.Infrastructure/Services/MemberEditingService.cs","loc":446,"old-loc":446,"code-health":7.4270281634318565,"old-code-health":7.406666207699989},{"file":"tests/Umbraco.Tests.Common/Factories/ContentEditingModelFactory.cs","loc":106,"old-loc":145,"code-health":8.907631620632795,"old-code-health":8.361435209759529},{"file":"tests/Umbraco.Tests.Common/Builders/ContentEditingVariantBuilder.cs","loc":26,"old-loc":33,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.Common/TestHelpers/DocumentUpdateHelper.cs","loc":51,"old-loc":53,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/BlockListElementLevelVariationTests.Validation.cs","loc":593,"old-loc":593,"code-health":6.117190714214419,"old-code-health":6.117190714214419},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentEditingServiceTests.Create.cs","loc":879,"old-loc":917,"code-health":4.72765254169445,"old-code-health":4.72765254169445},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentEditingServiceTests.Update.cs","loc":574,"old-loc":584,"code-health":7.552876135642913,"old-code-health":7.552876135642913},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentEditingServiceTests.Validate.cs","loc":197,"old-loc":201,"code-health":9.096655465156704,"old-code-health":9.096655465156704},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentEditingServiceTestsBase.cs","loc":210,"old-loc":216,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentValidationServiceTests.cs","loc":584,"old-loc":588,"code-health":7.474791419624982,"old-code-health":7.474791419624982},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ElementEditingServiceTests.Create.cs","loc":429,"old-loc":435,"code-health":7.325861446783724,"old-code-health":7.325861446783724},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ElementEditingServiceTests.Update.cs","loc":182,"old-loc":188,"code-health":8.545379580978913,"old-code-health":8.545379580978913},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ElementEditingServiceTests.cs","loc":199,"old-loc":205,"code-health":9.387218218812514,"old-code-health":9.387218218812514},{"file":"src/Umbraco.Cms.Api.Management/Factories/DocumentEditingPresentationFactory.cs","loc":120,"old-loc":123,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Cms.Api.Management/Mapping/Content/ContentMapDefinition.cs","loc":115,"old-loc":118,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Cms.Api.Management/Mapping/Document/DocumentMapDefinition.cs","loc":105,"old-loc":105,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Cms.Api.Management/Mapping/Document/DocumentVersionMapDefinition.cs","loc":38,"old-loc":38,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Cms.Api.Management/Mapping/Element/ElementMapDefinition.cs","loc":41,"old-loc":41,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Cms.Api.Management/Mapping/Element/ElementVersionMapDefinition.cs","loc":34,"old-loc":34,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.Integration/ManagementApi/Document/CreateDocumentControllerTests.cs","loc":71,"old-loc":71,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.Integration/ManagementApi/Document/UpdateDocumentControllerTests.cs","loc":75,"old-loc":75,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.Integration/ManagementApi/Element/CreateElementControllerTests.cs","loc":58,"old-loc":58,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.Integration/ManagementApi/Element/UpdateElementControllerTests.cs","loc":61,"old-loc":61,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.Integration/ManagementApi/Element/ValidateCreateElementControllerTests.cs","loc":55,"old-loc":55,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.Integration/ManagementApi/Element/ValidateUpdateElementControllerTests.cs","loc":62,"old-loc":62,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.Integration/ManagementApi/Media/CreateMediaControllerTests.cs","loc":59,"old-loc":59,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.Integration/ManagementApi/Media/UpdateMediaControllerTests.cs","loc":68,"old-loc":68,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Core/Models/Blocks/BlockEditorDataConverter.cs","loc":69,"old-loc":69,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Core/Models/Blocks/BlockItemVariation.cs","loc":14,"old-loc":16,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockEditorVarianceHandler.cs","loc":152,"old-loc":152,"code-health":8.283981080161325,"old-code-health":8.283981080161325},{"file":"src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockExposeFallbackHelper.cs","loc":88,"old-loc":89,"code-health":9.387218218812514,"old-code-health":9.387218218812514},{"file":"tests/Umbraco.Tests.Integration/ManagementApi/Document/PatchDocumentControllerTests.cs","loc":1439,"old-loc":1439,"code-health":4.528657539281287,"old-code-health":4.528657539281287},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/BlockGridElementLevelVariationTests.cs","loc":661,"old-loc":661,"code-health":5.753668917913344,"old-code-health":5.753668917913344},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/BlockGridNullSpanTests.cs","loc":75,"old-loc":75,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/BlockListElementLevelVariationTests.Editing.cs","loc":1328,"old-loc":1333,"code-health":3.8114939763483218,"old-code-health":3.8114939763483218},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/BlockListElementLevelVariationTests.Publishing.cs","loc":2295,"old-loc":2221,"code-health":3.040124294440617,"old-code-health":3.040124294440617},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/BlockListElementLevelVariationTests.cs","loc":191,"old-loc":197,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/BlockListPropertyEditorTests.cs","loc":393,"old-loc":393,"code-health":7.115329798500707,"old-code-health":7.115329798500707},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/RichTextElementLevelVariationTests.cs","loc":982,"old-loc":982,"code-health":5.515795289437686,"old-code-health":5.515795289437686},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/SingleBlockPropertyEditorTests.cs","loc":678,"old-loc":678,"code-health":5.79541698429586,"old-code-health":5.79541698429586},{"file":"tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/PropertyEditors/BlockEditorVarianceHandlerTests.cs","loc":380,"old-loc":399,"code-health":8.816158827775617,"old-code-health":9.096655465156704},{"file":"tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/PropertyEditors/BlockExposeFallbackHelperTests.cs","loc":136,"old-loc":147,"code-health":9.096655465156704,"old-code-health":9.096655465156704},{"file":"src/Umbraco.Cms.Api.Management/Controllers/Content/ContentControllerBase.cs","loc":266,"old-loc":270,"code-health":8.912093774718056,"old-code-health":8.892033889495133}]},"removed-files":{"code-health":0.0,"old-code-health":0.0,"files":[]},"external-review-id":"23060","analysis-time":"2026-06-03T17:22:59Z","negative-impact-count":2,"suppressions":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"affected-hotspots":0,"commits":["533f42d0938fde94b0356c0848c4cd2eae3d23ea","a94b5e37ecebb0029c32764fcccc12f1c0f10781","247e1eb51319a25a009175cacb507550faf10b80","6cbb6e1c83a72d5b7cb6a675501ef117ac1ab531","597371e21316aab3c242c3421daed2bc353fd4fb","d39ad2c124ee43ab55e503a446397637bed405af"],"is-negative-review":true,"negative-findings":{"number-of-types":2,"number-of-files-touched":2,"findings":[{"method":"GetBlockEditorDataValidation","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.Infrastructure/PropertyEditors/BlockEditorValidatorBase.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":77,"what-changed":"GetBlockEditorDataValidation increases in cyclomatic complexity from 26 to 29, 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"},{"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.Infrastructure/PropertyEditors/BlockEditorVarianceHandlerTests.cs","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":183,"what-changed":"introduced similar code in: AlignExposeVariance_Can_Align_Variance,AlignExposeVariance_Skips_When_ElementType_Not_Found","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":18,"repo":"Umbraco-CMS","code-health":6.17215411074527,"version":"3.0","authors":["kjac"],"directives":{"added":[],"removed":[]},"positive-findings":{"number-of-types":9,"number-of-files-touched":9,"findings":[{"method":"TryGetAndValidateContentType","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.Core/Services/ContentEditingServiceBase.cs","change-level":"improvement","is-hotspot?":false,"line":517,"what-changed":"TryGetAndValidateContentType decreases in cyclomatic complexity from 13 to 10, 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":"improved"},{"method":"TryGetAndValidateContentType","why-it-occurs":"A complex conditional is an expression inside a branch such as an <code>if</code>-statmeent which consists of multiple, logical operations. Example: <code>if (x.started() && y.running())</code>.Complex conditionals make the code even harder to read, and contribute to the Complex Method code smell. Encapsulate them.","name":"Complex Conditional","file":"src/Umbraco.Core/Services/ContentEditingServiceBase.cs","change-level":"improvement","is-hotspot?":false,"line":526,"what-changed":"TryGetAndValidateContentType no longer has a complex conditional","how-to-fix":"Apply the [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring so that the complex conditional is encapsulated in a separate function with a good name that captures the business rule. Optionally, for simple expressions, introduce a new variable which holds the result of the complex conditional.","change-type":"fixed"},{"name":"Overall Code Complexity","file":"src/Umbraco.Core/Services/ContentEditingServiceBase.cs","change-type":"improved","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Overall Code Complexity is measured by the mean cyclomatic complexity across all functions in the file. The lower the number, the better.\n\nCyclomatic complexity is a function level metric that measures the number of logical branches (if-else, loops, etc.). Cyclomatic complexity is a rough complexity measure, but useful as a way of estimating the minimum number of unit tests you would need. As such, prefer functions with low cyclomatic complexity (2-3 branches).","how-to-fix":"You address the overall cyclomatic complexity by a) modularizing the code, and b) abstract away the complexity. Let's look at some examples:\n\nModularizing the Code: Do an X-Ray and inspect the local hotspots. Are there any complex conditional expressions? If yes, then do a [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring. Extract the conditional logic into a separate function and put a good name on that function. This clarifies the intent and makes the original function easier to read. Repeat until all complex conditional expressions have been simplified.\n\n","what-changed":"The mean cyclomatic complexity decreases from 4.78 to 4.52, threshold = 4"},{"method":"HandlePropertiesValidationAsync","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.Core/Services/ContentValidationServiceBase.cs","change-level":"improvement","is-hotspot?":false,"line":42,"what-changed":"HandlePropertiesValidationAsync decreases in cyclomatic complexity from 24 to 17, 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":"improved"},{"method":"HandlePropertiesValidationAsync","why-it-occurs":"A complex conditional is an expression inside a branch such as an <code>if</code>-statmeent which consists of multiple, logical operations. Example: <code>if (x.started() && y.running())</code>.Complex conditionals make the code even harder to read, and contribute to the Complex Method code smell. Encapsulate them.","name":"Complex Conditional","file":"src/Umbraco.Core/Services/ContentValidationServiceBase.cs","change-level":"improvement","is-hotspot?":false,"line":136,"what-changed":"HandlePropertiesValidationAsync no longer has a complex conditional","how-to-fix":"Apply the [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring so that the complex conditional is encapsulated in a separate function with a good name that captures the business rule. Optionally, for simple expressions, introduce a new variable which holds the result of the complex conditional.","change-type":"fixed"},{"name":"Overall Code Complexity","file":"src/Umbraco.Core/Services/ContentValidationServiceBase.cs","change-type":"fixed","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Overall Code Complexity is measured by the mean cyclomatic complexity across all functions in the file. The lower the number, the better.\n\nCyclomatic complexity is a function level metric that measures the number of logical branches (if-else, loops, etc.). Cyclomatic complexity is a rough complexity measure, but useful as a way of estimating the minimum number of unit tests you would need. As such, prefer functions with low cyclomatic complexity (2-3 branches).","how-to-fix":"You address the overall cyclomatic complexity by a) modularizing the code, and b) abstract away the complexity. Let's look at some examples:\n\nModularizing the Code: Do an X-Ray and inspect the local hotspots. Are there any complex conditional expressions? If yes, then do a [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring. Extract the conditional logic into a separate function and put a good name on that function. This clarifies the intent and makes the original function easier to read. Repeat until all complex conditional expressions have been simplified.\n\n","what-changed":"The mean cyclomatic complexity in this module is no longer above the threshold"},{"method":"HandlePropertiesValidationAsync","why-it-occurs":"Deep nested logic means that you have control structures like if-statements or loops inside other control structures. Deep nested logic increases the cognitive load on the programmer reading the code. The human working memory has a maximum capacity of 3-4 items; beyond that threshold, we struggle with keeping things in our head. Consequently, deep nested logic has a strong correlation to defects and accounts for roughly 20% of all programming mistakes.\n\nCodeScene measures the maximum nesting depth inside each function. The deeper the nesting, the lower the code health. The threshold for the C# language is 4 levels of nesting.","name":"Deep, Nested Complexity","file":"src/Umbraco.Core/Services/ContentValidationServiceBase.cs","change-level":"improvement","is-hotspot?":false,"line":42,"what-changed":"HandlePropertiesValidationAsync decreases in nested complexity depth from 5 to 4, threshold = 4","how-to-fix":"Occassionally, it's possible to get rid of the nested logic by [Replacing Conditionals with Guard Clauses](https://refactoring.com/catalog/replaceNestedConditionalWithGuardClauses.html).\n\nAnother viable strategy is to identify smaller building blocks inside the nested chunks of logic and extract those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring explains the steps.","change-type":"improved"},{"method":"ValidateMemberDataAsync","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.Infrastructure/Services/MemberEditingService.cs","change-level":"improvement","is-hotspot?":false,"line":392,"what-changed":"ValidateMemberDataAsync decreases in cyclomatic complexity from 17 to 16, 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":"improved"},{"name":"Overall Code Complexity","file":"src/Umbraco.Infrastructure/Services/MemberEditingService.cs","change-type":"improved","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Overall Code Complexity is measured by the mean cyclomatic complexity across all functions in the file. The lower the number, the better.\n\nCyclomatic complexity is a function level metric that measures the number of logical branches (if-else, loops, etc.). Cyclomatic complexity is a rough complexity measure, but useful as a way of estimating the minimum number of unit tests you would need. As such, prefer functions with low cyclomatic complexity (2-3 branches).","how-to-fix":"You address the overall cyclomatic complexity by a) modularizing the code, and b) abstract away the complexity. Let's look at some examples:\n\nModularizing the Code: Do an X-Ray and inspect the local hotspots. Are there any complex conditional expressions? If yes, then do a [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring. Extract the conditional logic into a separate function and put a good name on that function. This clarifies the intent and makes the original function easier to read. Repeat until all complex conditional expressions have been simplified.\n\n","what-changed":"The mean cyclomatic complexity decreases from 5.41 to 5.29, threshold = 4"},{"method":"MapNames","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":"tests/Umbraco.Tests.Common/Factories/ContentEditingModelFactory.cs","change-level":"improvement","is-hotspot?":false,"line":39,"what-changed":"MapNames is no longer above the threshold for cyclomatic complexity","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":"fixed"},{"method":"MapNames","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":"tests/Umbraco.Tests.Common/Factories/ContentEditingModelFactory.cs","change-level":"improvement","is-hotspot?":false,"line":39,"what-changed":"MapNames is no longer above the threshold for logical blocks with deeply nested code","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":"fixed"},{"method":"MapNames","why-it-occurs":"Deep nested logic means that you have control structures like if-statements or loops inside other control structures. Deep nested logic increases the cognitive load on the programmer reading the code. The human working memory has a maximum capacity of 3-4 items; beyond that threshold, we struggle with keeping things in our head. Consequently, deep nested logic has a strong correlation to defects and accounts for roughly 20% of all programming mistakes.\n\nCodeScene measures the maximum nesting depth inside each function. The deeper the nesting, the lower the code health. The threshold for the C# language is  levels of nesting.","name":"Deep, Nested Complexity","file":"tests/Umbraco.Tests.Common/Factories/ContentEditingModelFactory.cs","change-level":"improvement","is-hotspot?":false,"line":39,"what-changed":"MapNames is no longer above the threshold for nested complexity depth","how-to-fix":"Occassionally, it's possible to get rid of the nested logic by [Replacing Conditionals with Guard Clauses](https://refactoring.com/catalog/replaceNestedConditionalWithGuardClauses.html).\n\nAnother viable strategy is to identify smaller building blocks inside the nested chunks of logic and extract those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring explains the steps.","change-type":"fixed"},{"name":"Low Cohesion","file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentEditingServiceTests.Create.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 23 to 22, threshold = 3"},{"method":"Cannot_Create_Segment_Variant_Without_Default_Segment","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.Integration/Umbraco.Infrastructure/Services/ContentEditingServiceTests.Create.cs","change-level":"improvement","is-hotspot?":false,"what-changed":"reduced similar code in: Cannot_Create_Segment_Variant_Without_Default_Segment","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":"Lines of Code in a Single File","file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/BlockListElementLevelVariationTests.Editing.cs","change-type":"improved","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"This module has 1298 lines of code (comments stripped away). This puts the module at risk of evolving into a Brain Class. Brain Classes are problematic since changes become more complex over time, harder to test, and challenging to refactor. Act now to prevent future maintenance issues.","how-to-fix":"Look for opportunities to modularize the design. This is done by identifying groups of functions that represent different responsibilities and/or operate on different data. Once you have identified the different responsibilities, then use refactorings like [EXTRACT CLASS](https://refactoring.com/catalog/extractClass.html).","what-changed":"The lines of code decreases from 1303 to 1298, improve code health by reducing it to 1000"},{"method":"AlignedExposeVarianceAsync_Preserves_Segment_When_Assigning_Culture","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.Infrastructure/PropertyEditors/BlockEditorVarianceHandlerTests.cs","change-level":"improvement","is-hotspot?":false,"what-changed":"reduced similar code in: AlignedExposeVarianceAsync_Preserves_Segment_When_Assigning_Culture","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"},{"method":"IsBlockExposed_Returns_False_When_Segment_Does_Not_Match_In_Fallback","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.Infrastructure/PropertyEditors/BlockExposeFallbackHelperTests.cs","change-level":"improvement","is-hotspot?":false,"what-changed":"reduced similar code in: IsBlockExposed_Returns_False_When_Segment_Does_Not_Match_In_Fallback","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"},{"method":"ContentEditingOperationStatusResult","why-it-occurs":"Overly long functions make the code harder to read. The recommended maximum function length for the C# language is 70 lines of code. Severity: Brain Method - Complex Method - Long Method.","name":"Large Method","file":"src/Umbraco.Cms.Api.Management/Controllers/Content/ContentControllerBase.cs","change-level":"improvement","is-hotspot?":false,"line":20,"what-changed":"ContentEditingOperationStatusResult decreases from 93 to 89 lines of code, threshold = 70","how-to-fix":"We recommend to be careful here -- just splitting long functions don't necessarily make the code easier to read. Instead, look for natural chunks inside the functions that expresses a specific task or concern. Often, such concerns are indicated by a Code Comment followed by an if-statement. Use the [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring to encapsulate that concern.","change-type":"improved"}]},"notices":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"external-review-provider":"GitHub"},"analysistime":"2026-06-03T17:22:58.000Z","project-name":"Umbraco-CMS","repository":"https://github.com/umbraco/Umbraco-CMS.git"}}