{"results":{"result":{"added-files":{"code-health":10.0,"old-code-health":0.0,"files":[{"file":"gama.ui.shared/src/gama/ui/shared/access/HeapControl.java","loc":24,"code-health":10.0}]},"external-review-url":"https://github.com/gama-platform/gama/pull/319","old-code-health":7.911530032140149,"modified-files":{"code-health":7.894802597749579,"old-code-health":7.911530032140149,"files":[{"file":"gama.core/src/gama/core/kernel/experiment/ExperimentPlan.java","loc":725,"old-loc":725,"code-health":6.57572955915831,"old-code-health":6.57572955915831},{"file":"gama.ui.application/src/gama/ui/application/workbench/ApplicationWorkbenchWindowAdvisor.java","loc":96,"old-loc":94,"code-health":10.0,"old-code-health":10.0},{"file":"gama.ui.application/src/gama/ui/application/workbench/PerspectiveHelper.java","loc":278,"old-loc":278,"code-health":9.076697166065193,"old-code-health":9.076697166065193},{"file":"gama.ui.application/src/gama/ui/application/workbench/SimulationPerspectiveDescriptor.java","loc":94,"old-loc":94,"code-health":10.0,"old-code-health":10.0},{"file":"gama.ui.editor/src/gaml/compiler/ui/editor/toolbar/EditorToolbar.java","loc":94,"old-loc":107,"code-health":10.0,"old-code-health":10.0},{"file":"gama.ui.shared/src/gama/ui/shared/access/GamlSearchField.java","loc":344,"old-loc":342,"code-health":7.76271585365764,"old-code-health":7.771305097619841},{"file":"gama.ui.shared/src/gama/ui/shared/views/toolbar/GamaToolbarSimple.java","loc":42,"old-loc":43,"code-health":9.6882083290695,"old-code-health":9.6882083290695}]},"removed-files":{"code-health":0.0,"old-code-health":0.0,"files":[]},"external-review-id":"319","analysis-time":"2024-09-10T11:58:43Z","negative-impact-count":1,"suppressions":{"number-of-types":0,"number-of-files-touched":0,"findings":[]},"affected-hotspots":0,"commits":["aa66d8492883c61c92165f37b14967330f3b02dc","8d55a7bb296a3eed9dd0d360b229e241ff327b76"],"is-negative-review":true,"negative-findings":{"number-of-types":1,"number-of-files-touched":1,"findings":[{"method":"createWidget","why-it-occurs":"A Complex Method has a high cyclomatic complexity. The recommended threshold for the Java language is a cyclomatic complexity lower than 9.","name":"Complex Method","file":"gama.ui.shared/src/gama/ui/shared/access/GamlSearchField.java","refactoring-examples":[{"architectural-component-id":null,"author-name":"AlexisDrogoul","training-data":{"loc-added":"22","loc-deleted":"13","delta-cc-mean":"0.0","delta-cc-total":"0","delta-penalties":"1.0","delta-n-functions":"0","current-file-score":"9.536386775820924"},"author-email":"579256+AlexisDrogoul@users.noreply.github.com","commit-full-message":"- Extract chart configuration and styling properties into ChartProperties with FontSpec, AxisRange, and AxisVisibility components\n- Introduce IChartEngine and ChartOutputFactory to decouple chart creation from JFreeChart\n- Update IChart in gama.api with default getNativeChart() and getJFChart() methods\n- Update SnapshotMaker to render snapshots directly via IChart.getImage(...)\n- Simplify concrete JFreeChart output subclasses (Scatter, Histogram, Pie, Radar, Heatmap, BoxAndWhiskerCategory)\n- Resolve CodeScene quality gate rules by extracting plot and legend configuration helper methods","commit-date":"2026-09-16T17:38:02Z","current-rev":"6adb4401a","filename":"gama/gama.core/src/gama/core/outputs/layers/charts/ChartJFreeChartOutput.java","previous-rev":"c501d1e11","commit-title":"refactor: simplify chart classes and introduce pluggable chart engine","language":"Java","id":"58fc13daaafe8c0c448a1ddfb3923e51fe1fbd3f","model-score":0.53,"author-id":null,"project-id":51964,"delta-file-score":0.29573047,"diff":"diff --git a/gama.core/src/gama/core/outputs/layers/charts/ChartJFreeChartOutput.java b/gama.core/src/gama/core/outputs/layers/charts/ChartJFreeChartOutput.java\nindex cb4dc5bfc..724823bc5 100644\n--- a/gama.core/src/gama/core/outputs/layers/charts/ChartJFreeChartOutput.java\n+++ b/gama.core/src/gama/core/outputs/layers/charts/ChartJFreeChartOutput.java\n@@ -146,14 +146,4 @@ public class ChartJFreeChartOutput extends ChartOutput implements ChartProgressL\n \n-\t@Override\n-\tpublic void initChart(final IScope scope, final String chartname) {\n-\t\tsuper.initChart(scope, chartname);\n-\t\tif (chart == null) return;\n-\n-\t\tinitRenderer(scope);\n-\t\tfinal Plot plot = chart.getPlot();\n-\t\tchart.addProgressListener(this);\n-\t\tchart.setBorderVisible(false);\n-\t\tplot.setOutlineVisible(false);\n+\tprivate void configureChartTitle() {\n \t\tchart.setTitle(this.getName());\n-\n \t\tif (chart.getTitle() != null) {\n@@ -165,3 +155,6 @@ public class ChartJFreeChartOutput extends ChartOutput implements ChartProgressL\n \t\t}\n+\t}\n \n+\tprivate void configureChartBackgrounds() {\n+\t\tPlot plot = chart.getPlot();\n \t\tif (properties.getBackgroundColor() == null) {\n@@ -178,15 +171,16 @@ public class ChartJFreeChartOutput extends ChartOutput implements ChartProgressL\n \t\t}\n+\t}\n \n-\t\tif (chart.getLegend() != null) {\n-\t\t\tLegendTitle legend = chart.getLegend();\n-\t\t\tlegend.setItemFont(properties.getLegendFont());\n-\t\t\tlegend.setFrame(BlockBorder.NONE);\n-\t\t\tlegend.setPosition(RectangleEdge.BOTTOM);\n+\tprivate void configureChartLegend(final IScope scope) {\n+\t\tif (chart.getLegend() == null) return;\n+\t\tLegendTitle legend = chart.getLegend();\n+\t\tlegend.setItemFont(properties.getLegendFont());\n+\t\tlegend.setFrame(BlockBorder.NONE);\n+\t\tlegend.setPosition(RectangleEdge.BOTTOM);\n \n-\t\t\tconfigureLegendPosition(legend, plot, scope);\n-\t\t\tconfigureLegendOrientation(legend);\n+\t\tconfigureLegendPosition(legend, chart.getPlot(), scope);\n+\t\tconfigureLegendOrientation(legend);\n \n-\t\t\tif (properties.getTextColor() != null) {\n-\t\t\t\tlegend.setItemPaint(IColor.toAWTColor(properties.getTextColor()));\n-\t\t\t}\n+\t\tif (properties.getTextColor() != null) {\n+\t\t\tlegend.setItemPaint(IColor.toAWTColor(properties.getTextColor()));\n \t\t}\n@@ -194,2 +188,17 @@ public class ChartJFreeChartOutput extends ChartOutput implements ChartProgressL\n \n+\t@Override\n+\tpublic void initChart(final IScope scope, final String chartname) {\n+\t\tsuper.initChart(scope, chartname);\n+\t\tif (chart == null) return;\n+\n+\t\tinitRenderer(scope);\n+\t\tchart.addProgressListener(this);\n+\t\tchart.setBorderVisible(false);\n+\t\tchart.getPlot().setOutlineVisible(false);\n+\n+\t\tconfigureChartTitle();\n+\t\tconfigureChartBackgrounds();\n+\t\tconfigureChartLegend(scope);\n+\t}\n+\n \tprotected void configureLegendPosition(final LegendTitle legend, final Plot plot, final IScope scope) {\n","improvement-type":"Complex Method"},{"architectural-component-id":null,"author-name":"AlexisDrogoul","training-data":{"loc-added":"23","loc-deleted":"27","delta-cc-mean":"0.0","delta-cc-total":"0","delta-penalties":"1.44","delta-n-functions":"0","current-file-score":"9.536386775820924"},"author-email":"579256+AlexisDrogoul@users.noreply.github.com","commit-full-message":"","commit-date":"2026-09-02T06:25:12Z","current-rev":"0a5f1fd1d","filename":"gama/gama.core/src/gama/core/outputs/layers/charts/ChartJFreeChartOutput.java","previous-rev":"96cb6e0b7","commit-title":"Fix chart legend personalization and datalist color/legend handling (#1186, #1187)","language":"Java","id":"82632572e418f9c978f94eaefc61ed41784c64dc","model-score":0.39,"author-id":null,"project-id":51964,"delta-file-score":0.42258495,"diff":"diff --git a/gama.core/src/gama/core/outputs/layers/charts/ChartJFreeChartOutput.java b/gama.core/src/gama/core/outputs/layers/charts/ChartJFreeChartOutput.java\nindex 5c8ce3bde..80e0a65e1 100644\n--- a/gama.core/src/gama/core/outputs/layers/charts/ChartJFreeChartOutput.java\n+++ b/gama.core/src/gama/core/outputs/layers/charts/ChartJFreeChartOutput.java\n@@ -238,3 +238,3 @@ public class ChartJFreeChartOutput extends ChartOutput implements ChartProgressL\n \t\tif (chart.getLegend() != null) {\n-\t\t\tLegendTitle legend = chart.getLegend(); // Get the existing legend\n+\t\t\tLegendTitle legend = chart.getLegend();\n \t\t\tlegend.setItemFont(getLegendFont());\n@@ -242,46 +242,42 @@ public class ChartJFreeChartOutput extends ChartOutput implements ChartProgressL\n \t\t\tlegend.setPosition(RectangleEdge.BOTTOM);\n-\t\t\t// legend.setPadding(5, 5, 5, 5);\n-\t\t\t// Set legend position\n-\t\t\tswitch (series_label_position) {\n-\t\t\t\tcase IKeyword.LEFT:\n-\t\t\t\t\tlegend.setPosition(RectangleEdge.LEFT);\n-\t\t\t\t\tbreak;\n-\t\t\t\tcase IKeyword.RIGHT:\n-\t\t\t\t\tlegend.setPosition(RectangleEdge.RIGHT);\n-\t\t\t\t\tbreak;\n-\t\t\t\tcase IKeyword.TOP:\n-\t\t\t\t\tlegend.setPosition(RectangleEdge.TOP);\n-\t\t\t\t\tbreak;\n-\t\t\t\tcase \"none\":\n-\t\t\t\t\tlegend.setVisible(false);\n-\t\t\t\t\tbreak;\n-\t\t\t\tcase \"onchart\":\n-\t\t\t\t\tif (plot instanceof XYPlot p) {\n-\t\t\t\t\t\t// Place the legend inside the chart area at the corner specified by the anchor\n-\t\t\t\t\t\tdouble x = series_label_anchor.getX() / 2 + 0.25; // Normalize to [0.25, 0.75]\n-\t\t\t\t\t\tdouble y = series_label_anchor.getY() / 2 + 0.25;\n-\t\t\t\t\t\tXYTitleAnnotation ta = new XYTitleAnnotation(x, y, legend, RectangleAnchor.CENTER);\n-\t\t\t\t\t\tta.setMaxWidth(0.5); // Legend will take up to 50% of the chart width by default\n-\t\t\t\t\t\tta.setMaxHeight(0.5);\n-\t\t\t\t\t\tlegend.setHorizontalAlignment(HorizontalAlignment.CENTER);\n-\t\t\t\t\t\tlegend.setVerticalAlignment(VerticalAlignment.CENTER);\n-\t\t\t\t\t\t// Legend with 50% transparency by default\n-\t\t\t\t\t\tlegend.setBackgroundPaint(IColor.toAWTColor(Colors.rgb(scope, backgroundColor, 0.5)));\n-\t\t\t\t\t\tp.addAnnotation(ta);\n-\t\t\t\t\t\t// Remove the default legend\n-\t\t\t\t\t\tchart.removeLegend();\n-\t\t\t\t\t}\n-\t\t\t}\n \n-\t\t\tif (\"vertical\".equalsIgnoreCase(legend_orientation)) {\n-\t\t\t\tlegend.getItemContainer().setArrangement(new org.jfree.chart.block.ColumnArrangement());\n-\t\t\t} else if (\"horizontal\".equalsIgnoreCase(legend_orientation)) {\n-\t\t\t\tlegend.getItemContainer().setArrangement(new org.jfree.chart.block.FlowArrangement());\n-\t\t\t}\n+\t\t\tconfigureLegendPosition(legend, plot, scope);\n+\t\t\tconfigureLegendOrientation(legend);\n \n-\t\t\t// Set legend text color\n \t\t\tif (textColor != null) { legend.setItemPaint(IColor.toAWTColor(textColor)); }\n+\t\t}\n+\n+\t}\n \n+\tprivate void configureLegendPosition(final LegendTitle legend, final Plot plot, final IScope scope) {\n+\t\tswitch (series_label_position) {\n+\t\t\tcase IKeyword.LEFT -> legend.setPosition(RectangleEdge.LEFT);\n+\t\t\tcase IKeyword.RIGHT -> legend.setPosition(RectangleEdge.RIGHT);\n+\t\t\tcase IKeyword.TOP -> legend.setPosition(RectangleEdge.TOP);\n+\t\t\tcase \"none\" -> legend.setVisible(false);\n+\t\t\tcase \"onchart\" -> {\n+\t\t\t\tif (plot instanceof XYPlot p) {\n+\t\t\t\t\tdouble x = series_label_anchor.getX() / 2 + 0.25;\n+\t\t\t\t\tdouble y = series_label_anchor.getY() / 2 + 0.25;\n+\t\t\t\t\tXYTitleAnnotation ta = new XYTitleAnnotation(x, y, legend, RectangleAnchor.CENTER);\n+\t\t\t\t\tta.setMaxWidth(0.5);\n+\t\t\t\t\tta.setMaxHeight(0.5);\n+\t\t\t\t\tlegend.setHorizontalAlignment(HorizontalAlignment.CENTER);\n+\t\t\t\t\tlegend.setVerticalAlignment(VerticalAlignment.CENTER);\n+\t\t\t\t\tlegend.setBackgroundPaint(IColor.toAWTColor(Colors.rgb(scope, backgroundColor, 0.5)));\n+\t\t\t\t\tp.addAnnotation(ta);\n+\t\t\t\t\tchart.removeLegend();\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tdefault -> {\n+\t\t\t}\n \t\t}\n+\t}\n \n+\tprivate void configureLegendOrientation(final LegendTitle legend) {\n+\t\tif (\"vertical\".equalsIgnoreCase(legend_orientation)) {\n+\t\t\tlegend.getItemContainer().setArrangement(new org.jfree.chart.block.ColumnArrangement());\n+\t\t} else if (\"horizontal\".equalsIgnoreCase(legend_orientation)) {\n+\t\t\tlegend.getItemContainer().setArrangement(new org.jfree.chart.block.FlowArrangement());\n+\t\t}\n \t}\n","improvement-type":"Complex Method"}],"change-level":"warning","is-hotspot?":false,"line":180,"what-changed":"createWidget already has high cyclomatic complexity, and now it increases in Lines of Code from 115 to 117","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"}]},"positive-impact-count":0,"repo":"gama","code-health":7.924575572206862,"version":"3.0","authors":["AlexisDrogoul"],"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":"2024-09-10T11:58:43.000Z","project-name":"gama","repository":"https://github.com/gama-platform/gama.git"}}