{"results":{"result":{"added-files":{"code-health":9.720877917323122,"old-code-health":0.0,"files":[{"file":"src/Paramore.Brighter.Transformers.JustSaying/JustSayingAttribute.cs","loc":24,"code-health":10.0},{"file":"src/Paramore.Brighter.Transformers.JustSaying/JustSayingMessageMapper.cs","loc":158,"code-health":10.0},{"file":"src/Paramore.Brighter.Transformers.JustSaying/JustSayingTransform.cs","loc":208,"code-health":9.387218218812514},{"file":"src/Paramore.Brighter.Transformers.JustSaying/JustSayingCommand.cs","loc":25,"code-health":10.0},{"file":"src/Paramore.Brighter.Transformers.JustSaying/JustSayingEvent.cs","loc":25,"code-health":10.0},{"file":"src/Paramore.Brighter.Transformers.MassTransit/MassTransitMessageEnvelop.cs","loc":50,"code-health":10.0},{"file":"src/Paramore.Brighter.Transformers.MassTransit/MassTransitTransform.cs","loc":178,"code-health":9.842730062691357},{"file":"src/Paramore.Brighter.Transformers.MassTransit/MassTransitMessageMapper.cs","loc":167,"code-health":9.387218218812514},{"file":"src/Paramore.Brighter.Transformers.MassTransit/MassTransitUnwrapAttribute.cs","loc":10,"code-health":10.0},{"file":"src/Paramore.Brighter.Transformers.MassTransit/MassTransitWrapAttribute.cs","loc":19,"code-health":10.0},{"file":"src/Paramore.Brighter.Transformers.JustSaying/Extensions/JsonNodeExtensions.cs","loc":44,"code-health":10.0},{"file":"src/Paramore.Brighter.Transformers.JustSaying/Extensions/RequestContextExtensions.cs","loc":46,"code-health":9.387218218812514},{"file":"src/Paramore.Brighter.Transformers.JustSaying/JsonConverters/IpAddressConverter.cs","loc":21,"code-health":10.0},{"file":"src/Paramore.Brighter.Transformers.JustSaying/JsonConverters/RegisterConverters.cs","loc":27,"code-health":10.0},{"file":"src/Paramore.Brighter.Transformers.JustSaying/JsonConverters/TenantConverter.cs","loc":27,"code-health":10.0},{"file":"src/Paramore.Brighter.Transformers.MassTransit/Extensions/RequestContextExtensions.cs","loc":38,"code-health":9.6882083290695}]},"external-review-url":"https://github.com/BrighterCommand/Brighter/pull/3634","old-code-health":8.653410486783194,"modified-files":{"code-health":8.656161420915724,"old-code-health":8.653410486783194,"files":[{"file":"src/Paramore.Brighter.MessagingGateway.Kafka/KafkaMessageCreator.cs","loc":370,"old-loc":377,"code-health":8.413528317237752,"old-code-health":8.413528317237752},{"file":"src/Paramore.Brighter.MessagingGateway.RMQ.Async/RmqMessageCreator.cs","loc":334,"old-loc":331,"code-health":8.283981080161325,"old-code-health":8.283981080161325},{"file":"src/Paramore.Brighter.MessagingGateway.RMQ.Sync/RmqMessageCreator.cs","loc":332,"old-loc":329,"code-health":8.283981080161325,"old-code-health":8.283981080161325},{"file":"src/Paramore.Brighter.MessagingGateway.Redis/RedisMessageCreator.cs","loc":289,"old-loc":291,"code-health":8.77219002921793,"old-code-health":8.747566364082143},{"file":"src/Paramore.Brighter/Id.cs","loc":28,"old-loc":27,"code-health":10.0,"old-code-health":10.0},{"file":"src/Paramore.Brighter/Message.cs","loc":119,"old-loc":119,"code-health":10.0,"old-code-health":10.0},{"file":"src/Paramore.Brighter.MessagingGateway.AWS.V4/SqsInlineMessageCreator.cs","loc":318,"old-loc":318,"code-health":8.932764012392138,"old-code-health":8.932764012392138},{"file":"src/Paramore.Brighter.MessagingGateway.AWS.V4/SqsMessageCreator.cs","loc":312,"old-loc":311,"code-health":8.545379580978913,"old-code-health":8.545379580978913},{"file":"src/Paramore.Brighter.MessagingGateway.AWSSQS/SqsInlineMessageCreator.cs","loc":318,"old-loc":318,"code-health":8.932764012392138,"old-code-health":8.932764012392138},{"file":"src/Paramore.Brighter.MessagingGateway.AWSSQS/SqsMessageCreator.cs","loc":314,"old-loc":313,"code-health":8.545379580978913,"old-code-health":8.545379580978913}]},"removed-files":{"code-health":0.0,"old-code-health":0.0,"files":[]},"external-review-id":"3634","analysis-time":"2025-07-17T10:45:19Z","negative-impact-count":6,"suppressions":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"affected-hotspots":3,"commits":["2e64884f81ce08542ef48d6a9093a510f8c0684f","323fbc9b234f11c582ab8e2c0d0a2040de94c9da","c5e2c4c138cbe79a123310c60698846f295741ca","9500ba771fe03297c7b8d05947d0d117d54a3cfa","df5bafb26c24dc82e12f29664acba52b5e8e11b0","e63dafac20a6e4d9cf9dc5c9f2c57c555a2dff4d","584f2217d9de154ed321756a1dab132c6036daf7","d9eaea9e4dbeb60c6a5a2993e1affc6a268d8336","b1eee3e8b472b9ebb707d82c91b25254f98c5537","4e4348505070e78228d8d2320ad299e5b5ee11b0","c4704ed4bc3834dc5244cadf54ceccc321f044ba","4eb8fe70e9b54b06ebef68ea9d1b2be13f144223","d0b849399c843ae7974ad7309f6cbdf3616bef5e","387a606ecfc1ec30f06678b9d71ea935e2a97ab3","ad4bf9184c202199f567faa4a5d5a565e9325704","0d3abf206bbc50040774a6d3af3b95005b309bf9","097fa010266e892396237423c96476a8ad8e0187","9134298de300d8a696fc15afe9f4433583fc7504","fa21b6a35615bc2a64b41561a2914a143484c663","96dcf47ad39269fda8aa5d4403dbb5f2505f9a2d","ce4992c457f2328ab7d68fb0021d244a6063f214","5cd5f4268d1d5bacabee5a38f3d51d0e651d5f36","fb563435041d82d143da7ca36f29f2bf237fe2a4","4841686bebcff18fa2a2349b9f28cf04b5548693"],"is-negative-review":true,"negative-findings":{"number-of-types":3,"number-of-files-touched":5,"findings":[{"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":"src/Paramore.Brighter.Transformers.JustSaying/JustSayingTransform.cs","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":225,"what-changed":"The module contains 2 functions with similar structure: GetTenant,GetVersion","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":"introduced"},{"method":"Unwrap","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/Paramore.Brighter.Transformers.MassTransit/MassTransitTransform.cs","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":186,"what-changed":"Unwrap has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block 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"},{"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":"src/Paramore.Brighter.Transformers.MassTransit/MassTransitMessageMapper.cs","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":125,"what-changed":"The module contains 4 functions with similar structure: GetDestinationAddress,GetFaultAddress,GetResponseAddress,GetSourceAddress","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":"introduced"},{"method":"GetFromBag","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/Paramore.Brighter.Transformers.JustSaying/Extensions/RequestContextExtensions.cs","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":"c#","improvement-type":"Complex Conditional"}],"change-level":"warning","is-hotspot?":false,"line":20,"what-changed":"GetFromBag 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":"GetUriFromBag","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/Paramore.Brighter.Transformers.JustSaying/Extensions/RequestContextExtensions.cs","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":"c#","improvement-type":"Complex Conditional"}],"change-level":"warning","is-hotspot?":false,"line":35,"what-changed":"GetUriFromBag 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":"GetUriFromBag","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/Paramore.Brighter.Transformers.MassTransit/Extensions/RequestContextExtensions.cs","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":"c#","improvement-type":"Complex Conditional"}],"change-level":"warning","is-hotspot?":false,"line":24,"what-changed":"GetUriFromBag 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"}]},"positive-impact-count":1,"repo":"Brighter","code-health":8.955043952267129,"version":"3.0","authors":["Rafael Andrade","Rafael Lillo"],"directives":{"added":[],"removed":[]},"positive-findings":{"number-of-types":1,"number-of-files-touched":1,"findings":[{"method":"ReadHeader","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/Paramore.Brighter.MessagingGateway.Redis/RedisMessageCreator.cs","change-level":"improvement","is-hotspot?":false,"line":145,"what-changed":"ReadHeader decreases in cyclomatic complexity from 15 to 14, 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"}]},"notices":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"external-review-provider":"GitHub"},"analysistime":"2025-07-17T10:45:19.000Z","project-name":"Brighter","repository":"https://github.com/BrighterCommand/Brighter.git"}}