bito-code-review[bot] commented on code in PR #39990: URL: https://github.com/apache/superset/pull/39990#discussion_r3213212751
########## superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/types.ts: ########## @@ -0,0 +1,53 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { QueryFormData } from '@superset-ui/core'; +import { + BaseChartProps, + BaseTransformedProps, + ContextMenuTransformedProps, + CrossFilterTransformedProps, + TitleFormData, +} from '../types'; +import { DEFAULT_TITLE_FORM_DATA } from '../constants'; + +export type CandlestickQueryFormData = QueryFormData & { + /** Metric for the opening price */ + open?: string; + /** Metric for the closing price */ + close?: string; + /** Metric for the lowest price */ + low?: string; + /** Metric for the highest price */ + high?: string; + /** Enable/disable zoom features */ + zoomable?: boolean; +} & TitleFormData; Review Comment: <div> <div id="suggestion"> <div id="issue"><b>Type Mismatch in Form Data</b></div> <div id="fix"> The metric fields open, close, low, high are typed as optional strings, but the control panel defines them as required QueryFormMetric controls. This type mismatch violates TypeScript best practices and can lead to type safety issues. Change them to required QueryFormMetric and add the import. </div> <details> <summary> <b>Code suggestion</b> </summary> <blockquote>Check the AI-generated fix before applying</blockquote> <div id="code"> ``` --- a/superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/types.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/types.ts @@ -19,6 +19,7 @@ import { QueryFormData } from '@superset-ui/core'; import { BaseChartProps, BaseTransformedProps, ContextMenuTransformedProps, CrossFilterTransformedProps, TitleFormData, } from '../types'; +import { QueryFormMetric } from '@superset-ui/core'; import { DEFAULT_TITLE_FORM_DATA } from '../constants'; export type CandlestickQueryFormData = QueryFormData & { /** Metric for the opening price */ - open?: string; + open: QueryFormMetric; /** Metric for the closing price */ - close?: string; + close: QueryFormMetric; /** Metric for the lowest price */ - low?: string; + low: QueryFormMetric; /** Metric for the highest price */ - high?: string; + high: QueryFormMetric; /** Enable/disable zoom features */ zoomable?: boolean; } & TitleFormData; ``` </div> </details> </div> <details> <summary><b>Citations</b></summary> <ul> <li> Rule Violated: <a href="https://github.com/apache/superset/blob/90c89ac/.cursor/rules/dev-standard.mdc#L16">dev-standard.mdc:16</a> </li> </ul> </details> <small><i>Code Review Run #7d3f19</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]
