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


##########
superset/reports/notifications/slackv2.py:
##########
@@ -98,15 +146,16 @@ def send(self) -> None:
             for channel in channels:
                 if len(files) > 0:
                     for file in files:
-                        client.files_upload_v2(
+                        _call_slack_api(
+                            client.files_upload_v2,
                             channel=channel,
                             file=file,
                             initial_comment=body,
                             title=title,
                             filename=file_name,
                         )
                 else:
-                    client.chat_postMessage(channel=channel, text=body)
+                    _call_slack_api(client.chat_postMessage, channel=channel, 
text=body)

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Duplicate Slack error handling</b></div>
   <div id="fix">
   
   Code duplication detected in Slack notification files. The error handling 
logic (23 lines) is duplicated between 
`superset/reports/notifications/slackv2.py` (lines 158-180) and 
`superset/reports/notifications/slack.py` (lines 117-139). Additionally, helper 
methods (14 lines) are duplicated at `slackv2.py` (lines 116-129) and 
`slack.py` (lines 77-90). Consider extracting these into a shared utility 
module or base class to improve maintainability.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #6adeae</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