{"results":{"result":{"added-files":{"code-health":9.811213903030838,"old-code-health":0.0,"files":[{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/item/document-grid-collection-card.element.ts","loc":150,"code-health":9.500346130021617},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/collection/item/entity-collection-item-ref/default-collection-item-ref.element.ts","loc":55,"code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/collection/item/entity-collection-item-ref/entity-collection-item-ref.element.ts","loc":34,"code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/collection/item/umb-entity-collection-item-element-base.element.ts","loc":158,"code-health":10.0}]},"external-review-url":"https://github.com/umbraco/Umbraco-CMS/pull/20994","old-code-health":10.0,"modified-files":{"code-health":9.93894079777611,"old-code-health":10.0,"files":[{"file":"src/Umbraco.Web.UI.Client/src/packages/core/collection/item/entity-collection-item-card/default-collection-item-card.element.ts","loc":57,"old-loc":56,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/collection/item/entity-collection-item-card/entity-collection-item-card.element.ts","loc":34,"old-loc":173,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/user/user/collection/item/user-collection-item-card.element.ts","loc":141,"old-loc":140,"code-health":9.6882083290695,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/user/user/collection/views/grid/user-grid-collection-view.element.ts","loc":83,"old-loc":83,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/item/document-collection-item-card.element.ts","loc":73,"old-loc":70,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/grid/document-grid-collection-view.element.ts","loc":101,"old-loc":101,"code-health":10.0,"old-code-health":10.0},{"file":"src/Umbraco.Web.UI.Client/src/packages/core/entity-item/entity-item-ref/entity-item-ref.element.ts","loc":231,"old-loc":231,"code-health":10.0,"old-code-health":10.0}]},"removed-files":{"code-health":0.0,"old-code-health":0.0,"files":[]},"external-review-id":"20994","analysis-time":"2025-12-02T11:49:13Z","negative-impact-count":2,"suppressions":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"affected-hotspots":0,"commits":["cc1c99bf62f63b187eb9902a13174a7df07c8f53","852a9d74d772dee08b5b1352f727027d78640aaf","0dc90ad5834847ea9db3eef81a4a766f4d87601a","8c047e0ccfec1ddcfd77583edda2fdc2494ed345","f06d5941c3bef1a5b2bd65c459860b3d5d7abc2a","df1219a7211cb73fdf96580a81d30f69b941aab0","0f59c3ec0d5fe84a75e0610520244adbdf17c134","2aefe5efaafadf97ee1192df97974fd8314dba59","37b9df4f0e57a5de5c006c68c28294a73518ab05","3dbe65abc04e0924f4e75f75174c2b263ef169d4","88654035f9d417ef6e4ec3232b176616ee2115fe","5c4b2b886413fe8327995a03a9ca3567e69224d1","4450ae9aa3e0d7c6b62ecac35e54c93e247d6ecc","e98822eaa4a056d3738132305e04650c066ebf0b","c29817b0691d4494caf58fb4891cec6af534bb3e","51f5bfc97399f0f79a6d4b140bc1aecb32327f3e","801f4d6db1e053ca464b85cee07f8b7a391935ad","d6b1caa710133bc1dabf77a3635d7c35e945a87f","3e1063ca28031cca839f207bb2805b4a6c6a3331","77e6aea09f727338481625d9c6bb29c6ecb78b3c","77000cf9a9ea4fe92d7466f58d30018652f6f935","3b0eb73d6f8eeac0e53def91ac3364b87a302f3d","4902698df0ea78b58c9ccf2179e5954b18a7aeed","542d6794309782dbcf6174f1ca9cbba8ea3bc4f9","d1b498f233d0bbb2012133b942b4cf1629433b19","06d6cd480fe844da118c9edcd19d1fa4299f0fb1"],"is-negative-review":true,"negative-findings":{"number-of-types":2,"number-of-files-touched":2,"findings":[{"method":"UmbUserCollectionItemCardElement.loadUserGroups","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/user/user/collection/item/user-collection-item-card.element.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":54,"what-changed":"UmbUserCollectionItemCardElement.loadUserGroups 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"},{"method":"UmbDocumentGridCollectionCardElement.getPropertyValueByAlias","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/collection/item/document-grid-collection-card.element.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":48,"what-changed":"UmbDocumentGridCollectionCardElement.getPropertyValueByAlias has a cyclomatic complexity of 18, 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"}]},"positive-impact-count":0,"repo":"Umbraco-CMS","code-health":9.893544578247127,"version":"3.0","authors":["Mads Rasmussen"],"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":"2025-12-02T11:49:12.000Z","project-name":"Umbraco-CMS","repository":"https://github.com/umbraco/Umbraco-CMS.git"}}