fix: resolve PLR2004 magic number lint violations in splendor code

Replace magic numbers in bot.py with existing GameConfig values
(max_token_take, minimum_tokens_to_buy_2) and named probability
constants. Add inline noqa for argument-count checks in human.py.
Remove temporary PLR2004 suppression from pyproject.toml.

https://claude.ai/code/session_01C17fUuuiYc8zrwpnw2cgpr
This commit is contained in:
Claude
2026-03-09 03:37:19 +00:00
parent 66acc010ca
commit a52654703a
3 changed files with 30 additions and 25 deletions

View File

@@ -407,7 +407,7 @@ class ActionApp(App[None]):
def _cmd_2(self, parts: list[str]) -> str | None:
"""Take two of the same color."""
if len(parts) < 2:
if len(parts) < 2: # noqa: PLR2004
return "Usage: 2 <color>"
color = parse_color_token(parts[1])
if self.game.bank[color] < self.game.config.minimum_tokens_to_buy_2:
@@ -418,7 +418,7 @@ class ActionApp(App[None]):
def _cmd_3(self, parts: list[str]) -> str | None:
"""Buy face-up card."""
if len(parts) < 3:
if len(parts) < 3: # noqa: PLR2004
return "Usage: 3 <tier> <index>"
tier = int(parts[1])
idx = int(parts[2])
@@ -428,7 +428,7 @@ class ActionApp(App[None]):
def _cmd_4(self, parts: list[str]) -> str | None:
"""Buy reserved card."""
if len(parts) < 2:
if len(parts) < 2: # noqa: PLR2004
return "Usage: 4 <reserved_index>"
idx = int(parts[1])
if not (0 <= idx < len(self.player.reserved)):
@@ -439,7 +439,7 @@ class ActionApp(App[None]):
def _cmd_5(self, parts: list[str]) -> str | None:
"""Reserve face-up card."""
if len(parts) < 3:
if len(parts) < 3: # noqa: PLR2004
return "Usage: 5 <tier> <index>"
tier = int(parts[1])
idx = int(parts[2])
@@ -449,7 +449,7 @@ class ActionApp(App[None]):
def _cmd_6(self, parts: list[str]) -> str | None:
"""Reserve top of deck."""
if len(parts) < 2:
if len(parts) < 2: # noqa: PLR2004
return "Usage: 6 <tier>"
tier = int(parts[1])
self.result = ReserveCard(tier=tier, index=None, from_deck=True)