chore: lint scripts and tests with ruff

pyproject.toml now carries the ruff rule set: pyflakes, the B rules,
simplify, perf, pyupgrade, complexity and size limits. This commit
applies the fixes that change no behavior and the small defects the
first run named:

- tests/test_install.py used argparse without importing it
- three loops rebound the outer `profile` with each layout
  (packextras, slots, verify); the loop variable is now `layout`
- profile_sync loops shadowed dataclasses.field
- generate_readme and packextras computed values nothing read
- stale noqa markers for rules the project does not enforce

Complexity, size and the remaining findings are handled next.
This commit is contained in:
Abdessamad Derraz committed 2026-11-17 07:07:48 +01:00
1 parent 9d8dcb1634
commit 4eacb6ff39
186 files changed
+1001 -1058

No files matched your search

+4 -4
View File
@@ -13,8 +13,8 @@ import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
import siteinputs # noqa: E402
from common import GAME_DATA_TOPS, load_emulator_profiles # noqa: E402
import siteinputs
from common import GAME_DATA_TOPS, load_emulator_profiles
def _copy_places(db: dict) -> dict[str, set[tuple[str, str, str]]]:
@@ -94,7 +94,7 @@ def _engine_sections(manufacturers: dict[str, dict[str, list]]) -> dict[str, dic
top joins that top, and a folder named by a profile key is headed with
the engine's name (SECTION_LABELS), its address unchanged.
"""
from siterender import _PROGRAM_TOPS, SECTION_LABELS, record_card_move # noqa: PLC0415
from siterender import _PROGRAM_TOPS, SECTION_LABELS, record_card_move
profiles = {key: profile for key, profile in _profiles_on_disk().items()
if profile.get("type") != "alias" and profile.get("role") != "test"}
@@ -164,6 +164,6 @@ def _profiles_on_disk() -> dict[str, dict]:
return _profiles_in(str(siteinputs.current().emulators), skip_aliases=False)
@functools.lru_cache(maxsize=None)
@functools.cache
def _profiles_in(emulators_dir: str, skip_aliases: bool) -> dict[str, dict]:
return load_emulator_profiles(emulators_dir, skip_aliases=skip_aliases)