Rename gateway methods to avoid opcode name clashes - #189
Open
sonarqube-agent[bot] wants to merge 1 commit into
Open
Rename gateway methods to avoid opcode name clashes#189sonarqube-agent[bot] wants to merge 1 commit into
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AZUnUZllU1G2OajCqWpt for python:S1845 rule - AZUnUZllU1G2OajCqWpw for python:S1845 rule - AZUnUZllU1G2OajCqWpu for python:S1845 rule - AZUnUZllU1G2OajCqWpv for python:S1845 rule - AZUnUZllU1G2OajCqWpq for python:S1845 rule Generated by SonarQube Agent (task: 5df7083c-bf1d-40c6-b868-afa45307715e)
Author
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Renamed several Discord gateway methods to remove capitalization-only clashes with opcode constants: voice_state, resume, identify, select_protocol, and client_connect. This makes the code clearer and resolves the five SonarQube blocker issues flagged by the naming rule.
View Project in SonarCloud
Fixed Issues
python:S1845 - Rename method "voice_state" to prevent any misunderstanding/clash with field "VOICE_STATE" defined on line 302 • BLOCKER • View issue
Location:
discord/gateway.py:735Why is this an issue?
Looking at the set of methods and fields in a
classand finding two that differ only by capitalization is confusing to users of the class.What changed
This hunk renames the
voice_statemethod toupdate_voice_state, removing the name clash with theVOICE_STATEfield that differed only by capitalization. The new name is also more action-oriented, which is exactly what the static analysis warning was asking for.python:S1845 - Rename method "resume" to prevent any misunderstanding/clash with field "RESUME" defined on line 812 • BLOCKER • View issue
Location:
discord/gateway.py:843Why is this an issue?
Looking at the set of methods and fields in a
classand finding two that differ only by capitalization is confusing to users of the class.What changed
This hunk renames the
resumemethod tosend_resume, which resolves the capitalization-only clash with theRESUMEfield. Addingsend_makes the method name clearly describe an action instead of looking like the opcode constant.python:S1845 - Rename method "identify" to prevent any misunderstanding/clash with field "IDENTIFY" defined on line 805 • BLOCKER • View issue
Location:
discord/gateway.py:855Why is this an issue?
Looking at the set of methods and fields in a
classand finding two that differ only by capitalization is confusing to users of the class.What changed
This hunk renames the
identifymethod tosend_identify, fixing the capitalization-only naming conflict with theIDENTIFYfield. The new name makes it clear this is the method that sends that payload.python:S1845 - Rename method "select_protocol" to prevent any misunderstanding/clash with field "SELECT_PROTOCOL" defined on line 806 • BLOCKER • View issue
Location:
discord/gateway.py:894Why is this an issue?
Looking at the set of methods and fields in a
classand finding two that differ only by capitalization is confusing to users of the class.What changed
This hunk renames
select_protocoltoselect_voice_protocol, eliminating the confusing capitalization-only overlap with theSELECT_PROTOCOLfield. The new name is more descriptive and clearly indicates this is a method performing an action.python:S1845 - Rename method "client_connect" to prevent any misunderstanding/clash with field "CLIENT_CONNECT" defined on line 815 • BLOCKER • View issue
Location:
discord/gateway.py:909Why is this an issue?
Looking at the set of methods and fields in a
classand finding two that differ only by capitalization is confusing to users of the class.What changed
This hunk renames
client_connecttosend_client_connect, which resolves the clash with theCLIENT_CONNECTfield whose name differed only by capitalization. The renamed method now reads as an action rather than a constant-like identifier.SonarQube Remediation Agent uses AI. Check for mistakes.