Skip to content

Dead code and minor issues: duplicate return, print() over logging, solution guard #56

@FlorentPoinsaut

Description

@FlorentPoinsaut

Description

Three minor code quality issues identified during review:

1. Duplicate unreachable return self.login()auth/twitch_auth.py

get_token() contains a second return self.login() that is never reached. Likely a merge artefact.

Fix: Remove the duplicate line.

2. print() instead of logging in event_errorbot/bot.py

async def event_error(self, error: Exception, data: str | None = None) -> None:
    print(f"Error: {error}")

print() has no severity level, no timestamp, and cannot be filtered or redirected. Error details may contain sensitive information.

Fix:

import logging
_log = logging.getLogger(__name__)

async def event_error(self, error: Exception, data: str | None = None) -> None:
    _log.error("TwitchIO error: %s", error)

Fix: Add at the top of the solution command handler:

if self._game_state.is_found:
    await ctx.send(f"The game is already over. The word was '{self._game_state.target_word}'.")
    return

Identified by

🔍 [Tech] Reviewer

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low priority — nice to havecode qualityCode style, conventions, dead code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions