refactor: use public confirm_intro_splash() in websocket handler (#403)#436
Merged
refactor: use public confirm_intro_splash() in websocket handler (#403)#436
Conversation
The handler was directly accessing 10 private GameState attributes. GameState.confirm_intro_splash() already encapsulates all the logic — websocket handler now delegates to it in two lines. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the _admin_confirm_intro_splash method in websocket.py by delegating its logic to the game_state object. A review comment suggests prefixing the now-unused ws and data parameters with underscores to improve code clarity and avoid potential linter warnings.
| @@ -668,39 +668,8 @@ async def _admin_set_language( | |||
| async def _admin_confirm_intro_splash( | |||
| self, ws: web.WebSocketResponse, data: dict, game_state: GameState | |||
Contributor
There was a problem hiding this comment.
With this refactoring, the ws and data parameters are no longer used in this method. To improve code clarity and signal that they are intentionally unused, it's a good practice to prefix them with an underscore. This also helps static analysis tools avoid raising unused-argument warnings.
Suggested change
| self, ws: web.WebSocketResponse, data: dict, game_state: GameState | |
| self, _ws: web.WebSocketResponse, _data: dict, game_state: GameState |
References
- Prefixing unused arguments with an underscore is a common Python convention to indicate that they are intentionally unused. This improves readability and can prevent linter warnings (e.g., Pylint's
unused-argument). (link)
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.
Summary
The
_admin_confirm_intro_splashhandler was directly accessing 10 privateGameStateattributes.GameState.confirm_intro_splash()was already added in a prior refactor to encapsulate this logic — the websocket handler just wasn't updated to use it.The handler is now 2 lines instead of 35. No behaviour change.
Closes #403
🤖 Generated with Claude Code