{"results":{"result":{"added-files":{"code-health":0.0,"old-code-health":0.0,"files":[]},"external-review-url":"https://github.com/pytroll/satpy/pull/3397","old-code-health":7.988298086251724,"modified-files":{"code-health":7.915234266081244,"old-code-health":7.988298086251724,"files":[{"file":"satpy/modifiers/angles.py","loc":492,"old-loc":456,"code-health":9.387218218812514,"old-code-health":9.6882083290695},{"file":"satpy/modifiers/geometry.py","loc":182,"old-loc":140,"code-health":10.0,"old-code-health":9.387218218812514},{"file":"satpy/utils.py","loc":685,"old-loc":712,"code-health":7.047147714384096,"old-code-health":7.047147714384096},{"file":"satpy/tests/test_modifiers.py","loc":587,"old-loc":493,"code-health":8.283981080161325,"old-code-health":9.096655465156704},{"file":"satpy/composites/spectral.py","loc":165,"old-loc":165,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"satpy/modifiers/atmosphere.py","loc":138,"old-loc":138,"code-health":10.0,"old-code-health":10.0},{"file":"satpy/scene.py","loc":1365,"old-loc":1365,"code-health":6.958679722533031,"old-code-health":6.958679722533031}]},"removed-files":{"code-health":0.0,"old-code-health":0.0,"files":[]},"external-review-id":"3397","analysis-time":"2026-06-03T14:07:27Z","negative-impact-count":2,"suppressions":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"affected-hotspots":2,"commits":["29587e5e4bfec8329de12e46479ba4f59686737f","f41db09e328f185e965b9063b58e24435d1eb77c","0cf0f7f743e8713e1d09dd742774e8ddc872bc18","0219e057d43d46459a6a038ba856b86954a92c87","9ba3952246e674848e7a65a0aaaf4a7f87d4312f","b77e52cdb179e06e9642a7573ba913ecf385f8c3","6ac410c84008491e13593d89cef6b93fcf3956e3","b8cfe96a7c158c8bba643c86c6423e3f3d551530","e9d1398f0227cfe6ca3e7b4a57a3c622d1bf43a0","6da9aebb199b2af77d7fc01c0e396277bf54972f","4cfff677b5da982e3fc43276ff7a713fcb064854","df6ca46173e2eedfb7f8791d7ec2ef70f59dfc52","157dfda8e64ca6b0f1f13f549a84849d1730d8c5","402488e975111af9c26fef2bae0acaea151403d9","16541047433a182d0522d5d475b95bce148c3b57","e060df04e4d46cdb95de0d49fa1925b7786d2850","7db07fee730645c97c039717804a6d262967e02a","8977287453599482289d5cf67f96f5627563f42f","feb958f26317540c371e0674760a059d9c1fc56b","afc345ff1f5b1b478d18f7419249bbfa35cac537","d72c4c9fa3c60aa76cc7f67f0ce88131a8b121b4","be37d098b9a760f01d068bbc95c8e60197aabacb","384a9df6174465e8cb242ed61efc87d8cbca3f2e","400fd5380e96b2371d7f6ba96be388d0a82299a6","5b294b25a3f309e70df32ff38ded706f0e408cde","854f0adf4066007f26b0ab2689d86add7446e4a6","019a2e8a0711ff994233128b42c78c3e5d73d683","7b88b02136aecd83c08f6d72d470cb2ec30d49fb","53b03350074584f975a34d185a9942290bcf87bc","7091e4f492aef4799762fc87e3140e9bc8e47cae","aa95b4299ca2172ee4f102d08a167357e2efcef6","fca4a32f60da3b0ce4dc851d5d0ff98c5312ece0","64bf5f117a2a7697ffa40506e4fd7a329324d002","92bf353789c3f601305b55a4275ca266218520fa","05d20e185908b6bfb6c231cb3f8675c0a234fa32","f2053c028f26add5575019f4a7c9bb63736eed5b","db357c01d4fed7c5abe8024133615e5dd047b7b6","51fb5c233fded7a9264c5be5b84f0fc5d172b857","6d9ce8a7458d58296476479ca1ffab0f08835932","292ab5457f40e2fc899e98f29ce7a8febd750829","ee8161bbbfb2b1b902fca6b3c1ee193dcab23864","1e20f11f4c45552c60e5ebcc8db6ccfe13988088","f3b605debaf3e94a74c6750408e508181b8f6e65","83dec7b1e972b9e42e409daebca8093d43cbf3b7","4628c1c4b2212acc73f2ce31d0e76eebb9b70cb4","0c342a1a8f1d10bdabe9bed2dd46eb9eafb3320c","466d0bcb3db000ffffca19ecc49b42dd52eb712c","e8e8853bb19d443d894de96ca5a50fea5875e43b","af7a080a440edb841ea54bffea067746dd39fd34"],"is-negative-review":true,"negative-findings":{"number-of-types":2,"number-of-files-touched":2,"findings":[{"method":"sunzen_corr_cos","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the Python language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"satpy/modifiers/angles.py","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":"python","improvement-type":"Complex Method"}],"change-level":"warning","is-hotspot?":false,"line":537,"what-changed":"sunzen_corr_cos has a cyclomatic complexity of 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":"introduced"},{"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.","name":"Low Cohesion","file":"satpy/tests/test_modifiers.py","refactoring-examples":[{"diff":"diff --git a/low_cohesion_example.js b/low_cohesion_example.js\nindex 1ae56cf85b..209fc02c73 100644\n--- a/low_cohesion_example.js\n+++ b/low_cohesion_example.js\n@@ -2,8 +2,10 @@\n \n var userLayer = connectUsers(myConnectionProperties);\n \n-var chessEngine = startEngine(gameProperties);\n+// [Refactoring: moved the data related to chess to a new chessGame.js module]\n \n+// The module contains login related functionality that forms one behaviour: all\n+// code is related since it either a) uses the same data, or b) calls the same functions.\n export function login(newUser) {\n   val authenticated = userLayer.authenticate(newUser);\n   traceLoginFor(authenticated);\n@@ -19,11 +21,6 @@ function traceLogin(user) {\n    // ...some code...\n }\n \n-// playChess seems like a very unrelated responsibility.\n-// Should it really be within the same module?\n-\n-export function playChess(loggedInUser) {\n-   var board = chessEngine.newBoard();\n-\n-   return newGameOn(board, loggedInUser);\n-}\n+// [Refactoring: moved playChess to a new chessGame.js module\n+// As a result of this refactoring, the module maintains a\n+// single behavior where all code and data is related: high cohesion.]\n","language":"python","improvement-type":"Low Cohesion"}],"change-level":"warning","is-hotspot?":false,"what-changed":"This module has at least 12 different responsibilities amongst its 41 functions, threshold = 4","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).","change-type":"introduced"}]},"positive-impact-count":5,"repo":"satpy","code-health":7.915234266081244,"version":"3.0","authors":["Johan Strandgren"],"directives":{"added":[],"removed":[]},"positive-findings":{"number-of-types":4,"number-of-files-touched":4,"findings":[{"method":"_sunzen_reduction_ndarray","why-it-occurs":"Functions with many arguments indicate either a) low cohesion where the function has too many responsibilities, or b) a missing abstraction that encapsulates those arguments.\n\nThe threshold for the Python language is 4 function arguments.","name":"Excess Number of Function Arguments","file":"satpy/modifiers/angles.py","change-level":"improvement","is-hotspot?":false,"line":596,"what-changed":"_sunzen_reduction_ndarray is no longer above the threshold for number of arguments","how-to-fix":"Start by investigating the responsibilities of the function. Make sure it doesn't do too many things, in which case it should be split into smaller and more cohesive functions. Consider the refactoring [INTRODUCE PARAMETER OBJECT](https://refactoring.com/catalog/introduceParameterObject.html) to encapsulate arguments that refer to the same logical concept.","change-type":"fixed"},{"name":"Code Duplication","file":"satpy/modifiers/geometry.py","change-type":"fixed","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Duplicated code often leads to code that's harder to change since the same logical change has to be done in multiple functions. More duplication gives lower code health.","how-to-fix":"A certain degree of duplicated code might be acceptable. The problems start when it is the same behavior that is duplicated across the functions in the module, ie. a violation of the Don't Repeat Yourself (DRY) principle. DRY violations lead to code that is changed together in predictable patterns, which is both expensive and risky. DRY violations can be identified using CodeScene's X-Ray analysis to detect clusters of change coupled functions with high code similarity. [Read More](https://codescene.com/blog/software-revolution-part3/)\n\nOnce you have identified the similarities across functions, look to extract and encapsulate the concept that varies into its own function(s). These shared abstractions can then be re-used, which minimizes the amount of duplication and simplifies change.","what-changed":"The module no longer contains too many functions with similar structure"},{"name":"Lines of Code in a Single File","file":"satpy/utils.py","change-type":"improved","change-level":"improvement","is-hotspot?":true,"why-it-occurs":"This module has 651 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 678 to 651, improve code health by reducing it to 600"},{"name":"Low Cohesion","file":"satpy/utils.py","change-type":"improved","change-level":"improvement","is-hotspot?":true,"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 24 to 23, threshold = 4"},{"name":"Code Duplication","file":"satpy/tests/test_modifiers.py","change-type":"fixed","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Duplicated code often leads to code that's harder to change since the same logical change has to be done in multiple functions. More duplication gives lower code health.","how-to-fix":"A certain degree of duplicated code might be acceptable. The problems start when it is the same behavior that is duplicated across the functions in the module, ie. a violation of the Don't Repeat Yourself (DRY) principle. DRY violations lead to code that is changed together in predictable patterns, which is both expensive and risky. DRY violations can be identified using CodeScene's X-Ray analysis to detect clusters of change coupled functions with high code similarity. [Read More](https://codescene.com/blog/software-revolution-part3/)\n\nOnce you have identified the similarities across functions, look to extract and encapsulate the concept that varies into its own function(s). These shared abstractions can then be re-used, which minimizes the amount of duplication and simplifies change.","what-changed":"The module no longer contains too many functions with similar structure"}]},"notices":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"external-review-provider":"GitHub"},"analysistime":"2026-06-03T14:07:27.000Z","project-name":"satpy","repository":"https://github.com/pytroll/satpy.git"}}