codeant-ai-for-open-source[bot] commented on code in PR #40967:
URL: https://github.com/apache/superset/pull/40967#discussion_r3401956526
##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformers.test.ts:
##########
@@ -125,6 +125,35 @@ describe('transformSeries', () => {
// OpacityEnum.NonTransparent = 1 (not dimmed)
expect((result as any).itemStyle.opacity).toBe(1);
});
+
+ test('should use symbolSizeFn for symbolSize when provided', () => {
+ const symbolSizeFn = jest.fn(
+ (value: (number | string | null)[]) => Number(value[1]) * 2,
+ );
+ const opts = {
+ seriesType: EchartsTimeseriesSeriesType.Scatter,
+ markerSize: 7,
+ symbolSizeFn,
+ timeShiftColor: false,
+ };
+
+ const result = transformSeries(series, mockColorScale, 'test-key', opts);
+
+ expect((result as any).symbolSize).toBe(symbolSizeFn);
+ expect((result as any).symbolSize(['A', 4])).toBe(8);
+ });
+
+ test('should fall back to markerSize for symbolSize when symbolSizeFn is not
provided', () => {
+ const opts = {
+ seriesType: EchartsTimeseriesSeriesType.Scatter,
+ markerSize: 7,
+ timeShiftColor: false,
+ };
+
+ const result = transformSeries(series, mockColorScale, 'test-key', opts);
+
+ expect((result as any).symbolSize).toBe(7);
Review Comment:
**Suggestion:** Remove this `any` cast and assert through a concrete type or
narrowed generic for the series object so the fallback `symbolSize` check
remains type-safe. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This line uses an `any` cast in newly added TypeScript test code, which is
directly covered by the custom rule against `any` in modified TS/TSX code.
</details>
[Fix in
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ed8ed9fcf9924e25b1921263ae1526ff&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
| [Fix in VSCode
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=ed8ed9fcf9924e25b1921263ae1526ff&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/test/Timeseries/transformers.test.ts
**Line:** 155:155
**Comment:**
*Custom Rule: Remove this `any` cast and assert through a concrete type
or narrowed generic for the series object so the fallback `symbolSize` check
remains type-safe.
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%2F40967&comment_hash=038d1b379d8f3d05369fdb295d1c6ef52deb3d9102b1404ed8b07ef159fef4e7&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40967&comment_hash=038d1b379d8f3d05369fdb295d1c6ef52deb3d9102b1404ed8b07ef159fef4e7&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]