mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 23:08:36 +00:00
tools/layout/checks/docs_paths.py: a file name in a sentence is not a hit, and an explained list for lines that are correct as written
setup.py and strata.py only matter as the program of a command; the two lines that name the key inside an installed Strata are listed in docs_paths_explained.txt. On the head after the docs commit the scan reports no hit (86 pages).
This commit is contained in:
1 parent
ba971b3ab0
commit
cebd4489aa
3 files changed
+20
No files matched your search
@@ -91,6 +91,10 @@ a path that does not exist when it existed before the move or its first missing
|
||||
`cmake -S <folder>` whose folder has no CMakeLists.txt. It found a test that skipped silently after the move and several release build
|
||||
scripts. Dual-layout fallbacks that read both layouts on purpose show up as hits to read, not as breaks.
|
||||
|
||||
`checks/docs_paths.py <repo> <rev> <rev before the move> [--explained checks/docs_paths_explained.txt]` reads the code spans and blocks of the user-facing pages
|
||||
(docs/*.md, README.md, AGENTS.md, .github/*.md) and lists every command or path that existed before the move, does not exist now and has a new place
|
||||
(`tools/iq_pack.py`, `.venv/bin/python`, `-m serve.server`). It reports no hit on the head of 0.2.16.
|
||||
|
||||
Run each Windows test file in its own process. In one combined pytest run, `serve/winjob.py` and `serve/lifeline.py` keep the
|
||||
`subprocess.Popen` that an earlier test may have replaced, and 7 tests fail in both trees for that reason only.
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ Also reported: commands that start a moved program from the repository root as b
|
||||
Prints one line per hit: page:line: token -> new path [context]. Exit 1 while a hit is left.
|
||||
--fix-list FILE writes "page<TAB>line<TAB>old<TAB>new<TAB>context" for the hits whose context is a command (a block or a span that starts like a command);
|
||||
--fix-all FILE writes it for every hit.
|
||||
--explained FILE: lines "page | text | reason" for hits that are correct as written. A bare file name in a sentence (setup.py, strata.py) is not a hit: it matters
|
||||
only as the program of a command.
|
||||
"""
|
||||
import posixpath
|
||||
import re
|
||||
@@ -22,6 +24,13 @@ import sys
|
||||
repo, rev, before = sys.argv[1:4]
|
||||
fix_list = sys.argv[sys.argv.index("--fix-list") + 1] if "--fix-list" in sys.argv else None
|
||||
fix_all = sys.argv[sys.argv.index("--fix-all") + 1] if "--fix-all" in sys.argv else None
|
||||
explained_file = sys.argv[sys.argv.index("--explained") + 1] if "--explained" in sys.argv else None
|
||||
EXPLAINED = [] # (page, text in the span or line, reason): a hit that is correct as written (checks/docs_paths_explained.txt)
|
||||
if explained_file:
|
||||
for _l in open(explained_file, encoding="utf-8"):
|
||||
_p = [x.strip() for x in _l.rstrip("\n").split("|", 2)]
|
||||
if len(_p) == 3 and _p[0] and not _p[0].startswith("#"):
|
||||
EXPLAINED.append((_p[0], _p[1], _p[2]))
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
|
||||
@@ -123,6 +132,10 @@ for page in pages:
|
||||
if tok in old_tree or tok in old_dirs:
|
||||
nw = new_path(tok)
|
||||
if nw and nw != tok and (nw in tree or nw in dirs):
|
||||
if tok in ("setup.py", "strata.py") and not re.search(r"(?:python3?(?:\.exe)?|py -3|[/\\]python(?:\.exe)?)\s+(?:-\S+\s+)*" + re.escape(tok), body):
|
||||
continue # the name of one file in a sentence does not mislead; it matters as a command's program
|
||||
if any(p == page and t in body for p, t, _why in EXPLAINED):
|
||||
continue
|
||||
hits.append((page, n, tok, nw, "command" if (is_cmd or block) else "prose"))
|
||||
# the commands that start moved programs from the root
|
||||
if is_cmd:
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# page | text in the span or code line | reason (hits of checks/docs_paths.py that are correct as written)
|
||||
.github/SECURITY.md | strata_control/update_keys.json | names the key inside an INSTALLED Strata (the installed layout has strata_control/ at its top)
|
||||
docs/SAFETY.md | strata_control/update_keys.json | names the key inside an INSTALLED Strata (the installed layout has strata_control/ at its top)
|
||||
Reference in new issue
Block a user