Repository navigation
Rename Every Python File to the Fleet's snake_case Names - #537
Conversation
checks/sibling.py holds the one loader. The three helper copies in check-csp.py, fuzz-media-parsers.py, and test_check_media_metadata.py, and the four inline copies at the top of the other check tests, now call it by name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A recorded local strict-review pass covers head |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #537 +/- ##
==========================================
Coverage ? 54.07%
==========================================
Files ? 12
Lines ? 3390
Branches ? 0
==========================================
Hits ? 1833
Misses ? 1557
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🔵 Needs a closer look
Direct execution of the retained test entry points fails because sibling is not importable from the repository root.
No open issues 🎉
What changed in this PR
This pull request consolidates duplicated hyphenated-sibling script loading logic in checks/ into a shared sibling.load helper.
Changes:
- Adds the typed shared loader in
checks/sibling.py. - Updates check scripts and tests to use the shared helper.
- Adds coverage for loading hyphenated scripts.
- Requires a fix so the affected tests also work when executed directly from the repository root.
| File | Description |
|---|---|
checks/tests/test_sibling.py |
Tests loading a constructed hyphenated script; direct standalone execution currently cannot import sibling. |
checks/tests/test_check_text_pii.py |
Uses the shared loader for the PII gate. |
checks/tests/test_check_media_metadata.py |
Uses the shared loader for media-related modules. |
checks/tests/test_check_github_env.py |
Uses the shared loader for the environment gate. |
checks/tests/test_check_csp.py |
Uses the shared loader for the CSP gate. |
checks/tests/test_check_csp_browser.py |
Uses the shared loader for the browser CSP gate. |
checks/sibling.py |
Adds the shared path-based module loader. |
checks/fuzz-media-parsers.py |
Replaces local loading logic with sibling.load. |
checks/check-csp.py |
Replaces its local sibling loader with sibling.load. |
Review effort: Lite
A hyphenated module cannot be named in an import, which is why the tooling needed a by-path loader at all. Every .py under checks/, scripts/, and capture/ now takes a snake_case name, and a gate takes the _gate suffix, so siblings import by name and checks/sibling.py goes. A test puts its directory on sys.path and imports the module, the way the hub's tests do, so running a test file directly works again. Each directory's mypy config ignores the one module it imports from the other declared directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A recorded local strict-review pass covers head |
|
Fixed in d073e66, with f577785 on top. The review of a8f5b45 found that running a test file directly failed, because |
Summary
#532 asked for one loader for hyphenated sibling scripts. The fleet's answer is that no loader is needed. The hub's CODESTYLE.md "Script and Utility File Names" makes a Python file lowercase snake_case, because a hyphenated module cannot be named in an
import. So this renames every hyphenated.pyin the repository, and siblings import by name..pyunderchecks/,scripts/, andcapture/is renamed to snake_case. A gate, a script that exits non-zero on a finding, takes the_gatesuffix, the way the hub's ownhost_gate.pyandrepo_gate.pydo. Socheck-csp.pybecomescsp_gate.py,fuzz-media-parsers.pybecomesmedia_parser_fuzz_gate.py, andnormalize-media.pybecomesnormalize_media.py. Tests follow their module, sotest_check_csp.pybecomestest_csp_gate.py.check-live-urls.shkeeps its hyphen, since the shell rule wants one.importlibloaders are gone, all of them, and so is thechecks/sibling.pythis pull request first added. A gate imports its sibling by name. A test, or a script reaching the other declared directory, inserts that directory onsys.pathand imports the module, the pattern the hub's tests use. Every test file therefore runs directly again, which Copilot found the first version broke.pyproject.tomlignores missing imports for the one module it reads from the other directory, since neither directory's mypy run reads the other's tree.deploy/make-release.sh,.vscode/tasks.json, the validate action, the browser check's container path, and every doc name the new files. Markdown link labels that spelled an old file stem now spell the new one.reports/andcontent/are left as written, since they record what was true when they were written.capture/is one-shot tooling outside the declared Python directories. Only its file names and the references to them change, and one comment is reflowed for the prose gate.Fixes #532, which closes when the promotion carrying this reaches main.
Verification
checks/, run as CI runs it: ruff, ruff format, and mypy are clean, andcoverage run -m unittest discover -s testspasses 201 tests.scripts/, run as CI runs it in a fresh.venvfromrequirements.txt: ruff, ruff format, and mypy are clean, and pytest passes 29 tests.checks/tests/*.pyfile passes when run directly aspython3 checks/tests/<file>.py.make-release.sh, the validate action, and the tasks run it. All of them keep mode 755 and their shebangs. Thecapture/files compile.comment-added, which thecommentslabel clears.checks/mypy comment, and a reflowed comment the prose gate would refuse. Both are fixed in f577785, together with a test patch that sharing one module object made redundant.Pre-existing findings, not filed
CONTENT.md:79,:81,:127,ENVIRONMENT.md:5,GOVERNANCE.md:273,OPERATIONS.md:217,capture/README.md:60,:64,:72,capture/run-wp2hugo.sh:6,checks/media_metadata_gate.py:24:pre-existing. Sentences over 25 words, on lines the rename touched without lengthening them.Pre-existing findings, filed
--helpas an input rather than answering it.Dropped findings
scripts/normalize_media.py:418,style: a scratch-directory prefix still spellsnormalize-media-. It names no file.CONTENT.md,README.md,deploy/README.md,checks/README.md,style: some link labels, such as[text-pii]and[checks-csp], never spelled a whole file stem and keep their names.🤖 Generated with Claude Code