From 9d0b099f8433b0c53b968605916631c9f3ff2ea6 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 22 Dec 2023 15:57:05 -0500 Subject: [PATCH] fix: better error if requires is not a set Signed-off-by: Henry Schreiner --- src/repo_review/processor.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/repo_review/processor.py b/src/repo_review/processor.py index 53ee3e2..af63300 100644 --- a/src/repo_review/processor.py +++ b/src/repo_review/processor.py @@ -192,13 +192,18 @@ def process( # Collect our own config config = pyproject(package).get("tool", {}).get("repo-review", {}) - select_checks = select if select else set(config.get("select", ())) - skip_checks = ignore if ignore else set(config.get("ignore", ())) + select_checks = select if select else frozenset(config.get("select", ())) + skip_checks = ignore if ignore else frozenset(config.get("ignore", ())) # Make a graph of the check's interdependencies - graph: dict[str, set[str]] = { - n: getattr(t, "requires", set()) for n, t in tasks.items() + graph: dict[str, Set[str]] = { + n: getattr(t, "requires", frozenset()) for n, t in tasks.items() } + for name, s in graph.items(): + if not isinstance(s, Set): + msg = f"requires must be a set, got {s!r} for {name!r}" # type: ignore[unreachable] + raise TypeError(msg) + # Keep track of which checks have been completed completed: dict[str, str | None] = {}