{"results":{"result":{"added-files":{"code-health":0.0,"old-code-health":0.0,"files":[]},"external-review-url":"https://github.com/ghiggi/gpm_api/pull/87","old-code-health":7.191987609551712,"modified-files":{"code-health":6.975075689391322,"old-code-health":7.191987609551712,"files":[{"file":"gpm/accessor/methods.py","loc":1045,"old-loc":1003,"code-health":7.106711345609554,"old-code-health":7.106711345609554},{"file":"gpm/utils/manipulations.py","loc":1318,"old-loc":1051,"code-health":5.60584294577918,"old-code-health":5.771131738786489},{"file":"gpm/dataset/decoding/decode_2a_radar.py","loc":255,"old-loc":250,"code-health":9.536386775820924,"old-code-health":9.536386775820924},{"file":"gpm/tests/test_utils/test_manipulations.py","loc":1192,"old-loc":921,"code-health":5.802184796467351,"old-code-health":5.980837740401587},{"file":"gpm/visualization/plot.py","loc":1107,"old-loc":1098,"code-health":5.915589411575433,"old-code-health":6.27472918314537},{"file":"gpm/gv/xradar/accessors.py","loc":115,"old-loc":111,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"gpm/gv/xradar/methods.py","loc":223,"old-loc":222,"code-health":9.6882083290695,"old-code-health":9.6882083290695},{"file":"gpm/io/checks.py","loc":348,"old-loc":351,"code-health":7.384117463736593,"old-code-health":7.384117463736593},{"file":"gpm/tests/test_visualization/utils.py","loc":79,"old-loc":79,"code-health":10.0,"old-code-health":10.0},{"file":"gpm/gv/routines.py","loc":910,"old-loc":888,"code-health":9.23194447551745,"old-code-health":9.23194447551745},{"file":"gpm/visualization/cross_section.py","loc":224,"old-loc":223,"code-health":8.014305317090086,"old-code-health":8.014305317090086}]},"removed-files":{"code-health":0.0,"old-code-health":0.0,"files":[]},"external-review-id":"87","analysis-time":"2026-06-18T07:07:39Z","negative-impact-count":5,"suppressions":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"affected-hotspots":0,"commits":["df2d14a3678ab3d9bebd7e6849769e5fb89c2c6a","94c8ce6d99aed5de9db696a5851e1dd38419d836","dfaf63799ea8b8462dc16af14be12eef62d18411","d8a092068a2b2e16ddb78647323afc00886acc28","8a09cf3ae2ce4ea1f527f4eaea124e9ed6ac4c5a","a194a1f2b5276ad23103cf129562136ae2b94c88","0da0df6cf8f2b498867d71221706d6c9ad31a0da","7f5d1a1763e40509ef56ff4c19bc47b1eb14e9d1","490428f41a23f20476082070f5909f53f5ba9a6d","aa559dea04f88e7010650d740e2a7c870d66fd79","90cad2a751023c55aa8a48f291eb82c5ae7b346c","fe903400efd5deb318818190e54801e1f1f92f0a","34012cd9e0bc4d555443861bc0cad3d85b032a59","ef368a1704028c9e802c5f915bb6574a194ac1fd","11a34bbb767ab4ea8499f426c16d5bdf47919a8e","952e590272c530e4c50da5d2ce180b4f1b0123c3","11cbcc68bf78526a8c84c934e36c8ff0b4d2a640","6d85266e120e0bb225c41fe5172add13639432e7","45a222372cffff186a91b66b0156b9dac1c418e2","258fd042d1e705390db2fad5bc585b094b3e0dad","e0979b2049bf9e44806add3ae35ce9cee9e901ef"],"is-negative-review":true,"negative-findings":{"number-of-types":4,"number-of-files-touched":3,"findings":[{"name":"Number of Functions in a Single Module","file":"gpm/utils/manipulations.py","change-type":"introduced","change-level":"warning","is-hotspot?":false,"what-changed":"This module has 89 functions, threshold = 75","refactoring-examples":null},{"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":"gpm/tests/test_utils/test_manipulations.py","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":824,"what-changed":"introduced similar code in: TestSliceRangeAtNearSurface.test_dataset_slices_all_variables_using_target,TestSliceRangeAtTop.test_dataset_slices_all_variables_using_target","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":"degraded"},{"method":"test_extract_dataset_above_bin","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":"gpm/tests/test_utils/test_manipulations.py","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":432,"what-changed":"test_extract_dataset_above_bin increases from 113 to 114 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":"test_extract_dataset_below_bin","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":"gpm/tests/test_utils/test_manipulations.py","refactoring-examples":null,"change-level":"warning","is-hotspot?":false,"line":284,"what-changed":"test_extract_dataset_below_bin increases from 97 to 98 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"},{"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":"gpm/visualization/plot.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 4 different responsibilities amongst its 43 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":10,"repo":"gpm_api","code-health":6.975075689391322,"version":"3.0","authors":["ghiggi"],"directives":{"added":[],"removed":[]},"positive-findings":{"number-of-types":5,"number-of-files-touched":5,"findings":[{"name":"Code Duplication","file":"gpm/accessor/methods.py","change-type":"improved","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":"reduced similar code in: GPM_Base_Accessor.plot_map_mesh,GPM_Base_Accessor.plot_map_mesh_centroids,GPM_Base_Accessor.plot_swath,GPM_Base_Accessor.plot_swath_lines"},{"method":"GPM_Base_Accessor.plot_swath","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":"gpm/accessor/methods.py","change-level":"improvement","is-hotspot?":false,"line":694,"what-changed":"GPM_Base_Accessor.plot_swath 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"},{"method":"GPM_Base_Accessor.plot_swath_lines","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":"gpm/accessor/methods.py","change-level":"improvement","is-hotspot?":false,"line":724,"what-changed":"GPM_Base_Accessor.plot_swath_lines 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"},{"method":"GPM_Base_Accessor.plot_map_mesh","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":"gpm/accessor/methods.py","change-level":"improvement","is-hotspot?":false,"line":756,"what-changed":"GPM_Base_Accessor.plot_map_mesh 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"},{"method":"GPM_Base_Accessor.plot_map_mesh_centroids","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":"gpm/accessor/methods.py","change-level":"improvement","is-hotspot?":false,"line":788,"what-changed":"GPM_Base_Accessor.plot_map_mesh_centroids 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"},{"method":"_get_valid_da_bin","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":"gpm/utils/manipulations.py","change-level":"improvement","is-hotspot?":false,"line":251,"what-changed":"_get_valid_da_bin 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"},{"name":"Overall Code Complexity","file":"gpm/visualization/plot.py","change-type":"fixed","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Overall Code Complexity is measured by the mean cyclomatic complexity across all functions in the file. The lower the number, the better.\n\nCyclomatic complexity is a function level metric that measures the number of logical branches (if-else, loops, etc.). Cyclomatic complexity is a rough complexity measure, but useful as a way of estimating the minimum number of unit tests you would need. As such, prefer functions with low cyclomatic complexity (2-3 branches).","how-to-fix":"You address the overall cyclomatic complexity by a) modularizing the code, and b) abstract away the complexity. Let's look at some examples:\n\nModularizing the Code: Do an X-Ray and inspect the local hotspots. Are there any complex conditional expressions? If yes, then do a [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring. Extract the conditional logic into a separate function and put a good name on that function. This clarifies the intent and makes the original function easier to read. Repeat until all complex conditional expressions have been simplified.\n\n","what-changed":"The mean cyclomatic complexity in this module is no longer above the threshold"},{"name":"Missing Arguments Abstractions","file":"gpm/visualization/plot.py","change-type":"improved","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"This code health issue is measured as the average number of function arguments across the whole file. A function with many arguments can be simplified either by a) splitting the function if it has too many responsibilities, or b) by introducing an abstraction (class, record, struct, etc.) which encapsulates the 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.","what-changed":"The average number of function arguments decreases from 4.93 to 4.74, threshold = 4.00"},{"name":"Overall Code Complexity","file":"gpm/io/checks.py","change-type":"improved","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Overall Code Complexity is measured by the mean cyclomatic complexity across all functions in the file. The lower the number, the better.\n\nCyclomatic complexity is a function level metric that measures the number of logical branches (if-else, loops, etc.). Cyclomatic complexity is a rough complexity measure, but useful as a way of estimating the minimum number of unit tests you would need. As such, prefer functions with low cyclomatic complexity (2-3 branches).","how-to-fix":"You address the overall cyclomatic complexity by a) modularizing the code, and b) abstract away the complexity. Let's look at some examples:\n\nModularizing the Code: Do an X-Ray and inspect the local hotspots. Are there any complex conditional expressions? If yes, then do a [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring. Extract the conditional logic into a separate function and put a good name on that function. This clarifies the intent and makes the original function easier to read. Repeat until all complex conditional expressions have been simplified.\n\n","what-changed":"The mean cyclomatic complexity decreases from 5.19 to 5.16, threshold = 4"},{"name":"Overall Code Complexity","file":"gpm/visualization/cross_section.py","change-type":"improved","change-level":"improvement","is-hotspot?":false,"why-it-occurs":"Overall Code Complexity is measured by the mean cyclomatic complexity across all functions in the file. The lower the number, the better.\n\nCyclomatic complexity is a function level metric that measures the number of logical branches (if-else, loops, etc.). Cyclomatic complexity is a rough complexity measure, but useful as a way of estimating the minimum number of unit tests you would need. As such, prefer functions with low cyclomatic complexity (2-3 branches).","how-to-fix":"You address the overall cyclomatic complexity by a) modularizing the code, and b) abstract away the complexity. Let's look at some examples:\n\nModularizing the Code: Do an X-Ray and inspect the local hotspots. Are there any complex conditional expressions? If yes, then do a [DECOMPOSE CONDITIONAL](https://refactoring.com/catalog/decomposeConditional.html) refactoring. Extract the conditional logic into a separate function and put a good name on that function. This clarifies the intent and makes the original function easier to read. Repeat until all complex conditional expressions have been simplified.\n\n","what-changed":"The mean cyclomatic complexity decreases from 6.29 to 6.14, threshold = 4"}]},"notices":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"external-review-provider":"GitHub"},"analysistime":"2026-06-18T07:07:38.000Z","project-name":"gpm_api","repository":"https://github.com/ghiggi/gpm_api.git"}}