mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 12:47:47 +01:00
fix(lint): remove FBT001/FBT002/FBT003 and ARG001/ARG002 from global ignores
FBT001/FBT002 fixes: - Make boolean params keyword-only with *, syntax in: - stockfish_analysis/analyze_chess_game.py: pov_white - lichess_bot/main.py: decline_correspondence - screen_locker/screen_lock.py: demo_mode - Update call sites to use keyword arguments ARG001/ARG002 fixes: - Prefix unused params with underscore: - extractLinks/main.py: tag -> _tag - lichess_bot/lichess_api.py: game_id -> _game_id - lichess_bot/tests/conftest.py: config -> _config FBT003 per-file ignores (external API calls): - PYTHON/keyboardCoop/main.py: pygame.font.render - PYTHON/screen_locker/screen_lock.py: tkinter API - poker-modifier-app/poker_modifier_app.py: tkinter API
This commit is contained in:
parent
9576b20d6c
commit
4da77b6cfe
@ -25,7 +25,7 @@ class _HrefParser(HTMLParser):
|
|||||||
self.hrefs: list[str] = []
|
self.hrefs: list[str] = []
|
||||||
|
|
||||||
def handle_starttag( # type: ignore[override]
|
def handle_starttag( # type: ignore[override]
|
||||||
self, tag: str, attrs: list[tuple[str, str | None]]
|
self, _tag: str, attrs: list[tuple[str, str | None]]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Collect href attributes from start tags."""
|
"""Collect href attributes from start tags."""
|
||||||
for k, v in attrs:
|
for k, v in attrs:
|
||||||
|
|||||||
@ -176,7 +176,7 @@ class LichessAPI:
|
|||||||
r = self._request("POST", url, timeout=30)
|
r = self._request("POST", url, timeout=30)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
|
|
||||||
def get_game_state(self, game_id: str) -> dict | None:
|
def get_game_state(self, _game_id: str) -> dict | None:
|
||||||
"""Deprecated: use stream_game_events in a persistent loop."""
|
"""Deprecated: use stream_game_events in a persistent loop."""
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ from PYTHON.lichess_bot.lichess_api import LichessAPI
|
|||||||
from PYTHON.lichess_bot.utils import backoff_sleep, get_and_increment_version
|
from PYTHON.lichess_bot.utils import backoff_sleep, get_and_increment_version
|
||||||
|
|
||||||
|
|
||||||
def run_bot(log_level: str = "INFO", decline_correspondence: bool = False) -> None:
|
def run_bot(log_level: str = "INFO", *, decline_correspondence: bool = False) -> None:
|
||||||
"""Start the bot and listen for incoming events."""
|
"""Start the bot and listen for incoming events."""
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=getattr(logging, log_level.upper(), logging.INFO),
|
level=getattr(logging, log_level.upper(), logging.INFO),
|
||||||
@ -465,7 +465,7 @@ def main() -> None:
|
|||||||
help="Decline correspondence challenges",
|
help="Decline correspondence challenges",
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
run_bot(args.log_level, args.decline_correspondence)
|
run_bot(args.log_level, decline_correspondence=args.decline_correspondence)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@ -11,7 +11,7 @@ if ROOT not in sys.path:
|
|||||||
sys.path.insert(0, ROOT)
|
sys.path.insert(0, ROOT)
|
||||||
|
|
||||||
|
|
||||||
def pytest_ignore_collect(collection_path: Path, config: pytest.Config) -> bool | None:
|
def pytest_ignore_collect(collection_path: Path, _config: pytest.Config) -> bool | None:
|
||||||
"""Ignore per-game blunder test files; keep only the unified one.
|
"""Ignore per-game blunder test files; keep only the unified one.
|
||||||
|
|
||||||
This lets us keep historical files in the repo without collecting them.
|
This lets us keep historical files in the repo without collecting them.
|
||||||
|
|||||||
@ -26,7 +26,7 @@ MAX_WEIGHT_KG = 500
|
|||||||
class ScreenLocker:
|
class ScreenLocker:
|
||||||
"""Screen locker that requires workout logging to unlock."""
|
"""Screen locker that requires workout logging to unlock."""
|
||||||
|
|
||||||
def __init__(self, demo_mode: bool = True) -> None:
|
def __init__(self, *, demo_mode: bool = True) -> None:
|
||||||
"""Initialize screen locker with optional demo mode."""
|
"""Initialize screen locker with optional demo mode."""
|
||||||
# Set up log file path
|
# Set up log file path
|
||||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|||||||
@ -86,7 +86,7 @@ def extract_pgn_text(raw: str) -> str | None:
|
|||||||
|
|
||||||
|
|
||||||
def score_to_cp(
|
def score_to_cp(
|
||||||
score: chess.engine.PovScore, pov_white: bool
|
score: chess.engine.PovScore, *, pov_white: bool
|
||||||
) -> tuple[int | None, int | None]:
|
) -> tuple[int | None, int | None]:
|
||||||
"""Return tuple (cp, mate_in) from a PovScore for the given POV color.
|
"""Return tuple (cp, mate_in) from a PovScore for the given POV color.
|
||||||
|
|
||||||
|
|||||||
@ -39,11 +39,6 @@ ignore = [
|
|||||||
"BLE001", # Blind except - will fix critical ones manually
|
"BLE001", # Blind except - will fix critical ones manually
|
||||||
"S603", # subprocess without shell - known pattern
|
"S603", # subprocess without shell - known pattern
|
||||||
"S607", # start-process with partial path - acceptable
|
"S607", # start-process with partial path - acceptable
|
||||||
"FBT001", # Boolean positional arg - common pattern
|
|
||||||
"FBT002", # Boolean default value - common pattern
|
|
||||||
"FBT003", # Boolean positional value - common pattern
|
|
||||||
"ARG001", # Unused function argument - often needed for API compatibility
|
|
||||||
"ARG002", # Unused method argument - often needed for API compatibility
|
|
||||||
"N803", # invalid-argument-name - chess notation uses uppercase
|
"N803", # invalid-argument-name - chess notation uses uppercase
|
||||||
"N999", # invalid-module-name - PYTHON folder name
|
"N999", # invalid-module-name - PYTHON folder name
|
||||||
"LOG015", # root-logger-call - common in scripts
|
"LOG015", # root-logger-call - common in scripts
|
||||||
@ -99,6 +94,15 @@ unfixable = []
|
|||||||
"PYTHON/randomize_numbers/random_digits.py" = [
|
"PYTHON/randomize_numbers/random_digits.py" = [
|
||||||
"PERF203", # Try-except needed for parsing user input in loop
|
"PERF203", # Try-except needed for parsing user input in loop
|
||||||
]
|
]
|
||||||
|
"PYTHON/keyboardCoop/main.py" = [
|
||||||
|
"FBT003", # Boolean positional values in pygame API calls (e.g., font.render)
|
||||||
|
]
|
||||||
|
"PYTHON/screen_locker/screen_lock.py" = [
|
||||||
|
"FBT003", # Boolean positional values in tkinter API calls
|
||||||
|
]
|
||||||
|
"poker-modifier-app/poker_modifier_app.py" = [
|
||||||
|
"FBT003", # Boolean positional values in tkinter API calls
|
||||||
|
]
|
||||||
|
|
||||||
[tool.ruff.lint.pydocstyle]
|
[tool.ruff.lint.pydocstyle]
|
||||||
convention = "google" # Use Google docstring convention
|
convention = "google" # Use Google docstring convention
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user