bito-code-review[bot] commented on code in PR #36760:
URL: https://github.com/apache/superset/pull/36760#discussion_r2637366365
##########
superset-frontend/src/explore/controlUtils/standardizedFormData.ts:
##########
@@ -211,13 +211,15 @@ export class StandardizedFormData {
publicFormData[key] = exploreState.form_data[key];
}
});
- const targetControlsState = getControlsState(exploreState, {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const targetControlsState = getControlsState(exploreState as any, {
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Type Safety Violation</b></div>
<div id="fix">
This change adds 'as any' casts to bypass TypeScript type checking, which
violates the project's development standards that explicitly prohibit 'any'
types. The ExploreState interface appears incomplete compared to actual usage.
</div>
</div>
<details>
<summary><b>Citations</b></summary>
<ul>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/.cursor/rules/dev-standard.mdc#L16">dev-standard.mdc:16</a>
</li>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/AGENTS.md#L57">AGENTS.md:57</a>
</li>
</ul>
</details>
<small><i>Code Review Run #14ed29</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/SqlLab/actions/sqlLab.ts:
##########
@@ -1242,23 +1541,25 @@ export function popSavedQuery(saveQueryId) {
...convertQueryToClient(json.result),
loaded: true,
autorun: false,
- };
+ } as Record<string, unknown>;
const tmpAdaptedProps = {
- name: queryEditorProps.name,
- dbId: queryEditorProps.database.id,
- catalog: queryEditorProps.catalog,
- schema: queryEditorProps.schema,
- sql: queryEditorProps.sql,
- templateParams: queryEditorProps.templateParams,
- remoteId: queryEditorProps.remoteId,
+ name: queryEditorProps.name as string,
+ dbId: (queryEditorProps.database as { id: number }).id,
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Unsafe type assertion may throw</b></div>
<div id="fix">
The assertion `queryEditorProps.catalog as string` assumes `catalog` is
always a string, but if the API returns `null` (allowed by
QueryEditor.catalog?: string | null), this throws a runtime TypeError. Consider
safe casting or null handling.
</div>
</div>
<details>
<summary><b>Citations</b></summary>
<ul>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/.cursor/rules/dev-standard.mdc#L16">dev-standard.mdc:16</a>
</li>
</ul>
</details>
<small><i>Code Review Run #14ed29</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/explore/controlUtils/standardizedFormData.ts:
##########
@@ -243,14 +245,18 @@ export class StandardizedFormData {
getStandardizedControls().clear();
rv = {
formData: transformed,
- controlsState: getControlsState(exploreState, transformed),
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ controlsState: getControlsState(exploreState as any, transformed),
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Type Safety Violation</b></div>
<div id="fix">
This change adds 'as any' casts to bypass TypeScript type checking, which
violates the project's development standards that explicitly prohibit 'any'
types. The ExploreState interface appears incomplete compared to actual usage.
</div>
</div>
<details>
<summary><b>Citations</b></summary>
<ul>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/.cursor/rules/dev-standard.mdc#L16">dev-standard.mdc:16</a>
</li>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/AGENTS.md#L57">AGENTS.md:57</a>
</li>
</ul>
</details>
<small><i>Code Review Run #14ed29</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/explore/controlUtils/standardizedFormData.ts:
##########
@@ -211,13 +211,15 @@ export class StandardizedFormData {
publicFormData[key] = exploreState.form_data[key];
}
});
- const targetControlsState = getControlsState(exploreState, {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const targetControlsState = getControlsState(exploreState as any, {
...latestFormData,
...publicFormData,
viz_type: targetVizType,
});
const targetFormData = {
- ...getFormDataFromControls(targetControlsState),
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ ...getFormDataFromControls(targetControlsState as any),
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Type Safety Violation</b></div>
<div id="fix">
This change adds 'as any' casts to bypass TypeScript type checking, which
violates the project's development standards that explicitly prohibit 'any'
types. The ExploreState interface appears incomplete compared to actual usage.
</div>
</div>
<details>
<summary><b>Citations</b></summary>
<ul>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/.cursor/rules/dev-standard.mdc#L16">dev-standard.mdc:16</a>
</li>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/AGENTS.md#L57">AGENTS.md:57</a>
</li>
</ul>
</details>
<small><i>Code Review Run #14ed29</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/explore/components/controls/SelectControl.tsx:
##########
@@ -316,11 +370,9 @@ export default class SelectControl extends PureComponent {
}
`}
>
- <Select {...selectProps} />
+ {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
+ <Select {...(selectProps as any)} />
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Type Safety Violation</b></div>
<div id="fix">
The code introduces a type cast to 'any' and disables the TypeScript eslint
rule for no-explicit-any, which violates the project's standards prohibiting
'any' types. This reduces type safety and could lead to runtime errors if the
selectProps don't fully match the Select component's expected props. The Select
component expects strict typing, but selectProps includes properties like
sortComparator with mismatched signatures (e.g., label as ReactNode vs string).
Consider refactoring the types to ensure compatibility without bypassing
TypeScript checks.
</div>
</div>
<details>
<summary><b>Citations</b></summary>
<ul>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/.cursor/rules/dev-standard.mdc#L16">dev-standard.mdc:16</a>
</li>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/AGENTS.md#L10">AGENTS.md:10</a>
</li>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/AGENTS.md#L57">AGENTS.md:57</a>
</li>
</ul>
</details>
<small><i>Code Review Run #14ed29</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/explore/controlUtils/standardizedFormData.ts:
##########
@@ -243,14 +245,18 @@ export class StandardizedFormData {
getStandardizedControls().clear();
rv = {
formData: transformed,
- controlsState: getControlsState(exploreState, transformed),
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ controlsState: getControlsState(exploreState as any, transformed),
};
}
// refresh validator message
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
rv.controlsState = getControlsState(
- { ...exploreState, controls: rv.controlsState },
- rv.formData,
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ { ...exploreState, controls: rv.controlsState } as any,
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ rv.formData as any,
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Type Safety Violation</b></div>
<div id="fix">
This change adds 'as any' casts to bypass TypeScript type checking, which
violates the project's development standards that explicitly prohibit 'any'
types. The ExploreState interface appears incomplete compared to actual usage.
</div>
</div>
<details>
<summary><b>Citations</b></summary>
<ul>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/.cursor/rules/dev-standard.mdc#L16">dev-standard.mdc:16</a>
</li>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/AGENTS.md#L57">AGENTS.md:57</a>
</li>
</ul>
</details>
<small><i>Code Review Run #14ed29</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnMetricSelect.tsx:
##########
@@ -344,10 +345,14 @@ function DndColumnMetricSelect(props:
DndColumnMetricSelectProps) {
onChange(multi ? newValues : newValues[0]);
}}
onRemoveMetric={onClickClose}
- columns={columns}
- savedMetrics={savedMetrics}
- savedMetricsOptions={savedMetrics}
- datasource={datasource}
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ columns={columns as any}
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ savedMetrics={savedMetrics as any}
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ savedMetricsOptions={savedMetrics as any}
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ datasource={datasource as any}
onMoveLabel={onShiftOptions}
onDropLabel={() => {}}
type={`${DndItemType.AdhocMetricOption}_${name}_${label}`}
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Type Safety Violation</b></div>
<div id="fix">
The changes add multiple `as any` type assertions and disable the eslint
rule for no-explicit-any, which violates the project's development standards
that explicitly prohibit `any` types in favor of proper TypeScript typing. This
undermines type safety and could lead to runtime errors if the actual types
don't match expectations. Instead of bypassing TypeScript, the types should be
properly aligned or cast to compatible types.
</div>
</div>
<details>
<summary><b>Citations</b></summary>
<ul>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/.cursor/rules/dev-standard.mdc#L16">dev-standard.mdc:16</a>
</li>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/AGENTS.md#L10">AGENTS.md:10</a>
</li>
</ul>
</details>
<small><i>Code Review Run #14ed29</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/explore/components/controls/MetricControl/MetricsControl.tsx:
##########
@@ -99,21 +103,38 @@ function coerceAdhocMetrics(value) {
const emptySavedMetric = { metric_name: '', expression: '' };
// TODO: use typeguards to distinguish saved metrics from adhoc metrics
-const getMetricsMatchingCurrentDataset = (value, columns, savedMetrics) =>
- ensureIsArray(value).filter(metric => {
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+const getMetricsMatchingCurrentDataset = (value: any, columns: any,
savedMetrics: any) =>
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ ensureIsArray(value).filter((metric: any) => {
if (typeof metric === 'string' || metric.metric_name) {
return savedMetrics?.some(
- savedMetric =>
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ (savedMetric: any) =>
savedMetric.metric_name === metric ||
savedMetric.metric_name === metric.metric_name,
);
}
return columns?.some(
- column =>
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ (column: any) =>
!metric.column || metric.column.column_name === column.column_name,
);
});
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Type Safety Violation</b></div>
<div id="fix">
The changes add 'as any' type assertions and eslint disables for
@typescript-eslint/no-explicit-any, violating the development standards that
explicitly prohibit 'any' types in favor of proper TypeScript typing. The TODO
comment suggests using typeguards to distinguish metric types, but instead
'any' is used throughout, which defeats TypeScript's type safety. Consider
importing typeguards from @superset-ui/core/src/query/types/Metric and defining
proper union types for parameters.
</div>
</div>
<details>
<summary><b>Citations</b></summary>
<ul>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/.cursor/rules/dev-standard.mdc#L15">dev-standard.mdc:15</a>
</li>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/AGENTS.md#L56">AGENTS.md:56</a>
</li>
</ul>
</details>
<small><i>Code Review Run #14ed29</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/SqlLab/actions/sqlLab.ts:
##########
@@ -1242,23 +1541,25 @@ export function popSavedQuery(saveQueryId) {
...convertQueryToClient(json.result),
loaded: true,
autorun: false,
- };
+ } as Record<string, unknown>;
const tmpAdaptedProps = {
- name: queryEditorProps.name,
- dbId: queryEditorProps.database.id,
- catalog: queryEditorProps.catalog,
- schema: queryEditorProps.schema,
- sql: queryEditorProps.sql,
- templateParams: queryEditorProps.templateParams,
- remoteId: queryEditorProps.remoteId,
+ name: queryEditorProps.name as string,
+ dbId: (queryEditorProps.database as { id: number }).id,
+ catalog: queryEditorProps.catalog as string,
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Unsafe type assertion may throw</b></div>
<div id="fix">
Similar to catalog, `schema as string` risks TypeError if null from API.
</div>
</div>
<details>
<summary><b>Citations</b></summary>
<ul>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/.cursor/rules/dev-standard.mdc#L16">dev-standard.mdc:16</a>
</li>
</ul>
</details>
<small><i>Code Review Run #14ed29</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx:
##########
@@ -195,7 +195,8 @@ const SqlEditorLeftBar = ({ queryEditorId }:
SqlEditorLeftBarProps) => {
const handleDbList = useCallback(
(result: DatabaseObject) => {
- dispatch(setDatabases(result));
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ dispatch(setDatabases(result as any));
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Type Safety Violation</b></div>
<div id="fix">
Using 'as any' bypasses TypeScript type safety and violates project
guidelines prohibiting 'any' types. The cast masks a type mismatch between
DatabaseObject and the expected Record<string, Database>. Consider fixing the
underlying type inconsistency instead.
</div>
</div>
<details>
<summary><b>Citations</b></summary>
<ul>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/.cursor/rules/dev-standard.mdc#L16">dev-standard.mdc:16</a>
</li>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/fcf2d2f/AGENTS.md#L57">AGENTS.md:57</a>
</li>
</ul>
</details>
<small><i>Code Review Run #14ed29</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]