codeant-ai-for-open-source[bot] commented on code in PR #41749: URL: https://github.com/apache/superset/pull/41749#discussion_r3640830649
########## superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts: ########## @@ -60,11 +60,9 @@ const DEFAULT_LEGEND_ICON_WIDTH = 25; const LEGEND_ICON_LABEL_GAP = 5; const LEGEND_HORIZONTAL_SIDE_GUTTER = 16; const LEGEND_HORIZONTAL_ROW_HEIGHT = 24; -const LEGEND_HORIZONTAL_MAX_ROWS = 2; -const LEGEND_HORIZONTAL_MAX_HEIGHT_RATIO = 0.25; +// Cap the reserved horizontal legend margin so an overflowing legend can't eat the plot. +const MAX_LEGEND_MARGIN_RATIO = 0.4; Review Comment: **Suggestion:** The comment says the cap is only for horizontal legends, but the same constant is now used for both horizontal and vertical layout code paths; this mismatch is misleading and can cause incorrect future maintenance changes. Update the comment to reflect both orientations or split constants/comments per orientation. [comment mismatch] <details> <summary><b>Severity Level:</b> Minor ๐งน</summary> ```mdx - โ ๏ธ Comment misstates cap usage across legend orientations. - โ ๏ธ Could mislead maintainers making orientation-specific changes. ``` </details> <details> <summary><b>Steps of Reproduction โ </b></summary> ```mdx 1. A developer reads the comment above `MAX_LEGEND_MARGIN_RATIO` in `superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts:63-64`, which states the cap is for the reserved horizontal legend margin. 2. The same `MAX_LEGEND_MARGIN_RATIO` constant is used to cap margins in `getHorizontalPlainLegendLayout()` at `series.ts:268-271` and also in `getVerticalPlainLegendLayout()` at `series.ts:308-311`, affecting both horizontal and vertical legends. 3. This means the comment at `series.ts:63` is factually inaccurate: the cap applies to all plain legends, not only horizontal ones. 4. While this does not affect runtime behavior, the misleading comment can confuse future maintainers and lead to incorrect, orientation-specific changes that overlook the vertical usage of the constant. ``` </details> [](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=5e88458c3030472986bff3871d505a20&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=5e88458c3030472986bff3871d505a20&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) *(Use Cmd/Ctrl + Click for best experience)* <details> <summary><b>Prompt for AI Agent ๐ค </b></summary> ```mdx This is a comment left during a code review. **Path:** superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts **Line:** 63:64 **Comment:** *Comment Mismatch: The comment says the cap is only for horizontal legends, but the same constant is now used for both horizontal and vertical layout code paths; this mismatch is misleading and can cause incorrect future maintenance changes. Update the comment to reflect both orientations or split constants/comments per orientation. Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise. Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix ``` </details> <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41749&comment_hash=a0536470e415aefa1137caa34e6de35a4d68537ff0634b8dad003ae694884a22&reaction=like'>๐</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41749&comment_hash=a0536470e415aefa1137caa34e6de35a4d68537ff0634b8dad003ae694884a22&reaction=dislike'>๐</a> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
