{"results":{"result":{"added-files":{"code-health":8.48180085765976,"old-code-health":0.0,"files":[{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/context/document-workspace.context.ts","loc":358,"code-health":8.48180085765976}]},"external-review-url":"https://github.com/umbraco/Umbraco-CMS/pull/22869","old-code-health":8.510990924275832,"modified-files":{"code-health":8.510473692745727,"old-code-health":8.510990924275832,"files":[{"file":"src/Umbraco.Web.UI.Client/mocks/db/utils/entity/entity-detail.manager.ts","loc":57,"old-loc":57,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/mocks/mock-manager.ts","loc":84,"old-loc":84,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/mocks/msw-handlers/document/detail.handlers.ts","loc":145,"old-loc":145,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/mocks/tools/sqlite-to-mock/generate-supporting-files.ts","loc":696,"old-loc":696,"code-health":7.146023657980701,"old-code-health":7.146023657980701},{"file":"src/Umbraco.Web.UI.Client/src/libs/observable-api/states/basic-state.ts","loc":36,"old-loc":36,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/libs/observable-api/states/boolean-state.test.ts","loc":101,"old-loc":101,"code-health":9.387218218812514,"old-code-health":9.387218218812514},{"file":"src/Umbraco.Web.UI.Client/src/libs/observable-api/states/class-state.ts","loc":24,"old-loc":24,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/libs/observable-api/states/deep-state.test.ts","loc":90,"old-loc":90,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/libs/observable-api/states/deep-state.ts","loc":69,"old-loc":69,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/content/content/manager/element-data-manager.test.ts","loc":57,"old-loc":57,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/content/content/manager/element-data-manager.ts","loc":86,"old-loc":86,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/content/content/workspace/content-detail-workspace-base.ts","loc":811,"old-loc":811,"code-health":6.500360562541894,"old-code-health":6.500360562541894},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/entity/entity.context.ts","loc":26,"old-loc":26,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/validation/context/validation-messages.manager.test.ts","loc":31,"old-loc":31,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/workspace/entity-detail/entity-detail-workspace-base.ts","loc":327,"old-loc":327,"code-health":9.446570267382697,"old-code-health":9.446570267382697},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/preview/workspace-action-menu-item/preview-option.action.ts","loc":14,"old-loc":14,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/workspace-context/document-publishing.workspace-context.ts","loc":409,"old-loc":409,"code-health":7.610891504250237,"old-code-health":7.610891504250237},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/actions/save.action.ts","loc":66,"old-loc":66,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/conditions/is-not-trashed/document-is-not-trashed.condition.ts","loc":22,"old-loc":22,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/conditions/is-trashed/document-is-trashed.condition.ts","loc":22,"old-loc":22,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/context/document-workspace-context.test-utils.ts","loc":53,"old-loc":53,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/context/document-workspace-crud.context.test.ts","loc":176,"old-loc":176,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/context/document-workspace-property-values.context.test.ts","loc":375,"old-loc":375,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace-editor.element.ts","loc":169,"old-loc":169,"code-health":8.95517096544394,"old-code-health":8.95517096544394},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace-split-view.element.ts","loc":121,"old-loc":121,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.AcceptanceTest/lib/helpers/ContentUiHelper.ts","loc":2526,"old-loc":2526,"code-health":5.734600400779193,"old-code-health":5.734600400779193},{"file":"tests/Umbraco.Tests.AcceptanceTest/lib/helpers/DocumentApiHelper.ts","loc":1563,"old-loc":1563,"code-health":6.210772551850412,"old-code-health":6.210772551850412},{"file":"src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DictionaryRepository.cs","loc":454,"old-loc":454,"code-health":7.552876135642913,"old-code-health":7.552876135642913},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DictionaryRepositoryTest.cs","loc":494,"old-loc":494,"code-health":7.106711345609554,"old-code-health":7.106711345609554},{"file":"src/Umbraco.Web.UI.Client/src/packages/property-editors/color-picker/property-editor-ui-color-picker.element.ts","loc":78,"old-loc":78,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/property-editors/color-picker/property-editor-ui-color-picker.test.ts","loc":64,"old-loc":64,"code-health":9.387218218812514,"old-code-health":9.387218218812514},{"file":"src/Umbraco.Web.UI.Client/mocks/data/sets/kitchen-sink/document.data.ts","loc":2554,"old-loc":2554,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"src/Umbraco.Web.UI.Client/mocks/db/document-blueprint.db.ts","loc":102,"old-loc":102,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/mocks/db/document-publishing.manager.ts","loc":124,"old-loc":124,"code-health":9.096655465156704,"old-code-health":9.096655465156704},{"file":"src/Umbraco.Web.UI.Client/mocks/db/document.db.ts","loc":166,"old-loc":166,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/mocks/tools/sqlite-to-mock/transform-documents.ts","loc":271,"old-loc":271,"code-health":8.515642553342735,"old-code-health":8.515642553342735},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-split-view/workspace-split-view-variant-selector.element.ts","loc":673,"old-loc":673,"code-health":8.387435846290868,"old-code-health":8.387435846290868},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/item/document-collection-item-card.element.ts","loc":222,"old-loc":222,"code-health":9.446570267382697,"old-code-health":9.446570267382697},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/column-layouts/document-table-column-property-value.element.ts","loc":77,"old-loc":77,"code-health":9.554464361611602,"old-code-health":9.554464361611602},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/column-layouts/document-table-column-state.element.ts","loc":55,"old-loc":55,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/item/document-item-data-resolver.ts","loc":200,"old-loc":200,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/modals/shared/document-variant-language-picker.element.ts","loc":176,"old-loc":176,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/pending-changes/document-published-pending-changes.manager.test.ts","loc":197,"old-loc":197,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/publish-with-descendants/modal/document-publish-with-descendants-modal.element.ts","loc":123,"old-loc":123,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/publish/entity-bulk-action/publish.bulk-action.ts","loc":188,"old-loc":188,"code-health":9.220343036510476,"old-code-health":9.220343036510476},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/publish/modal/document-publish-modal.element.ts","loc":115,"old-loc":115,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/schedule-publish/modal/document-schedule-modal.element.ts","loc":403,"old-loc":403,"code-health":9.096655465156704,"old-code-health":9.096655465156704},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/unpublish/modal/document-unpublish-modal.element.ts","loc":172,"old-loc":172,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/utils.ts","loc":9,"old-loc":9,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/search/document-search-result-item.element.ts","loc":138,"old-loc":138,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/url/info-app/document-links-workspace-info-app.element.ts","loc":260,"old-loc":260,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/utils.ts","loc":40,"old-loc":40,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace-split-view-variant-selector.element.ts","loc":58,"old-loc":58,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/views/info/document-workspace-view-info.element.ts","loc":340,"old-loc":340,"code-health":9.663736664415227,"old-code-health":9.663736664415227},{"file":"src/Umbraco.Core/Models/PublishedContent/PublishedValueFallback.cs","loc":348,"old-loc":348,"code-health":6.943153315104789,"old-code-health":6.943153315104789},{"file":"tests/Umbraco.Tests.Integration/Umbraco.Core/PublishedContent/PublishedContentFallbackTests.cs","loc":202,"old-loc":202,"code-health":8.816158827775617,"old-code-health":8.816158827775617},{"file":"tests/Umbraco.Tests.UnitTests/Umbraco.Core/Models/PublishedContent/PublishedValueFallbackTests.cs","loc":83,"old-loc":83,"code-health":9.387218218812514,"old-code-health":9.387218218812514},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/auth/auth.context.ts","loc":475,"old-loc":475,"code-health":8.453365483575062,"old-code-health":8.453365483575062},{"file":"templates/UmbracoExtension/Client/src/entrypoints/entrypoint.ts","loc":18,"old-loc":18,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/web-test-runner.config.mjs","loc":72,"old-loc":72,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/components/table/table.element.ts","loc":435,"old-loc":435,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/workspace/info-app/global-components/workspace-info-app-layout.element.ts","loc":30,"old-loc":30,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/block/block-grid/property-editors/block-grid-layout-stylesheet/property-editor-ui-block-grid-layout-stylesheet.element.ts","loc":85,"old-loc":85,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/block/block-grid/components/block-grid-area-config-entry/block-grid-area-config-entry.element.ts","loc":113,"old-loc":113,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/block/block-grid/components/block-scale-handler/block-scale-handler.element.ts","loc":104,"old-loc":104,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/block/block-grid/property-editors/block-grid-areas-config/property-editor-ui-block-grid-areas-config.element.ts","loc":159,"old-loc":159,"code-health":10.0,"old-code-health":10.0},{"file":"tests/Umbraco.Tests.AcceptanceTest/lib/helpers/UserGroupUiHelper.ts","loc":199,"old-loc":199,"code-health":9.387218218812514,"old-code-health":9.387218218812514},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/modal/component/persistent-modal-dialog.element.ts","loc":27,"old-loc":27,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/modal/component/persistent-modal-dialog.element.test.ts","loc":61,"old-loc":61,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/collection/components/pagination/collection-pagination.element.ts","loc":95,"old-loc":96,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/picker/search/picker-search-result.element.ts","loc":149,"old-loc":150,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/document-redirect-management/dashboard-redirect-management.element.ts","loc":286,"old-loc":289,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/audit-log/info-app/document-history-workspace-info-app.element.ts","loc":175,"old-loc":178,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/log-viewer/workspace/views/search/components/log-viewer-messages-list.element.ts","loc":181,"old-loc":182,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/media/media/audit-log/info-app/media-history-workspace-info-app.element.ts","loc":164,"old-loc":167,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/media/media/modals/media-picker/media-picker-modal.element.ts","loc":630,"old-loc":631,"code-health":9.337097000721485,"old-code-health":9.337097000721485},{"file":"src/Umbraco.Web.UI.Client/src/packages/members/member-group/components/member-group-picker-modal/member-group-picker-modal.element.ts","loc":118,"old-loc":119,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/packages/package-section/views/created/packages-created-overview.element.ts","loc":139,"old-loc":142,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/workspace/relation-type/views/relation-type-detail-workspace-view.element.ts","loc":205,"old-loc":206,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/relations/relations/reference/workspace-info-app/entity-references-workspace-view-info.element.ts","loc":150,"old-loc":154,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/user/current-user/history/current-user-history-user-profile-app.element.ts","loc":110,"old-loc":112,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/components/multiple-text-string-input/input-multiple-text-string-item.element.ts","loc":130,"old-loc":115,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/content/content-type/workspace/views/design/content-type-design-editor-tab.element.ts","loc":294,"old-loc":293,"code-health":10.0,"old-code-health":10.0}]},"removed-files":{"code-health":0.0,"old-code-health":0.0,"files":[]},"external-review-id":"22869","analysis-time":"2026-05-31T19:18:12Z","negative-impact-count":5,"suppressions":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"affected-hotspots":0,"commits":["6201c3dc40fe950803cb77e9950e72d8e755007b","040a0d5e49d2cf8af64ad510eade185f27a0cc4b","aba8e3eb7ae83a3dade1d554fa2d11412f79bb81","3052b57203680b6ff1024158bf9bc3b56f27d080","e4dce93b792659a6b9bd817c79a39e599609658b","bcf9bf3f3a1c858c28a3a3c51acfa0eb02acc36a","9b1fc50de351629e2cd8c725d0bec11c3a2770c4","1baf4e5a5c8fffedf95dd8f5264abe1a26a689ad","2292b7479d421924ab5d8fa0e354c2f104b5f93f","1e59af34ffc0ed42364b73485879011e5d7c5596","1c32829883a22cc28cc5febed207db2412384e75","54ded689e840ecd01c43f72f1d22eb1670de1a99","93a1f82b05a155f03fac34e9cb2bbd25e41bd630","ff565b95e0bc384b7f3203a1ad7337912a6319b2","39125da978fe105dd9eedab42601a1f6f83a16a7","80cc752b3d1dc3d864d0c61a32befafa56b3fe48","396497a921caa2dd58bef330bccbfdae33f73169","1a74aa53c9e5af4c5f869d07fad3b0c1662f883a","4fab629ee35c2ffc89b124990b27caa60fb57a09","7248f012921bba5cbd2a86e718314ea31840a69e","072e362284468dc06b7f4808c1de6fda68e01329","dff3941e1f3d0780c4dfb91c91d41d2caaeecebc","80098706cff99538b2c68251baa370e31caf59d4","11ff2c80392f5b61f450cccc511ec82b7c376b40","c813481b4e088886cc75f8205b65c6efcad982a3","3142691e4f11c9fcfe6d2686318d628201b081bc","275a31a47755533203248f04379a75285c89f5bd","68e2bb98f92b6697b37494c654c798d0d38501e0","aca3a3cfc25c730386c5837aa3a5bf24b25d3fae","7f38ebf73b5717c36c02de9ad38ca344eee39b5e","dd461c1e35431eb36648f09b9c8a0f5828d2f2b6","f6ac750d099fb4793c6ef9b516db2f1dc430511e","4eecad5c893c575f17b3d1ccd7158e2bbc45e610","fe526e069b62474c87d5ad253592d1a6bebb2b07","553e1ebee4f4dd172537fcec1edf947309be6dbd","80ff32502217623d386ce032cd91d218188225f6","2580f00112fe5c371952148b973acf8c29e6cedf","dad5d20428c6b15e297f906febdaa6df80c1d216","50c5f95279265da7d569960876815947a521febb","18b0e6b6be8c233fa88b77d28ebd2067322902ed","23d821ca705ae23e6d7017cf97707dcfb7788749","e2c33737037cf9c55011d5432c6199d9d0c3efe4","20bc6c74f58cc78e77878d696b513ce827fdcb29","8b71253b7034eac2df2d75a4a85c31cd72b22bfc","734e5c1a59ab53ba9f9ccefd83f0c57ed3aacd1f","ae2f389ff251be92d07e355dd30b3f182ed50cf6","c44dacf59eb8d4bb94a3ec10ca4bb6702370b733","7519160beb43336cc8bd48700945952b866f4da5","14c974bf6373e27e568dafea2a6d7169ccafafbc","b04dc88c60a7f5b2d1c3d2d29e4857e8bf5656bb","238ebbd44980d45d72bed8ddc7934c62a5af7ff2","ad869cea44ab4ab4e8ce03d34ccd46449194184c","1c999a41ecdd8ff41e336154fd874dcab39b1013","9502085df27e24918a9f77877d4d1f2c9f6aeb4f","96d789fa1c6f25e8f25c52622c1dba1ee41ed8e5","72a89e9d770fdf3675fc30028c38aa0f3f428fd0"],"is-negative-review":true,"negative-findings":{"number-of-types":4,"number-of-files-touched":1,"findings":[{"method":"UmbDocumentWorkspaceContext.handleSaveAndPreview","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the TypeScript language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/context/document-workspace.context.ts","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":"typescript","improvement-type":"Complex Method"}],"change-level":"warning","is-hotspot?":false,"line":301,"what-changed":"UmbDocumentWorkspaceContext.handleSaveAndPreview has a cyclomatic complexity of 13, 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":"introduced"},{"method":"UmbDocumentWorkspaceContext.constructor","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the TypeScript language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/context/document-workspace.context.ts","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":"typescript","improvement-type":"Complex Method"}],"change-level":"warning","is-hotspot?":false,"line":73,"what-changed":"UmbDocumentWorkspaceContext.constructor has a cyclomatic complexity of 13, 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":"introduced"},{"method":"UmbDocumentWorkspaceContext.handleSaveAndPreview","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.Web.UI.Client/src/packages/documents/documents/workspace/context/document-workspace.context.ts","refactoring-examples":[{"diff":"diff --git a/complex_conditional.js b/complex_conditional.js\nindex c43da09584..94259ce874 100644\n--- a/complex_conditional.js\n+++ b/complex_conditional.js\n@@ -1,16 +1,34 @@\n function messageReceived(message, timeReceived) {\n-   // Ignore all messages which aren't from known customers:\n-   if (!message.sender &&\n-       customers.getId(message.name) == null) {\n+   // Refactoring #1: encapsulate the business rule in a\n+   // function. A clear name replaces the need for the comment:\n+   if (!knownCustomer(message)) {\n      log('spam received -- ignoring');\n      return;\n    }\n \n-  // Provide an auto-reply when outside business hours:\n-  if ((timeReceived.getHours() > 17) ||\n-      (timeReceived.getHours() < 8)) {\n+  // Refactoring #2: encapsulate the business rule.\n+  // Again, note how a clear function name replaces the\n+  // need for a code comment:\n+  if (outsideBusinessHours(timeReceived)) {\n     return autoReplyTo(message);\n   }\n \n   pingAgentFor(message);\n+}\n+\n+function outsideBusinessHours(timeReceived) {\n+  // Refactoring #3: replace magic numbers with\n+  // symbols that communicate with the code reader:\n+  const closingHour = 17;\n+  const openingHour = 8;\n+\n+  const hours = timeReceived.getHours();\n+\n+  // Refactoring #4: simple conditional rules can\n+  // be further clarified by introducing a variable:\n+  const afterClosing = hours > closingHour;\n+  const beforeOpening = hours < openingHour;\n+\n+  // Yeah -- look how clear the business rule is now!\n+  return afterClosing || beforeOpening;\n }\n\\ No newline at end of file\n","language":"typescript","improvement-type":"Complex Conditional"}],"change-level":"warning","is-hotspot?":false,"line":329,"what-changed":"UmbDocumentWorkspaceContext.handleSaveAndPreview has 1 complex conditionals with 2 branches, threshold = 2","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":"introduced"},{"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, 61 % of all functions have primitive types as arguments.","name":"Primitive Obsession","file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/context/document-workspace.context.ts","refactoring-examples":[{"diff":"diff --git a/primitive-obsession.ts b/primitive-obsession.ts\nindex 38bae186cc..24116eddcc 100644\n--- a/primitive-obsession.ts\n+++ b/primitive-obsession.ts\n@@ -1,8 +1,8 @@\n-// Problem: It's hard to know what this function does, and what values are valid as parameters.\n-function getPopularRepositories(String baseURL, String query, Integer pages, Integer pageSize, String sortorder): Json {\n-\tlet pages == null ? 10 : pages\n-\tlet pageSize == null ? 10 : pageSize\n-  return httpClient.get(`${baseURL}?q=${query}&pages=${pages}&pageSize=${pageSize}&sortorder=${sortorder}`)\n+// Refactoring: extract the pagination & API logic into a class, and it will\n+// attract validation and other logic related to the specific query. It's now\n+// easier to use and to maintain the getPopularRepositories function!\n+function getPopularRepositories(query: PaginatedRepoQuery): Json {\n+  return httpClient.get(query.getURL())\n     .map(json => json.repositories)\n     .filter(repository => repositry.stargazersCount > 1000)\n }\n","language":"typescript","improvement-type":"Primitive Obsession"}],"change-level":"warning","is-hotspot?":false,"what-changed":"In this module, 61.1% of all function arguments are primitive types, threshold = 30.0%","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`.","change-type":"introduced"},{"why-it-occurs":"String is a generic type that fail to capture the constraints of the domain object it represents. In this module, 50 % of all function arguments are string types.","name":"String Heavy Function Arguments","file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/context/document-workspace.context.ts","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"what-changed":"In this module, 50.0% of all arguments to its 17 functions are strings. The threshold for string arguments is 39.0%","how-to-fix":"Heavy string usage indicates a missing domain language. Introduce data types that encapsulate the semantics. For example, a user_name is better represented as a constrained User type rather than a pure string, which could be anything.","change-type":"introduced"}]},"positive-impact-count":0,"repo":"Umbraco-CMS","code-health":8.509996345509828,"version":"3.0","authors":["Mads Rasmussen","Niels Lyngsø","Andreas Zerbst","Andy Butland","Jacob Overgaard","Lee Kelleher","leekelleher"],"directives":{"added":[],"removed":[]},"positive-findings":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"notices":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"external-review-provider":"GitHub"},"analysistime":"2026-05-31T19:18:11.000Z","project-name":"Umbraco-CMS","repository":"https://github.com/umbraco/Umbraco-CMS.git"}}