Skip to content

refactor: use public confirm_intro_splash() in websocket handler (#403)#436

Merged
mholzi merged 1 commit intomainfrom
fix/403-intro-splash-websocket
Mar 29, 2026
Merged

refactor: use public confirm_intro_splash() in websocket handler (#403)#436
mholzi merged 1 commit intomainfrom
fix/403-intro-splash-websocket

Conversation

@mholzi
Copy link
Copy Markdown
Owner

@mholzi mholzi commented Mar 29, 2026

Summary

The _admin_confirm_intro_splash handler was directly accessing 10 private GameState attributes. 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

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>
@mholzi mholzi merged commit 3b09500 into main Mar 29, 2026
2 of 3 checks passed
@mholzi mholzi deleted the fix/403-intro-splash-websocket branch March 29, 2026 06:51
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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
  1. 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code Review: architecture] Intro splash logic leaks 10 private attributes into websocket

1 participant