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
@@ -3997,7 +3997,7 @@ def _main(held: contextlib.ExitStack) -> None:
# Manifest generation (JSON inventory for install.py)
@functools.lru_cache(maxsize=None)
@functools.cache
def _registered(repo_root: str) -> frozenset[str]:
"""The paths a repository's .gitignore registers as release assets, read
by the parser the fetcher and the release check use, once per root."""
@@ -4149,7 +4149,7 @@ def _profile_copies(
the emulator, else the shortest path. DuckStation's ps2_scph50006.bin
sits at the BIOS root and under pcsx2/bios/ for the libretro PS2 cores.
"""
from fnmatch import fnmatch # noqa: PLC0415
from fnmatch import fnmatch
taken: list[tuple[str, str, str, bool]] = []
for copy in declared:
@@ -5704,7 +5704,7 @@ def _offered_boards(
pairs = content_folder_boards(config)
if all(on is None for on in pairs.values()):
return {}
from launchers import _roms_place # noqa: PLC0415
from launchers import _roms_place
by_key: dict[str, set[str]] = {}
for name, claimants in upstream_profile_index(profiles).items():
@@ -6240,7 +6240,7 @@ from packextras import ( # noqa: E402,F401
)
from packreadme import ( # noqa: E402,F401
from packreadme import ( # noqa: E402
_build_readme,
_build_agnostic_rename_readme,
save_place,