docs: rewrite half-dash asides in comments

Dropping the double-dash asides left 72 comments and docstrings with
half a dash glued to the next word ("shape -a size or a size range -is
all"). They now read as a colon, a comma or parentheses, and a prose
style test names any that comes back.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 09:17:10 +02:00
1 parent e424a35aee
commit 71b59eb2a3
22 files changed
+89 -71

No files matched your search

+1 -1
View File
@@ -171,7 +171,7 @@ class TestPackDeterminism(unittest.TestCase):
sha1 = hashlib.sha1(payload).hexdigest()
# A romset goes through the deterministic rebuild, which stages the
# archive in a temporary file. Copying that file into the pack took
# its mtime -the wall clock -so 348 members of the real Recalbox
# its mtime, the wall clock, so 348 members of the real Recalbox
# pack moved between two builds while every byte matched. Without a
# romset here the fixture never reaches that path.
romset = self.bios / "romset.zip"
+12 -12
View File
@@ -574,7 +574,7 @@ class TestE2E(unittest.TestCase):
"type": "libretro",
"systems": ["console-a", "sys-md5"],
"files": [
# Size validation -correct size (16 bytes = len(b"PRESENT_REQUIRED"))
# Size validation: correct size (16 bytes = len(b"PRESENT_REQUIRED"))
{
"name": "present_req.bin",
"required": True,
@@ -582,14 +582,14 @@ class TestE2E(unittest.TestCase):
"size": 16,
"source_ref": "test.c:10-20",
},
# Size validation -wrong expected size
# Size validation: wrong expected size
{
"name": "present_opt.bin",
"required": False,
"validation": ["size"],
"size": 9999,
},
# CRC32 validation -correct crc32
# CRC32 validation: correct crc32
{
"name": "correct_hash.bin",
"required": True,
@@ -597,7 +597,7 @@ class TestE2E(unittest.TestCase):
"crc32": "91d0b1d3",
"source_ref": "hash.c:42",
},
# CRC32 validation -wrong crc32
# CRC32 validation: wrong crc32
{
"name": "no_md5.bin",
"required": False,
@@ -611,28 +611,28 @@ class TestE2E(unittest.TestCase):
"validation": ["crc32"],
"crc32": "0179e92e",
},
# MD5 validation -correct md5
# MD5 validation: correct md5
{
"name": "correct_hash.bin",
"required": True,
"validation": ["md5"],
"md5": "4a8db431e3b1a1acacec60e3424c4ce8",
},
# SHA1 validation -correct sha1
# SHA1 validation: correct sha1
{
"name": "correct_hash.bin",
"required": True,
"validation": ["sha1"],
"sha1": "a2ab6c95c5bbd191b9e87e8f4e85205a47be5764",
},
# MD5 validation -wrong md5
# MD5 validation: wrong md5
{
"name": "alias_target.bin",
"required": False,
"validation": ["md5"],
"md5": "0000000000000000000000000000dead",
},
# Adler32 -known_hash_adler32 field
# Adler32: known_hash_adler32 field
{
"name": "present_req.bin",
"required": True,
@@ -646,7 +646,7 @@ class TestE2E(unittest.TestCase):
"min_size": 10,
"max_size": 100,
},
# Signature -crypto check we can't reproduce, but size applies
# Signature: crypto check we can't reproduce, but size applies
{
"name": "correct_hash.bin",
"required": True,
@@ -747,7 +747,7 @@ class TestE2E(unittest.TestCase):
yaml.dump(emu_mixed_agnostic, fh)
# ---------------------------------------------------------------
# THE TEST -one method per feature area, all using same fixtures
# THE TEST: one method per feature area, all using same fixtures
# ---------------------------------------------------------------
def test_01_resolve_sha1(self):
@@ -999,7 +999,7 @@ class TestE2E(unittest.TestCase):
config, self.emulators_dir, self.db, profiles
)
names = {u["name"] for u in undeclared}
# dd_covered.bin is a file entry, not data_dir content -still undeclared
# dd_covered.bin is a file entry, not data_dir content: still undeclared
self.assertIn("dd_covered.bin", names)
def test_44_cross_ref_skips_launchers(self):
@@ -2197,7 +2197,7 @@ class TestE2E(unittest.TestCase):
config = load_platform_config("test_existence", self.platforms_dir)
profiles = load_emulator_profiles(self.emulators_dir)
result = verify_platform(config, self.db, self.emulators_dir, profiles)
# Simulate --json filtering (non-OK only) -ground_truth must survive
# Simulate --json filtering (non-OK only): ground_truth must survive
filtered = [d for d in result["details"] if d["status"] != Status.OK]
for d in filtered:
self.assertIn("ground_truth", d)
+1 -1
View File
@@ -260,7 +260,7 @@ class CandidateVerdict(unittest.TestCase):
"""Whether a profile entry can be a gap, and whether it is settled.
The filter chain mixed two kinds of skip. A settled entry is answered for
-the platform declares it, the profile calls it unsourceable -so the same
(the platform declares it, the profile calls it unsourceable), so the same
requirement reached from another profile must not be reconsidered. A
skipped one merely does not apply here: the same file can be libretro-only
in one profile and standalone-only in another, and recording it from the
+18
View File
@@ -238,6 +238,24 @@ class NoClauseSemicolons(unittest.TestCase):
self._check(files, _python_prose)
def test_python_prose_has_no_lone_dash_asides(self):
"""Removing " -- " asides left 72 comments reading "shape -a size or
a size range -is all": half a dash glued to the next word. A command
line flag quoted in prose (MAME's -listxml) is not an aside, and a
quotation is left alone."""
lone = re.compile(r"[A-Za-z0-9,)] -(?!listxml\b|lr\b|sa\b)[a-z]{2,}")
offenders = [
f"{path.relative_to(ROOT)}: {line.strip()[:100]}"
for path in _tracked() if path.suffix == ".py"
for line in re.sub(
r'`[^`]*`|"[^"\n]*\n?[^"\n]*"',
"",
_python_prose(path.read_text(encoding="utf-8")).replace('"""', ""),
).splitlines()
if lone.search(line) and not re.search(r"\b(python|curl|unittest|sh)\b .* -", line)
]
self.assertEqual(offenders, [], "\n".join(offenders[:40]))
def test_schema_descriptions(self):
offenders = []
for path in sorted((ROOT / "schemas").glob("*.json")):