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


##########
superset/charts/client_processing.py:
##########
@@ -389,7 +389,9 @@ def apply_client_processing(  # noqa: C901
             query["data"] = processed_df.to_dict()
         elif query["result_format"] == ChartDataResultFormat.CSV:
             buf = StringIO()
-            processed_df.to_csv(buf, index=show_default_index)
+            # Apply CSV_EXPORT config for consistent CSV formatting
+            csv_export_config = current_app.config.get("CSV_EXPORT", {})

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Inconsistent config access pattern</b></div>
   <div id="fix">
   
   Using `.get()` diverges from the codebase pattern of direct dictionary 
access used elsewhere for `CSV_EXPORT`. Since this config is always defined in 
`config.py` (line 1209), direct access is safer — it raises `KeyError` if 
accidentally removed rather than silently producing unformatted CSV with an 
empty dict.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    --- a/superset/charts/client_processing.py
    +++ b/superset/charts/client_processing.py
    @@ -391,3 +391,5 @@ def apply_client_processing(
             elif query["result_format"] == ChartDataResultFormat.CSV:
                 buf = StringIO()
    -            csv_export_config = current_app.config.get("CSV_EXPORT", {})
    +            csv_export_config = current_app.config["CSV_EXPORT"]
                 processed_df.to_csv(buf, index=show_default_index, 
**csv_export_config)
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #78d192</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