bito-code-review[bot] commented on code in PR #36760:
URL: https://github.com/apache/superset/pull/36760#discussion_r2637311932


##########
superset-frontend/src/explore/components/controls/MetricControl/MetricsControl.tsx:
##########
@@ -57,13 +57,14 @@ const defaultProps = {
   columns: [],
 };
 
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
 function getOptionsForSavedMetrics(
-  savedMetrics,
-  currentMetricValues,
-  currentMetric,
+  savedMetrics: any,
+  currentMetricValues: any,
+  currentMetric: any,
 ) {

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Type Safety Regression</b></div>
   <div id="fix">
   
   This change introduces `any` types, violating the development standard that 
prohibits `any` types in favor of proper TypeScript types. The functions should 
use union types based on the component's PropTypes definitions.
   </div>
   
   
   </div>
   
   <details>
   <summary><b>Citations</b></summary>
   <ul>
   
   <li>
   Rule Violated: <a 
href="https://github.com/apache/superset/blob/1d07646/.cursor/rules/dev-standard.mdc#L16";>dev-standard.mdc:16</a>
   </li>
   
   <li>
   Rule Violated: <a 
href="https://github.com/apache/superset/blob/1d07646/AGENTS.md#L10";>AGENTS.md:10</a>
   </li>
   
   </ul>
   </details>
   
   
   
   
   <small><i>Code Review Run #2ce9c6</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:
##########
@@ -72,13 +73,15 @@ function getOptionsForSavedMetrics(
   );
 }
 
-function isDictionaryForAdhocMetric(value) {
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function isDictionaryForAdhocMetric(value: any) {
   return value && !(value instanceof AdhocMetric) && value.expressionType;
 }

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Type Safety Issue</b></div>
   <div id="fix">
   
   Using `any` here bypasses type checking. Use `unknown` for safer type guards.
   </div>
   
   
   </div>
   
   <details>
   <summary><b>Citations</b></summary>
   <ul>
   
   <li>
   Rule Violated: <a 
href="https://github.com/apache/superset/blob/1d07646/.cursor/rules/dev-standard.mdc#L16";>dev-standard.mdc:16</a>
   </li>
   
   </ul>
   </details>
   
   
   
   
   <small><i>Code Review Run #2ce9c6</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:
##########
@@ -88,7 +91,8 @@ function coerceAdhocMetrics(value) {
     }
     return [value];
   }
-  return value.map(val => {
+  // eslint-disable-next-line @typescript-eslint/no-explicit-any
+  return value.map((val: any) => {

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Type Safety Issue</b></div>
   <div id="fix">
   
   Using `any` in array map bypasses type safety.
   </div>
   
   
   </div>
   
   <details>
   <summary><b>Citations</b></summary>
   <ul>
   
   <li>
   Rule Violated: <a 
href="https://github.com/apache/superset/blob/1d07646/.cursor/rules/dev-standard.mdc#L16";>dev-standard.mdc:16</a>
   </li>
   
   </ul>
   </details>
   
   
   
   
   <small><i>Code Review Run #2ce9c6</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/AdhocMetricPopoverTrigger.tsx:
##########
@@ -216,12 +216,12 @@ class AdhocMetricPopoverTrigger extends PureComponent<
           adhocMetric={adhocMetric}
           columns={columns}
           savedMetricsOptions={savedMetricsOptions}
-          savedMetric={savedMetric}
-          datasource={datasource}
+          savedMetric={savedMetric as savedMetricType}

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Unsafe Type Assertion on Empty Object</b></div>
   <div id="fix">
   
   The type assertion `savedMetric as savedMetricType` is unsafe because 
savedMetric can be an empty object (Record<string, never>), but SavedMetricType 
requires properties like metric_name. This could cause runtime errors if the 
component accesses properties on an empty object. Pass undefined instead when 
empty, as the prop is optional.
   </div>
   
   
   </div>
   
   <details>
   <summary><b>Citations</b></summary>
   <ul>
   
   <li>
   Rule Violated: <a 
href="https://github.com/apache/superset/blob/1d07646/.cursor/rules/dev-standard.mdc#L16";>dev-standard.mdc:16</a>
   </li>
   
   <li>
   Rule Violated: <a 
href="https://github.com/apache/superset/blob/1d07646/AGENTS.md#L57";>AGENTS.md:57</a>
   </li>
   
   </ul>
   </details>
   
   
   
   
   <small><i>Code Review Run #2ce9c6</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:
##########
@@ -72,13 +73,15 @@ function getOptionsForSavedMetrics(
   );
 }
 
-function isDictionaryForAdhocMetric(value) {
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function isDictionaryForAdhocMetric(value: any) {
   return value && !(value instanceof AdhocMetric) && value.expressionType;
 }
 
 // adhoc metrics are stored as dictionaries in URL params. We convert them 
back into the
 // AdhocMetric class for typechecking, consistency and instance method access.
-function coerceAdhocMetrics(value) {
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function coerceAdhocMetrics(value: any) {

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Type Safety Issue</b></div>
   <div id="fix">
   
   Replace `any` with `unknown` for type-safe value processing.
   </div>
   
   
   </div>
   
   <details>
   <summary><b>Citations</b></summary>
   <ul>
   
   <li>
   Rule Violated: <a 
href="https://github.com/apache/superset/blob/1d07646/.cursor/rules/dev-standard.mdc#L16";>dev-standard.mdc:16</a>
   </li>
   
   </ul>
   </details>
   
   
   
   
   <small><i>Code Review Run #2ce9c6</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]

Reply via email to