feat: enable translation or customization of the constants "<NULL>", "TRUE", "FALSE" and "<empty string>"#40919
Conversation
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #40919 +/- ##
==========================================
- Coverage 64.17% 64.17% -0.01%
==========================================
Files 2654 2654
Lines 143763 143763
Branches 33161 33161
==========================================
- Hits 92260 92255 -5
- Misses 49887 49890 +3
- Partials 1616 1618 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review Agent Run #f1b1a5
Actionable Suggestions - 1
-
superset-frontend/src/explore/components/controls/CollectionControl/CollectionControl.test.tsx - 1
- Mock targets non-existent export · Line 23-23
Additional Suggestions - 3
-
superset-frontend/plugins/plugin-chart-echarts/src/constants.ts - 1
-
Missing Python backend constants · Line 32-35The diff adds TRUE_STRING and FALSE_STRING with a comment directing developers to also update constants.py, but these constants are missing from the Python backend file. The existing NULL_STRING and EMPTY_STRING are already mirrored in constants.py (lines 30-31), but TRUE_STRING and FALSE_STRING are not. This creates an inconsistency that could cause issues if backend code needs to reference these values.
-
-
superset-frontend/plugins/plugin-chart-echarts/src/Waterfall/transformProps.ts - 1
-
Dead code removal needed · Line 72-74The diff correctly changes `NULL_STRING` to `NULL_STRING()` (calling the function). However, the entire code block (lines 72-74) is dead code — after `return ''` at line 68, `series` is guaranteed truthy, making `if (!series)` at line 72 unreachable. The proper fix is to delete lines 72-74 entirely rather than fixing code that can never execute.
-
-
superset-frontend/src/components/FilterableTable/useCellContentParser.ts - 1
-
Inconsistent null label text · Line 25-25The `NULL_STRING` now returns `'NULL'` but `plugin-chart-echarts/src/constants.ts:33` uses `''` with angle brackets. Users may see inconsistent null representations depending on the displaying component.
-
Filtered by Review Rules
Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
-
superset-frontend/plugins/plugin-chart-echarts/test/utils/series.test.ts - 1
- Test passes function instead of calling it · Line 1354-1354
Review Details
-
Files reviewed - 18 · Commit Range:
a052f97..a052f97- superset-frontend/plugins/plugin-chart-echarts/src/Bubble/transformProps.ts
- superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/transformProps.ts
- superset-frontend/plugins/plugin-chart-echarts/src/Treemap/EchartsTreemap.tsx
- superset-frontend/plugins/plugin-chart-echarts/src/Waterfall/transformProps.ts
- superset-frontend/plugins/plugin-chart-echarts/src/constants.ts
- superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts
- superset-frontend/plugins/plugin-chart-echarts/test/utils/series.test.ts
- superset-frontend/src/components/FilterableTable/useCellContentParser.test.ts
- superset-frontend/src/components/FilterableTable/useCellContentParser.ts
- superset-frontend/src/components/FilterableTable/utils.tsx
- superset-frontend/src/explore/components/controls/CollectionControl/CollectionControl.test.tsx
- superset-frontend/src/explore/exploreUtils/getSimpleSQLExpression.test.ts
- superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx
- superset-frontend/src/filters/utils.test.ts
- superset-frontend/src/filters/utils.ts
- superset-frontend/src/utils/common.test.tsx
- superset-frontend/src/utils/common.ts
- superset/constants.py
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- Eslint (Linter) - ✔︎ Successful
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
Bito Usage Guide
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 documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.
Documentation & Help
| import CollectionControl from '.'; | ||
|
|
||
| jest.mock('@superset-ui/chart-controls', () => ({ | ||
| ...jest.requireActual('@superset-ui/chart-controls'), |
There was a problem hiding this comment.
The mock targets InfoTooltip from @superset-ui/chart-controls, but this component is not exported from that module. The actual source imports InfoTooltip from @superset-ui/core/components (see ControlHeader.tsx:22). This mock will have no effect and may cause test failures.
Code suggestion
Check the AI-generated fix before applying
--- superset-frontend/src/explore/components/controls/CollectionControl/CollectionControl.test.tsx
+++ superset-frontend/src/explore/components/controls/CollectionControl/CollectionControl.test.tsx
@@ -19,7 +19,7 @@ import { render, screen, userEvent } from 'spec/helpers/testing-library';
import CollectionControl from '.';
jest.mock('@superset-ui/chart-controls', () => ({
- ...jest.requireActual('@superset-ui/chart-controls'),
+ ...jest.requireActual('@superset-ui/chart-controls'),
InfoTooltip: (props: any) => (
<button
onClick={props.onClick}
type="button"
data-icon={props.icon}
data-tooltip={props.tooltip}
>
{props.label}
</button>
),
}));
jest.mock('@superset-ui/core/components', () => ({
...jest.requireActual('@superset-ui/core/components'),
InfoTooltip: (props: any) => (
<button
onClick={props.onClick}
type="button"
data-icon={props.icon}
data-tooltip={props.tooltip}
>
{props.label}
</button>
),
}));
Code Review Run #f1b1a5
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
…LL", "TRUE", "FALSE" and "<empty string>"
2cc6bab to
8393ff8
Compare
SUMMARY
This PR aims to easily allow translation or customization of the constants
<NULL>,TRUE,FALSE, and<empty string>.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Here is an example of customizing
<NULL>into French, before and after:TESTING INSTRUCTIONS
To test this change, you must first translate the strings in question and observe the screens where they may be displayed.
ADDITIONAL INFORMATION