{"results":{"result":{"added-files":{"code-health":9.264785835995047,"old-code-health":0.0,"files":[{"file":"satpy/writers/core/utils.py","loc":23,"code-health":10.0},{"file":"satpy/tests/writer_tests/test_utils.py","loc":36,"code-health":10.0},{"file":"satpy/tests/modifier_tests/test_atmosphere.py","loc":258,"code-health":9.096655465156704}]},"external-review-url":"https://github.com/pytroll/satpy/pull/3168","old-code-health":8.601033475751677,"modified-files":{"code-health":8.67956791729288,"old-code-health":8.601033475751677,"files":[{"file":"satpy/readers/seviri_l1b_hrit.py","loc":673,"old-loc":654,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"satpy/tests/reader_tests/test_seviri_l1b_hrit.py","loc":562,"old-loc":541,"code-health":8.816158827775617,"old-code-health":8.816158827775617},{"file":"satpy/readers/core/seviri.py","loc":923,"old-loc":899,"code-health":8.545379580978913,"old-code-health":8.545379580978913},{"file":"satpy/tests/test_resample.py","loc":600,"old-loc":562,"code-health":7.106711345609554,"old-code-health":7.106711345609554},{"file":"satpy/scene.py","loc":1419,"old-loc":1365,"code-health":7.260186037714746,"old-code-health":6.958679722533031},{"file":"satpy/tests/writer_tests/test_ninjogeotiff.py","loc":871,"old-loc":810,"code-health":7.788037646779413,"old-code-health":7.788037646779413},{"file":"satpy/writers/ninjogeotiff.py","loc":449,"old-loc":430,"code-health":8.613255631989354,"old-code-health":8.64715266104035},{"file":"satpy/writers/core/image.py","loc":113,"old-loc":117,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"satpy/writers/cf_writer.py","loc":308,"old-loc":305,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"satpy/writers/core/base.py","loc":211,"old-loc":198,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"satpy/writers/geotiff.py","loc":256,"old-loc":251,"code-health":8.389519860170278,"old-code-health":8.413005565745468},{"file":"satpy/writers/simple_image.py","loc":59,"old-loc":54,"code-health":9.6882083290695,"old-code-health":10.0},{"file":"satpy/tests/compositor_tests/test_core.py","loc":496,"old-loc":405,"code-health":10.0,"old-code-health":9.387218218812514},{"file":"satpy/composites/core.py","loc":473,"old-loc":421,"code-health":9.6882083290695,"old-code-health":10.0},{"file":"satpy/modifiers/geometry.py","loc":141,"old-loc":140,"code-health":9.387218218812514,"old-code-health":9.387218218812514},{"file":"satpy/tests/test_modifiers.py","loc":350,"old-loc":493,"code-health":9.387218218812514,"old-code-health":9.096655465156704},{"file":"satpy/composites/fill.py","loc":333,"old-loc":328,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"satpy/tests/compositor_tests/test_fill.py","loc":356,"old-loc":304,"code-health":8.816158827775617,"old-code-health":8.816158827775617},{"file":"satpy/tests/compositor_tests/test_moved_compositors.py","loc":47,"old-loc":48,"code-health":10.0,"old-code-health":10.0},{"file":"satpy/cf/decoding.py","loc":70,"old-loc":42,"code-health":10.0,"old-code-health":10.0},{"file":"satpy/tests/cf_tests/test_decoding.py","loc":56,"old-loc":39,"code-health":10.0,"old-code-health":10.0},{"file":"satpy/modifiers/atmosphere.py","loc":139,"old-loc":138,"code-health":10.0,"old-code-health":10.0},{"file":"satpy/composites/arithmetic.py","loc":47,"old-loc":44,"code-health":10.0,"old-code-health":10.0},{"file":"satpy/tests/compositor_tests/test_arithmetic.py","loc":130,"old-loc":87,"code-health":10.0,"old-code-health":10.0}]},"removed-files":{"code-health":0.0,"old-code-health":0.0,"files":[]},"external-review-id":"3168","analysis-time":"2026-04-08T13:29:49Z","negative-impact-count":6,"suppressions":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"affected-hotspots":1,"commits":["69004f3e5c8a1892d7684fd097d4ae472b37354e","46a14f4987ad1abef496e8024fb00cbad86ed6f7","505e1f3c084c39747ea4ea12200c645ec9d1f596","d6259c92ac04f8ea8606707998ef0092c6e6ebca","7ff58241ee0b2fab03a7a86ba98c0f1429fd3fdd","fc0f2f5ee7606f780ea2098a022bbd205acc7b31","c4866fd19dca0767a45e8a692aee12b8436c58fa","59f23b86728a908d1321aaf864416e3d6e74c6ee","2f177a39aa6f7098871d0144bb1c4aaf8775d8b6","b4e68c6a9fa21e77d065d732f2b9373e688a7bfd","329dab5489adf9dfa0b170be3cd16acc52f1674d","ca2c263a06b027fdc5e80c996552183d722a5d62","d2dd40cb5298b18de6d35df6d88fce5772de5690","ccbab5efab793df1a28c1763918178d3d09f90b9","b77d8b94144df903f6a3040da9afae8d7d45cd12","2d8d8835eb1dcf3017c415e858cc03b8f0e7e5fe","e635b7bb7459b42d051a388fce137b5e836fb412","5b1db64476b9b2548f1a9d1639aaf03683d31f49","b866941b715628a6485685ac6fd1cbbd3e9c8406","2aa3a436012ff885ed30f157f05a13da60f1ab7f","f66961926760d3e851d51f7dfec82965e0dbcce1","9cebebe97bfe14b258cd68de1ec1807162b4f49c","4f55830eba7f3fe29bf459d6357b391bd003a103","823e1e92575bde76edd1cca0c936a2a17f19a422","c3626c4309526213a78e8fd09891e609c358af9d","1780350c62128bbcc7ea5817f240134382e76f73","66b9ef87fafd2852e3f7414f3360216580a27679","9452c5a8e164f354d21087a2ad4b512128a85e1d","78adb1c0a28f23c4e3103e103dce8e1baad0f234","24fc0b4ace2965a57e62427d1f50c4726f32d06c","546543cae85d97a2f49d3e1659ea10e75037aead","d619238e9758916f233a79b87422f9097d2f8ef2","da329f4c8ab5e0398e62cb34fcc431ca50e30869","33e4761bd9192e6e8703dcc039064e774c10665f","f868ecd5cfea3d75fb59a1ee8f6297d7cdf4a040","637bb872671a62f1016e9012681a8eb53a62fb20","87ca1b3aaf31cb7bfe2071679f3644cb89c2ab82","ae477eb9946b922640c66d61c3ac52fb20e7debc","f8c901669bf1a572f936f17baacf8056b858d448","f45e66b15d1a20dc9ed279a879b25b3b49372153","3028456893b884bd63e544a98b8f4690c8c18ea7","6735e689147ec6340b4469b5af6ed0a8b91ab697","9494636232d72ddff14831ecd5d456a64436efe9","16a4ef8b756a0031e2261125cf3f3ee3b5612bbc","4ed2eeb3441bbd1aece23fb90e94112f3ab4fdf8","811e5b6ddd2bbbd0b3b1a3cd1d9903ab168a7806","af1395ab0e518c2b00cd04212cda89c5cee10b9a","cec188c96dbca05d389a0aac93705ef05afb7352","ae8259ac3522f9fe0b6a1dca721c344ef43a9423","32558cb0a6d34651d206f26e62da8a9d0301e5e3","0c39ef7d070f8937f569c08f62a5b5c9b3df4370","1adce9e107eed29dce78751bc75e2f3e1ca28ac8","3fc4f47930308fa1980c19c45b7e78efb21d2e93","f550c10cf861abdf9dd8e45a6b933a04bb0a7659","e2e656992b6d7912a950f673e846a184c2466492","1fa02a6aa95b97bb7559770282b9a3765f020538","bf75088bbd938fe32a6d85a87d3131f7e092f5fb","2c3abfaeecb9871c97663d08e5c2f063336da3b6","c3ee22dfe0d2d042e3bad3ab33e7f1f499793ff8","a1611e13f4438299584d60a836b008ea5a813df3","1d19b8eca9a0fab7ba312f7030fcdf89ce5256e1"],"is-negative-review":true,"negative-findings":{"number-of-types":4,"number-of-files-touched":5,"findings":[{"method":"NinJoGeoTIFFWriter.save_image","why-it-occurs":"Overly long functions make the code harder to read. The recommended maximum function length for the Python language is 70 lines of code. Severity: Brain Method - Complex Method - Long Method.","name":"Large Method","file":"satpy/writers/ninjogeotiff.py","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":109,"what-changed":"NinJoGeoTIFFWriter.save_image increases from 90 to 97 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":"degraded"},{"method":"GeoTIFFWriter.save_image","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/writers/geotiff.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":147,"what-changed":"GeoTIFFWriter.save_image already has high cyclomatic complexity, and now it increases in Lines of Code from 139 to 144","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"},{"method":"PillowWriter.save_image","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/writers/simple_image.py","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":47,"what-changed":"PillowWriter.save_image has 5 arguments, max arguments = 4","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":"introduced"},{"method":"_verify_times","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/composites/core.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":596,"what-changed":"_verify_times 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":"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":"satpy/tests/modifier_tests/test_atmosphere.py","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":222,"what-changed":"The module contains 3 functions with similar structure: fake_ir_039_dask_with_time,fake_ir_108_dask_with_time,fake_ir_134_dask_with_time","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":"TestPSPRayleighReflectance.test_rayleigh_corrector","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/tests/modifier_tests/test_atmosphere.py","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":108,"what-changed":"TestPSPRayleighReflectance.test_rayleigh_corrector has 9 arguments, max arguments = 4","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":"introduced"}]},"positive-impact-count":4,"repo":"satpy","code-health":8.699305557491687,"version":"3.0","authors":["Gerrit Holl","Panu Lahtinen"],"directives":{"added":[],"removed":[]},"positive-findings":{"number-of-types":4,"number-of-files-touched":3,"findings":[{"method":"Scene._resampled_scene","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/scene.py","change-level":"improvement","is-hotspot?":true,"line":864,"what-changed":"Scene._resampled_scene 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":"Scene._resampled_scene","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":"satpy/scene.py","change-level":"improvement","is-hotspot?":true,"line":864,"what-changed":"Scene._resampled_scene 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"},{"name":"Code Duplication","file":"satpy/tests/compositor_tests/test_core.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"},{"method":"TestPSPRayleighReflectance.test_rayleigh_corrector","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/tests/test_modifiers.py","change-level":"improvement","is-hotspot?":false,"line":504,"what-changed":"TestPSPRayleighReflectance.test_rayleigh_corrector 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"}]},"notices":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"external-review-provider":"GitHub"},"analysistime":"2026-04-08T13:29:49.000Z","project-name":"satpy","repository":"https://github.com/pytroll/satpy.git"}}