Skip to content

Commit f840f0c

Browse files
committed
lint: make check_no_print path-allowlist Windows-safe
The CLI-print allowlist compared paths via \`str(rel).startswith(str(p) + \"/\")\`. On Windows this never matched because \`str(rel)\` uses backslashes, so the CLI allowlist silently failed and every \`print()\` in \`geno_lewm/cli/verify.py\` was flagged as a violation, breaking the gates job + two unit tests on every Windows runner. Switch to component-tuple comparison (\`rel.parts[:n] == p.parts\`) so the same allowlist matches on POSIX and Windows. Confirmed by downloading the pytest artifact from the prior Windows run; both failures (\`test_print_in_cli_dir_is_allowed\` and \`test_real_package_passes\`) trace to this single AST-linter regression. Local Linux suite still passes.
1 parent 75b1960 commit f840f0c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

tools/lint/check_no_print.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ def _is_allowlisted(file: Path) -> bool:
5353
rel = file.resolve().relative_to(PACKAGE_DIR.resolve())
5454
except ValueError:
5555
return False # outside the canonical package — still scanned (test fixtures use tmp dirs)
56-
return any(str(rel).startswith(str(p) + "/") or rel == p for p in _ALLOWED_PRINT_PATHS)
56+
# Compare via path components, not str().startswith, so the
57+
# allowlist matches the same way on Windows (backslashes) and
58+
# POSIX (forward slashes).
59+
rel_parts = rel.parts
60+
return any(rel_parts[: len(p.parts)] == p.parts or rel == p for p in _ALLOWED_PRINT_PATHS)
5761

5862

5963
def check_file(path: Path) -> list[Violation]:

0 commit comments

Comments
 (0)