Skip to content

fix: remove redundant boolean check in discord/abc.py - #185

Open
sonarqube-agent[bot] wants to merge 1 commit into
masterfrom
remediate-master-20260602-101804-2a3455f8
Open

fix: remove redundant boolean check in discord/abc.py#185
sonarqube-agent[bot] wants to merge 1 commit into
masterfrom
remediate-master-20260602-101804-2a3455f8

Conversation

@sonarqube-agent

Copy link
Copy Markdown

This PR was created because a team member assigned these issues to the Remediation Agent.

Removed an unnecessary ternary expression that always evaluated to true due to prior validation of the around parameter. This fixes a SonarQube MAJOR issue (S2589) by simplifying the conditional logic and improving code clarity.

View Project in SonarCloud


Fixed Issues

pythonbugs:S2589 - Fix this expression which always evaluates to "true". • MAJORView issue

Location: discord/abc.py:1787

Why is this an issue?

Control flow constructs like if-statements allow the programmer to direct the flow of a program depending on a boolean expression. However, if the condition is always true or always false, only one of the branches will ever be executed. In that case, the control flow construct and the condition no longer serve a purpose; they become gratuitous.

What changed

This hunk removes the gratuitous boolean expression if around else None on line 1787 of discord/abc.py. At this point in the code, the around parameter has already been confirmed to be truthy (line 1783 checks not around and this code is in the else branch), so the conditional around if around else None always evaluates to around — making the ternary expression always true and unnecessary. The fix simplifies the expression to just around.id, removing the redundant check.

--- a/discord/abc.py
+++ b/discord/abc.py
@@ -1787,1 +1787,1 @@ class Messageable:
-            around_id = around.id if around else None
+            around_id = around.id

Have a suggestion or found an issue? Share your feedback here.


SonarQube Remediation Agent uses AI. Check for mistakes.

Fixed issues:
- AZUnUZZxU1G2OajCqWod for pythonbugs:S2589 rule

Generated by SonarQube Agent (task: 74494d6e-a1f5-4be8-97a0-68ebb663d635)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant