{"results":{"result":{"added-files":{"code-health":9.125852369552282,"old-code-health":0.0,"files":[{"file":"satpy/readers/thr3mi_l1c_nc.py","loc":115,"code-health":9.536386775820924},{"file":"satpy/tests/reader_tests/test_thr3mi_l1c_nc.py","loc":176,"code-health":8.857605456365384}]},"external-review-url":"https://github.com/pytroll/satpy/pull/2908","old-code-health":0.0,"modified-files":{"code-health":0.0,"old-code-health":0.0,"files":[]},"removed-files":{"code-health":0.0,"old-code-health":0.0,"files":[]},"external-review-id":"2908","analysis-time":"2025-09-19T15:43:40Z","negative-impact-count":5,"suppressions":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"affected-hotspots":0,"commits":["ccb567a3d973a2838d3044f69a4fe0a64a176a06","9b0b489dca0a326d6f2f2447faa805507951e7e4","93c0541e63807aec5c1b9460510b585c611e6d8f","ed528e3cb4765364b3cbfafaf35f1e4627f403e0","965a51a2ebcc07fd63cede6451b7f18092366ac0","a802f39ee71fba3efd067e0acc8c206fd37847f4","e761395a7ac21448de83d961e2b229d7296bd24d","6f39755d6e8cb388b292cd2280dbd21b5e008269","a515e4ff606593e524e9d579342e9a48b3083afd","bc112ff0a9e8bd2e8266aaa965025eb7e1f596e1","5934a899b66674ba71de35dc53a3cc4efcff238e","f3bc56eff15a648be05b6b0c450973bec1f4675d","ddd5b84bcf38f7fb1e81d78bef6c6e29ceb003af","2fcc7d08b148214b92a539144177c7667196ea55","54c0157c36c99c9d408dd7a75bd46e2c58f7bf37","c1aeb1abd51037a07eacdc6bee1bae531fe281c1","88f6e83f9e40b26b44839010775d2285a1c7e98d","a6fa58743e9e1edf1aa3c967bbfc393b02e1b67e","13efe60b98da8d557f91d58c75a8eaa265fe2eaf","3f09755711135cbad685bd9dace9361cf10fa65c"],"is-negative-review":true,"negative-findings":{"number-of-types":4,"number-of-files-touched":2,"findings":[{"method":"Thr3miL1cNCFileHandler.get_dataset","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/readers/thr3mi_l1c_nc.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":59,"what-changed":"Thr3miL1cNCFileHandler.get_dataset has a cyclomatic complexity of 11, 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":"Thr3miL1cNCFileHandler.get_dataset","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/readers/thr3mi_l1c_nc.py","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":59,"what-changed":"Thr3miL1cNCFileHandler.get_dataset 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"},{"method":"TestThr3miNCL1cFileHandler.test_file_reading","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/tests/reader_tests/test_thr3mi_l1c_nc.py","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":142,"what-changed":"TestThr3miNCL1cFileHandler.test_file_reading has 75 lines, 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":"introduced"},{"method":"TestThr3miNCL1cFileHandler.test_file_reading","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/tests/reader_tests/test_thr3mi_l1c_nc.py","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":142,"what-changed":"TestThr3miNCL1cFileHandler.test_file_reading 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"},{"method":"TestThr3miNCL1cFileHandler.test_file_reading","why-it-occurs":"Deep nested logic means that you have control structures like if-statements or loops inside other control structures. Deep nested logic increases the cognitive load on the programmer reading the code. The human working memory has a maximum capacity of 3-4 items; beyond that threshold, we struggle with keeping things in our head. Consequently, deep nested logic has a strong correlation to defects and accounts for roughly 20% of all programming mistakes.\n\nCodeScene measures the maximum nesting depth inside each function. The deeper the nesting, the lower the code health. The threshold for the Python language is 4 levels of nesting.","name":"Deep, Nested Complexity","file":"satpy/tests/reader_tests/test_thr3mi_l1c_nc.py","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":142,"what-changed":"TestThr3miNCL1cFileHandler.test_file_reading has a nested complexity depth of 4, threshold = 4","how-to-fix":"Occassionally, it's possible to get rid of the nested logic by [Replacing Conditionals with Guard Clauses](https://refactoring.com/catalog/replaceNestedConditionalWithGuardClauses.html).\n\nAnother viable strategy is to identify smaller building blocks inside the nested chunks of logic and extract those responsibilities into smaller, cohesive, and well-named functions. The [EXTRACT FUNCTION](https://refactoring.com/catalog/extractFunction.html) refactoring explains the steps.","change-type":"introduced"}]},"positive-impact-count":0,"repo":"satpy","code-health":9.125852369552282,"version":"3.0","authors":["Pepe"],"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-09-19T15:43:40.000Z","project-name":"satpy","repository":"https://github.com/pytroll/satpy.git"}}