You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "worker24h (via GitHub)" <gi...@apache.org> on 2023/06/19 08:41:07 UTC
[GitHub] [superset] worker24h opened a new pull request, #24444: feature: add distance unit
worker24h opened a new pull request, #24444:
URL: https://github.com/apache/superset/pull/24444
### SUMMARY
This feature implements distance units, such as **meters** to **kilometers**
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

### TESTING INSTRUCTIONS
- Modify the Y-axis drop-down options
### ADDITIONAL INFORMATION
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] worker24h commented on a diff in pull request #24444: feature: add distance unit
Posted by "worker24h (via GitHub)" <gi...@apache.org>.
worker24h commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r1241376762
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export default function createLengthFormatter(config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: string;
+}) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: value => {
Review Comment:
I got it, I will be to add it
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r3462237762
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export type LengthConvertType = 'm => km' | 'cm => km' | 'cm => m';
+
+export default function createLengthFormatter(
+ config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: LengthConvertType;
+ } = {},
+) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: (value: number) => {
+ if (convertType === 'm => km') {
+ return `${(value / 1000).toFixed(2)}km`;
+ }
+ if (convertType === 'cm => km') {
+ return `${(value / 100_000).toFixed(2)}km`;
+ }
+ if (convertType === 'cm => m') {
+ return `${(value / 100).toFixed(2)}m`;
+ }
+ return value.toString();
+ },
+ id: id ?? 'length_format',
+ label: label ?? `Length formatter`,
+ });
+}
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing test coverage</b></div>
<div id="fix">
Missing unit tests for `createLengthFormatter`. All other formatter factories in this directory have corresponding test files (createDurationFormatter.test.ts, createMemoryFormatter.test.ts, createSmartNumberFormatter.test.ts, etc.), but `createLengthFormatter` lacks test coverage. Per BITO.md rule [11730], new tools need comprehensive unit tests covering success paths, error scenarios, and edge cases.
</div>
</div>
<small><i>Code Review Run #2811cd</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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-4782513170
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] justinpark commented on a diff in pull request #24444: feature: add distance unit
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r1235718876
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export default function createLengthFormatter(config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: string;
+}) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: value => {
Review Comment:
@worker24h could you add a unit test for this formatting cases?
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r3485975401
##########
superset-frontend/packages/superset-ui-core/src/number-format/index.ts:
##########
@@ -35,3 +35,4 @@ export { default as createMemoryFormatter } from './factories/createMemoryFormat
export { default as createSiAtMostNDigitFormatter } from './factories/createSiAtMostNDigitFormatter';
export { default as createSmartNumberFormatter } from './factories/createSmartNumberFormatter';
export { default as getSmallNumberFormatter } from './getSmallNumberFormatter';
+export { default as createLengthFormatter } from './factories/createLengthFormatter';
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing export in index test</b></div>
<div id="fix">
The `index.test.ts` file verifies all exported symbols are defined, but `createLengthFormatter` is missing from both the import list (line 20-31) and the verification array (line 35-46). Other factory functions like `createD3NumberFormatter`, `createDurationFormatter`, `createMemoryFormatter`, and `createSiAtMostNDigitFormatter` are all tested. Adding this export to the index test ensures the exported symbol is verified at module load time.
</div>
</div>
<small><i>Code Review Run #397e22</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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-4042287815
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r3530304328
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export type LengthConvertType = 'm => km' | 'cm => km' | 'cm => m';
+
+export default function createLengthFormatter(
+ config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: LengthConvertType;
+ } = {},
+) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: (value: number) => {
+ if (convertType === 'm => km') {
+ return `${(value / 1000).toFixed(2)}km`;
+ }
+ if (convertType === 'cm => km') {
+ return `${(value / 100_000).toFixed(2)}km`;
+ }
+ if (convertType === 'cm => m') {
+ return `${(value / 100).toFixed(2)}m`;
+ }
+ return value.toString();
+ },
+ id: id ?? 'length_format',
+ label: label ?? `Length formatter`,
+ });
+}
Review Comment:
<!-- Bito Reply -->
The test coverage for `createLengthFormatter` has been addressed. The new test file covers the instance creation, default ID and label, all three conversion types, the passthrough behavior when no conversion type is specified, and custom configuration.
##########
superset-frontend/packages/superset-ui-core/src/number-format/index.ts:
##########
@@ -35,3 +35,4 @@ export { default as createMemoryFormatter } from './factories/createMemoryFormat
export { default as createSiAtMostNDigitFormatter } from './factories/createSiAtMostNDigitFormatter';
export { default as createSmartNumberFormatter } from './factories/createSmartNumberFormatter';
export { default as getSmallNumberFormatter } from './getSmallNumberFormatter';
+export { default as createLengthFormatter } from './factories/createLengthFormatter';
Review Comment:
<!-- Bito Reply -->
The suggestions provided by the reviewer are intended to ensure code quality and consistency within the project. The first suggestion addresses a missing export in the index test, which is a standard practice to verify that all exported symbols are correctly defined and accessible. The second suggestion identifies a lack of unit tests for the new factory, which is important for maintaining test coverage and ensuring the reliability of new features. Whether to avoid such suggestions depends on your project's specific requirements for test coverage and module verification, but these are generally considered standard best practices.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] worker24h commented on a diff in pull request #24444: feature: add distance unit
Posted by "worker24h (via GitHub)" <gi...@apache.org>.
worker24h commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r1241378323
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export default function createLengthFormatter(config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: string;
+}) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: value => {
+ if (convertType === 'm => km') {
Review Comment:
Do you mean to keep only one **m => km** ?
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-4458375945
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r3616138056
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export type LengthConvertType = 'm => km' | 'cm => km' | 'cm => m';
+
+export default function createLengthFormatter(
+ config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: LengthConvertType;
+ } = {},
+) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: (value: number) => {
+ if (convertType === 'm => km') {
+ return `${(value / 1000).toFixed(2)}km`;
+ }
+ if (convertType === 'cm => km') {
+ return `${(value / 100_000).toFixed(2)}km`;
+ }
+ if (convertType === 'cm => m') {
+ return `${(value / 100).toFixed(2)}m`;
+ }
+ return value.toString();
Review Comment:
**Suggestion:** The fallback branch calls `.toString()` directly, which will throw at runtime when chart/table values are nullish (a common case in Superset metric results). Add a null/undefined-safe conversion path before stringifying so missing values do not crash formatting. [null pointer]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Length formatter crashes when value is null/undefined.
- ⚠️ Charts/tables with missing lengths fail to render.
```
</details>
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Use the new length formatter by importing `createLengthFormatter` from
`superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:24`
and calling it with `convertType` omitted or an unrecognized value, so the fallback branch
is used.
2. In Superset's number-format pipeline, pass a metric value that is `null` or `undefined`
into the resulting `NumberFormatter` instance, which invokes the `formatFunc` defined at
`createLengthFormatter.ts:36`.
3. Because `convertType` does not match any of the three explicit branches (`'m => km'`,
`'cm => km'`, `'cm => m'` at lines 37–44), execution falls through to the fallback `return
value.toString();` at `createLengthFormatter.ts:46`.
4. At runtime, JavaScript evaluates `null.toString()` / `undefined.toString()`, which
throws a `TypeError` and causes the formatting operation (and thus the chart/table
rendering using this formatter) to fail.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=9049a41340784f50b8474019d7fecd89&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=9049a41340784f50b8474019d7fecd89&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-core/src/number-format/factories/createLengthFormatter.ts
**Line:** 46:46
**Comment:**
*Null Pointer: The fallback branch calls `.toString()` directly, which will throw at runtime when chart/table values are nullish (a common case in Superset metric results). Add a null/undefined-safe conversion path before stringifying so missing values do not crash formatting.
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%2F24444&comment_hash=4c16486796f91955ad1cefdc64d4f55702a908b3629b11e81509e3f2136f08a4&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F24444&comment_hash=4c16486796f91955ad1cefdc64d4f55702a908b3629b11e81509e3f2136f08a4&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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-4084242732
## **Sequence Diagram**
This PR adds new distance format choices and registers matching length formatters at app setup. When a user selects one of these options, chart values are converted from meters or centimeters into larger units and displayed with unit suffixes.
```mermaid
sequenceDiagram
participant AppSetup
participant FormatterRegistry
participant ChartUI
participant LengthFormatter
participant ChartRender
AppSetup->>FormatterRegistry: Register LENGTH LENGTH_CM_KM LENGTH_CM_M formatters
ChartUI->>ChartUI: Show new distance options in format dropdown
ChartUI->>FormatterRegistry: Request selected distance formatter
FormatterRegistry-->>LengthFormatter: Return configured conversion formatter
ChartRender->>LengthFormatter: Format numeric value
LengthFormatter-->>ChartRender: Return converted value with unit suffix
```
---
*Generated by [CodeAnt AI](https://codeant.ai)*
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-4783148807
Looking again after the rebase. This is a nice addition, but `createLengthFormatter` has no test. Every other formatter factory in that dir has one, and codecov shows the new lines uncovered. Mind adding a `createLengthFormatter.test.ts` covering the three conversions? That'll help get it across the finish line.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-4781116236
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/24444?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `0%` with `14 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 64.36%. Comparing base ([`3ff90bd`](https://app.codecov.io/gh/apache/superset/commit/3ff90bd532c903347dd81ad612aa347c2f31cc12?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`7b449fe`](https://app.codecov.io/gh/apache/superset/commit/7b449fe515818eba7f343fbaa8fe57cb43492e2b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/24444?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...c/number-format/factories/createLengthFormatter.ts](https://app.codecov.io/gh/apache/superset/pull/24444?src=pr&el=tree&filepath=superset-frontend%2Fpackages%2Fsuperset-ui-core%2Fsrc%2Fnumber-format%2Ffactories%2FcreateLengthFormatter.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvbnVtYmVyLWZvcm1hdC9mYWN0b3JpZXMvY3JlYXRlTGVuZ3RoRm9ybWF0dGVyLnRz) | 0.00% | [14 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/24444?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
:x: Your project check has failed because the head coverage (99.68%) is below the target coverage (100.00%). You can increase the head coverage or adjust the [target](https://docs.codecov.com/docs/commit-status#target) coverage.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #24444 +/- ##
==========================================
- Coverage 64.37% 64.36% -0.01%
==========================================
Files 2653 2654 +1
Lines 144973 144987 +14
Branches 33444 33450 +6
==========================================
Hits 93328 93328
- Misses 49959 49973 +14
Partials 1686 1686
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/24444/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [javascript](https://app.codecov.io/gh/apache/superset/pull/24444/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `68.63% <0.00%> (-0.02%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/24444?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-4780940141
I'll see about helping with the rebase....
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feature: add distance unit [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-4041952500
Rebased onto master and resolved conflicts (two files had additions since May 2023: new formatter types in `D3Formatting.ts` and new formatters in `setupFormatters.ts`). All pre-commit checks pass. Also rebuilt the `superset-ui-core` package so the new `createLengthFormatter` export is included in the compiled output.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r2955059073
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export default function createLengthFormatter(config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: string;
+}) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: value => {
+ if (convertType === 'm => km') {
+ return `${(value / 1000).toFixed(2).toString()}KM`;
+ }
+ if (convertType === 'cm => km') {
+ return `${(value / 100_000).toFixed(2).toString()}KM`;
+ }
+ if (convertType === 'cm => m') {
+ return `${(value / 100).toFixed(2).toString()}M`;
+ }
Review Comment:
**Suggestion:** The formatter appends `KM`/`M`, but the feature text and registered option descriptions use SI unit symbols `km`/`m`; returning uppercase units produces incorrect user-facing unit labels. [logic error]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Y-axis and tooltip units display incorrect SI casing.
- ⚠️ Dropdown examples and rendered labels become inconsistent.
```
</details>
```suggestion
if (convertType === 'm => km') {
return `${(value / 1000).toFixed(2).toString()}km`;
}
if (convertType === 'cm => km') {
return `${(value / 100_000).toFixed(2).toString()}km`;
}
if (convertType === 'cm => m') {
return `${(value / 100).toFixed(2).toString()}m`;
}
```
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. App initialization runs `setupFormatters()` from
`superset-frontend/src/preamble.ts:57-60`, registering `LENGTH`, `LENGTH_CM_KM`, and
`LENGTH_CM_M` with `createLengthFormatter(...)` at
`superset-frontend/src/setup/setupFormatters.ts:96-103`.
2. Explore control dropdown exposes these options through `D3_FORMAT_OPTIONS`
(`superset-frontend/packages/superset-ui-chart-controls/src/utils/D3Formatting.ts:71-73`),
and `y_axis_format` uses those choices in `sharedControls.tsx:301-309`.
3. After selecting one of these formats, chart rendering obtains the formatter via
`getTimeOrNumberFormatter()` (`plugins/legacy-preset-chart-nvd3/src/utils.ts:49-52`) and
applies it to axis ticks/labels/tooltips in `NVD3Vis.ts:41`, `NVD3Vis.ts:56`, and
`NVD3Vis.ts:199-214`.
4. The formatter output comes from `createLengthFormatter.ts:34`, `:37`, `:40`, returning
`KM`/`M`, which conflicts with option text/examples using `km`/`m` in
`D3Formatting.ts:71-73`.
```
</details>
<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-core/src/number-format/factories/createLengthFormatter.ts
**Line:** 33:41
**Comment:**
*Logic Error: The formatter appends `KM`/`M`, but the feature text and registered option descriptions use SI unit symbols `km`/`m`; returning uppercase units produces incorrect user-facing unit labels.
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.
```
</details>
<a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F24444&comment_hash=4e0bd99beca83cc3ca37c18e5651541c3153e0d94e2d102f286441e171d00c1e&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F24444&comment_hash=4e0bd99beca83cc3ca37c18e5651541c3153e0d94e2d102f286441e171d00c1e&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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-4888235855
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] justinpark commented on a diff in pull request #24444: feature: add distance unit
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r1235727434
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export default function createLengthFormatter(config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: string;
+}) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: value => {
+ if (convertType === 'm => km') {
Review Comment:
I highly recommend to use `m => km` (and `cm => km` + `cm => m`) in a constant variable to prevent the potential regression.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-4452930952
Patched this up... hoping we can review/merge it.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r3242875330
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export default function createLengthFormatter(config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: string;
+}) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: value => {
+ if (convertType === 'm => km') {
+ return `${(value / 1000).toFixed(2).toString()}KM`;
+ }
+ if (convertType === 'cm => km') {
+ return `${(value / 100_000).toFixed(2).toString()}KM`;
+ }
+ if (convertType === 'cm => m') {
+ return `${(value / 100).toFixed(2).toString()}M`;
+ }
+ return value.toString();
+ },
+ id: id ?? 'length_format',
+ label: label ?? `Length formatter`,
+ });
+}
Review Comment:
Applied in 2ce4aefd68:
- Switched to lowercase SI-correct units (`km`, `m`)
- Dropped the redundant `.toString()` after `.toFixed(2)` (`toFixed` already returns a string)
- Also typed `convertType` as a string-literal union so future callers get compile-time safety
The return type stays inferred to match the sibling `createMemoryFormatter` factory's style.
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export default function createLengthFormatter(config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: string;
+}) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: value => {
+ if (convertType === 'm => km') {
+ return `${(value / 1000).toFixed(2).toString()}KM`;
+ }
+ if (convertType === 'cm => km') {
+ return `${(value / 100_000).toFixed(2).toString()}KM`;
+ }
+ if (convertType === 'cm => m') {
+ return `${(value / 100).toFixed(2).toString()}M`;
Review Comment:
Applied in 2ce4aefd68 — switched to lowercase SI units (`km`/`m`) and removed the redundant `.toString()` calls.
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export default function createLengthFormatter(config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: string;
+}) {
Review Comment:
Applied in 2ce4aefd68 — `config` now defaults to `{}` (matching the `createMemoryFormatter` factory pattern) and `convertType` is typed as a string-literal union `'m => km' | 'cm => km' | 'cm => m'` for compile-time safety.
##########
superset-frontend/packages/superset-ui-chart-controls/src/utils/D3Formatting.ts:
##########
@@ -68,6 +68,9 @@ export const D3_FORMAT_OPTIONS: [string, string][] = [
'MEMORY_TRANSFER_RATE_BINARY',
t('Memory transfer rate in bytes - binary (1024B => 1KiB/s)'),
],
+ ['LENGTH', t('Length in m (12345m => 12.34km)')],
+ ['LENGTH_CM_KM', t('Length in cm (12345678cm => 123.45km)')],
Review Comment:
Good catch — verified in node:
```
(12345/1000).toFixed(2) === '12.35' // label said 12.34
(12345678/100000).toFixed(2) === '123.46' // label said 123.45
(12345/100).toFixed(2) === '123.45' // label was correct
```
Fixed the two off-by-one rounding examples in D3Formatting.ts in 2ce4aefd68.
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export default function createLengthFormatter(config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: string;
+}) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: value => {
+ if (convertType === 'm => km') {
+ return `${(value / 1000).toFixed(2).toString()}KM`;
+ }
+ if (convertType === 'cm => km') {
+ return `${(value / 100_000).toFixed(2).toString()}KM`;
+ }
+ if (convertType === 'cm => m') {
+ return `${(value / 100).toFixed(2).toString()}M`;
+ }
Review Comment:
Applied in 2ce4aefd68 — units are now lowercase `km`/`m` per SI convention.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r3530303092
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export type LengthConvertType = 'm => km' | 'cm => km' | 'cm => m';
+
+export default function createLengthFormatter(
+ config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: LengthConvertType;
+ } = {},
+) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: (value: number) => {
+ if (convertType === 'm => km') {
+ return `${(value / 1000).toFixed(2)}km`;
+ }
+ if (convertType === 'cm => km') {
+ return `${(value / 100_000).toFixed(2)}km`;
+ }
+ if (convertType === 'cm => m') {
+ return `${(value / 100).toFixed(2)}m`;
+ }
+ return value.toString();
+ },
+ id: id ?? 'length_format',
+ label: label ?? `Length formatter`,
+ });
+}
Review Comment:
Good catch, and same thing I asked for in my last pass... test added in 08b85bbf2a, covering the instance, default id/label, all three convertTypes, the no-convertType passthrough, and custom config.
##########
superset-frontend/packages/superset-ui-core/src/number-format/index.ts:
##########
@@ -35,3 +35,4 @@ export { default as createMemoryFormatter } from './factories/createMemoryFormat
export { default as createSiAtMostNDigitFormatter } from './factories/createSiAtMostNDigitFormatter';
export { default as createSmartNumberFormatter } from './factories/createSmartNumberFormatter';
export { default as getSmallNumberFormatter } from './getSmallNumberFormatter';
+export { default as createLengthFormatter } from './factories/createLengthFormatter';
Review Comment:
Added in 08b85bbf2a alongside the factory test.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-5026851179
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feature: add distance unit [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-2803096405
This is still in need of conflict resolution (rebase) after quite a while. I'll convert it to draft for now, but it might eventually get closed if it doesn't get brought to a mergeable state.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r2921125040
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export default function createLengthFormatter(config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: string;
+}) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: value => {
+ if (convertType === 'm => km') {
+ return `${(value / 1000).toFixed(2).toString()}KM`;
+ }
+ if (convertType === 'cm => km') {
+ return `${(value / 100_000).toFixed(2).toString()}KM`;
+ }
+ if (convertType === 'cm => m') {
+ return `${(value / 100).toFixed(2).toString()}M`;
+ }
+ return value.toString();
+ },
+ id: id ?? 'length_format',
+ label: label ?? `Length formatter`,
+ });
+}
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Type hint and unit fixes needed</b></div>
<div id="fix">
The function lacks an explicit return type annotation, which violates the requirement for all functions to have type hints. Additionally, .toString() is redundant on toFixed results since they are already strings, and unit abbreviations should follow SI standards with lowercase 'km' and 'm' instead of 'KM' and 'M'.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```
- export default function createLengthFormatter(config: {
- description?: string;
- id?: string;
- label?: string;
- convertType?: string;
- }) {
- const { description, id, label, convertType } = config;
-
- return new NumberFormatter({
- description,
- formatFunc: value => {
- if (convertType === 'm => km') {
- return `${(value / 1000).toFixed(2).toString()}KM`;
- }
- if (convertType === 'cm => km') {
- return `${(value / 100_000).toFixed(2).toString()}KM`;
- }
- if (convertType === 'cm => m') {
- return `${(value / 100).toFixed(2).toString()}M`;
- }
- return value.toString();
- },
- id: id ?? 'length_format',
- label: label ?? `Length formatter`,
- });
- }
+ export default function createLengthFormatter(config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: string;
+ }): NumberFormatter {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: value => {
+ if (convertType === 'm => km') {
+ return `${(value / 1000).toFixed(2)} km`;
+ }
+ if (convertType === 'cm => km') {
+ return `${(value / 100_000).toFixed(2)} km`;
+ }
+ if (convertType === 'cm => m') {
+ return `${(value / 100).toFixed(2)} m`;
+ }
+ return value.toString();
- },
- id: id ?? 'length_format',
- label: label ?? `Length formatter`,
- });
+ },
+ id: id ?? 'length_format',
+ label: label ?? `Length formatter`,
+ });
+ }
```
</div>
</details>
</div>
<small><i>Code Review Run #98ad68</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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-4452724161
### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 2ce4aefd687bf6a64c95e017b4a274693f1e842d |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6a05fbf03374b0000827cddb |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-24444--superset-docs-preview.netlify.app](https://deploy-preview-24444--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
|<span aria-hidden="true">🤖</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#q1YqKMrPLShRslJS0lFKKkrMS84AstNSE0tKi1J1UzKLS4BCqbqleZklQAUpqQU5-ZWeKUAlZokGpmlJaQbGxuYmSQZAYGFknpySkqRUCwA) |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-24444--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #24444:
URL: https://github.com/apache/superset/pull/24444
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-4817345735
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-4896648610
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] worker24h commented on a diff in pull request #24444: feature: add distance unit
Posted by "worker24h (via GitHub)" <gi...@apache.org>.
worker24h commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r1251497658
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export default function createLengthFormatter(config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: string;
+}) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: value => {
+ if (convertType === 'm => km') {
Review Comment:
hello, what is your suggest?
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] worker24h commented on a diff in pull request #24444: feature: add distance unit
Posted by "worker24h (via GitHub)" <gi...@apache.org>.
worker24h commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r1241376915
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export default function createLengthFormatter(config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: string;
+}) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: value => {
+ if (convertType === 'm => km') {
Review Comment:
I got it, I will be to add it
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feature: add distance unit [superset]
Posted by "sfirke (via GitHub)" <gi...@apache.org>.
sfirke commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-2269385702
I see this is quite stale, but looks like a good addition. @worker24h are you still interested in working on this?
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r2955047708
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export default function createLengthFormatter(config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: string;
+}) {
Review Comment:
`createLengthFormatter` requires a `config` argument, unlike the other formatter factories in this folder which default `config` to `{}`. Since this is exported as a public factory, consider giving `config` a default value and typing `convertType` as a string union/enum instead of a free-form string to prevent typos (e.g. mismatched keys between call sites).
##########
superset-frontend/packages/superset-ui-chart-controls/src/utils/D3Formatting.ts:
##########
@@ -68,6 +68,9 @@ export const D3_FORMAT_OPTIONS: [string, string][] = [
'MEMORY_TRANSFER_RATE_BINARY',
t('Memory transfer rate in bytes - binary (1024B => 1KiB/s)'),
],
+ ['LENGTH', t('Length in m (12345m => 12.34km)')],
+ ['LENGTH_CM_KM', t('Length in cm (12345678cm => 123.45km)')],
Review Comment:
The example conversions in these option labels don't match the formatter's `toFixed(2)` rounding behavior (e.g. 12345m => 12.345km rounds to 12.35, not 12.34; similarly 12345678cm rounds to 123.46km). Please adjust the example input values (or the formatter rounding logic) so the text accurately reflects what users will see.
##########
superset-frontend/packages/superset-ui-core/src/number-format/factories/createLengthFormatter.ts:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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 NumberFormatter from '../NumberFormatter';
+
+export default function createLengthFormatter(config: {
+ description?: string;
+ id?: string;
+ label?: string;
+ convertType?: string;
+}) {
+ const { description, id, label, convertType } = config;
+
+ return new NumberFormatter({
+ description,
+ formatFunc: value => {
+ if (convertType === 'm => km') {
+ return `${(value / 1000).toFixed(2).toString()}KM`;
+ }
+ if (convertType === 'cm => km') {
+ return `${(value / 100_000).toFixed(2).toString()}KM`;
+ }
+ if (convertType === 'cm => m') {
+ return `${(value / 100).toFixed(2).toString()}M`;
Review Comment:
The formatted unit suffixes are returned as `KM`/`M`, but the UI option text describes `km`/`m` and SI unit symbols are conventionally lowercase (except where applicable). This will produce user-visible output that doesn't match the option description; please align the formatter output (and consider avoiding the redundant `.toString()` after `toFixed()`).
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-4775655631
@worker24h this has drifted back into merge conflict against `master` again. Mind rebasing once more? Happy to take another look once it's green, and there's any feedback on the comments above.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #24444:
URL: https://github.com/apache/superset/pull/24444#issuecomment-5024569650
CI's failing on `setupFormatters.test.ts` — it can't resolve `createLengthFormatter` from the built `@superset-ui/core` output even though it's exported from source.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: add distance unit [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #24444:
URL: https://github.com/apache/superset/pull/24444#discussion_r3485975401
##########
superset-frontend/packages/superset-ui-core/src/number-format/index.ts:
##########
@@ -35,3 +35,4 @@ export { default as createMemoryFormatter } from './factories/createMemoryFormat
export { default as createSiAtMostNDigitFormatter } from './factories/createSiAtMostNDigitFormatter';
export { default as createSmartNumberFormatter } from './factories/createSmartNumberFormatter';
export { default as getSmallNumberFormatter } from './getSmallNumberFormatter';
+export { default as createLengthFormatter } from './factories/createLengthFormatter';
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing export in index test</b></div>
<div id="fix">
The `index.test.ts` file verifies all exported symbols are defined, but `createLengthFormatter` is missing from both the import list (line 20-31) and the verification array (line 35-46). Other factory functions like `createD3NumberFormatter`, `createDurationFormatter`, `createMemoryFormatter`, and `createSiAtMostNDigitFormatter` are all tested. Adding this export to the index test ensures the exported symbol is verified at module load time.
</div>
</div>
<small><i>Code Review Run #397e22</i></small>
</div><div>
<div id="suggestion">
<div id="issue"><b>Missing unit tests for factory</b></div>
<div id="fix">
The `createLengthFormatter` factory lacks unit tests. Other formatter factories in this module (createD3NumberFormatter, createDurationFormatter, createMemoryFormatter) all have dedicated test files, but no test exists for createLengthFormatter. Add tests covering all convertType options and the default fallback behavior to match established patterns.
</div>
</div>
<small><i>Code Review Run #560f72</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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org