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

+2 -2
View File
@@ -421,13 +421,13 @@ class Exporter(BaseExporter):
continue
key = _note_key(line)
if not key[0]:
if 0 <= hash_at and "[" in line[:hash_at]:
if hash_at >= 0 and "[" in line[:hash_at]:
pending.append(line[hash_at:].strip())
continue
if pending:
leading[key] = pending
pending = []
if 0 <= hash_at and hash_at > line.index(key[0]):
if hash_at >= 0 and hash_at > line.index(key[0]):
trailing[key] = line[hash_at:].rstrip()
return trailing, leading
+1 -4
View File
@@ -46,10 +46,7 @@ def _declared_hashes(entry: dict) -> dict[str, set[str]]:
def _accepts(accepted: set[str], declared: dict[str, set[str]]) -> bool:
"""True when the hashes a profile entry accepts, the members of its
archive included, hold one the platform entry declares."""
for values in declared.values():
if values & accepted:
return True
return False
return any(values & accepted for values in declared.values())
def _contradicts(profile_entry: dict, declared: dict[str, set[str]]) -> bool:
+1 -1
View File
@@ -89,7 +89,7 @@ class Exporter(BaseExporter):
and self._known_platform(fe.native_system)
)
def writable(self, fe: NativeFile, require: str = "") -> bool: # noqa: ARG002
def writable(self, fe: NativeFile, require: str = "") -> bool:
"""What RomM already ships stays. The conditions gate additions.
An entry of theirs that could never verify is still theirs, and the