From 2d1c889d410201d60869b27b17f9b10ec9aca34a Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 6 Nov 2026 14:42:05 +0100 Subject: [PATCH] refactor: name the database option --db everywhere --- scripts/scraper/arcade_parent_importer.py | 4 ++-- tests/test_tool_messages.py | 19 +++++++++++++++++++ wiki/tools.md | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/scripts/scraper/arcade_parent_importer.py b/scripts/scraper/arcade_parent_importer.py index a884b3188..59c885032 100644 --- a/scripts/scraper/arcade_parent_importer.py +++ b/scripts/scraper/arcade_parent_importer.py @@ -1122,7 +1122,7 @@ def main() -> int: which.add_argument("--all", action="store_true", help="every profile with an arcade source") parser.add_argument("--emulators-dir", default="emulators", help="profiles whose BIOS sets are read (default emulators)") - parser.add_argument("--database", default="database.json", + parser.add_argument("--db", default="database.json", help="collection index, to name BIOS sets the collection lacks") parser.add_argument("--output-dir", type=Path, default=DEFAULT_OUTPUT, help=f"where the parent maps are written (default {DEFAULT_OUTPUT})") @@ -1133,7 +1133,7 @@ def main() -> int: args = parser.parse_args() profiles = load_emulator_profiles(args.emulators_dir, skip_aliases=False) - names = collection_names(Path(args.database)) + names = collection_names(Path(args.db)) failed = False for profile in sorted(PROFILES) if args.all else args.profile: if profile not in profiles: diff --git a/tests/test_tool_messages.py b/tests/test_tool_messages.py index c2e59f6e9..364d6e89e 100644 --- a/tests/test_tool_messages.py +++ b/tests/test_tool_messages.py @@ -455,6 +455,25 @@ class OneSpellingPerOption(unittest.TestCase): missing.append(f"{path.relative_to(REPO_ROOT)}:{node.lineno} {long}") self.assertEqual(missing, []) + def test_one_long_name_per_option(self): + """arcade_parent_importer took --database where every other script + takes --db, and refused `--db database.json`.""" + import ast # noqa: PLC0415 + + renamed = {"--database": "--db"} + found = [] + for path in sorted((REPO_ROOT / "scripts").rglob("*.py")): + tree = ast.parse(path.read_text(encoding="utf-8")) + for node in ast.walk(tree): + if (isinstance(node, ast.Call) + and getattr(node.func, "attr", None) == "add_argument"): + found.extend( + f"{path.relative_to(REPO_ROOT)}:{node.lineno} {a.value}" + for a in node.args + if isinstance(a, ast.Constant) and a.value in renamed + ) + self.assertEqual(found, []) + class ThePipelineRefreshesTheCommittedExport(unittest.TestCase): """Step 2e wrote to /upstream while exports/ is the copy the diff --git a/wiki/tools.md b/wiki/tools.md index 608f60318..eb35ae354 100644 --- a/wiki/tools.md +++ b/wiki/tools.md @@ -1416,7 +1416,7 @@ Further options, by script: | `scraper/mame_hash_scraper.py` | `--release mameNNNN --profile FILE --source-commit SHA --core NAME --built-by PLATFORM` writes the profile of a MAME build a platform compiles. `--devices --listxml FILE` documents in `mame.yml` every device set with dumped ROMs that the release's `-listxml` names (`isdevice="yes"`), with `--dry-run` to preview | | `scraper/romset_dat_importer.py` | `--cache-dir` (downloaded listxml and DATs) | | `scraper/game_dat_importer.py` | `--source no-intro\|redump` (repeatable), `--pack FILE` imports a local ZIP, directory or DAT, `--refresh` asks the servers again, `--cache-dir`, `--output-dir`, `--dry-run` | -| `scraper/arcade_parent_importer.py` | `--profile NAME` (one core version), `--emulators-dir`, `--database` (BIOS roots checked against it by archive name), `--output-dir`, `--cache-dir`, `--offline`, `--dry-run` | +| `scraper/arcade_parent_importer.py` | `--profile NAME` (one core version), `--emulators-dir`, `--db` (BIOS roots checked against it by archive name), `--output-dir`, `--cache-dir`, `--offline`, `--dry-run` | | `scraper/romfolders` | `--sources DIR` (default `platforms/romfolders/_sources`), `--output-dir`, `--dry-run` | | `game_rules.py` | `--regions`, `--extras`, `--headers` (files checked against the profiles and the header readers), `--emulators-dir`, `--json` | | `generate_games_index.py` | `--output-dir` (default `install/games`), `--check`, `--quiet` |