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


##########
superset-frontend/src/explore/components/DataTablesPane/components/useGridResultTable.tsx:
##########
@@ -37,10 +37,28 @@ export function useGridColumns(
             .filter((column: string) => Object.keys(data[0]).includes(column))
             .map((key, index) => {
               const colType = coltypes?.[index];
-              const headerLabel = columnDisplayNames?.[key] ?? key;
+
+              const rawHeader = columnDisplayNames?.[key] ?? key;
+              let cleanHeader = rawHeader;
+
+              try {
+                let jsonToParse = rawHeader;
+                let suffix = '';
+
+                if (rawHeader.endsWith('__contribution')) {
+                  jsonToParse = rawHeader.replace('__contribution', '');
+                  suffix = ' (contribution)';
+                }
+
+                const parsed = JSON.parse(jsonToParse);
+                if (parsed && typeof parsed === 'object' && parsed.label) {
+                  cleanHeader = `${parsed.label}${suffix}`;
+                }
+              } catch (_) {}

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>CWE-6262: Missing test coverage for JSON parsing</b></div>
   <div id="fix">
   
   The new JSON parsing logic introduced by this diff lacks test coverage. 
BITO.md rule [6262] requires tests to verify actual behavior, not just 
rendering. ([CWE-6262](https://cwe.mitre.org/data/definitions/6262.html))
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #a00a35</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to