codeant-ai-for-open-source[bot] commented on code in PR #41221:
URL: https://github.com/apache/superset/pull/41221#discussion_r3440427068
##########
superset-frontend/packages/superset-ui-chart-controls/test/shared-controls/customControls.test.tsx:
##########
@@ -55,3 +55,27 @@ test('xAxisForceCategoricalControl should not treat temporal
columns as categori
mockCheckColumnType.mockClear();
});
+
+test('xAxisForceCategoricalControl is visible for numeric and temporal
x-axes', () => {
+ const mockCheckColumnType = jest.mocked(checkColumnType);
+ mockCheckColumnType.mockReturnValue(true);
+
+ const controls = {
+ x_axis: { value: 'date_column' },
+ datasource: { datasource: {} },
+ };
+
+ const visible = xAxisForceCategoricalControl.config.visibility!({
+ controls,
+ } as any);
Review Comment:
**Suggestion:** Replace the `as any` cast with a concrete state type (for
example, the existing control panel state shape) so the visibility callback is
exercised with type-safe input. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This is a newly added TypeScript test snippet, and it uses `as any`. The
custom rule explicitly forbids new or modified TS/TSX code from using `any`,
even in tests, unless replaced with a concrete or reusable type. The suggestion
accurately identifies a real rule violation.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=9338b0757ffa4221b0b83fdb406d85ca&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=9338b0757ffa4221b0b83fdb406d85ca&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/packages/superset-ui-chart-controls/test/shared-controls/customControls.test.tsx
**Line:** 68:70
**Comment:**
*Custom Rule: Replace the `as any` cast with a concrete state type (for
example, the existing control panel state shape) so the visibility callback is
exercised with type-safe input.
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%2F41221&comment_hash=0fff4ab6d3ca94ea1f8a895e95b48d05aaa42510b5bb0390388038aa8eb9668b&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41221&comment_hash=0fff4ab6d3ca94ea1f8a895e95b48d05aaa42510b5bb0390388038aa8eb9668b&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]