cmds.secrets.FilesContext: Ignore commented-out macros
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m37s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m6s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m39s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m54s
CI / Packaging test (push) Successful in 0s
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m37s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m6s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m39s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m54s
CI / Packaging test (push) Successful in 0s
The unresolved-macro check scans the substituted content for __MACRO__ names, and a commented-out reference fails the compile like a live one. A disabled config section keeps its macros in the comments as documentation, and the matching store keys are retired along with it, so compiling the template fails on lines that no longer take effect. Skip comment lines when scanning for unresolved macros. The integration test gains a target whose template carries a commented-out macro without a store entry. Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.4.0 Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
ea45cb1fed
commit
6398406a5f
1 changed files with 33 additions and 6 deletions
|
|
@ -138,7 +138,13 @@ class FilesContext:
|
|||
for key, val in replace.items():
|
||||
new_content = new_content.replace(key, val)
|
||||
|
||||
unresolved = sorted(set(re.findall(r'__[A-Z0-9_]+__', new_content)))
|
||||
# -- A commented-out macro is documentation, not a reference;
|
||||
# it must not fail the compile
|
||||
live = '\n'.join(
|
||||
line for line in new_content.splitlines()
|
||||
if not line.lstrip().startswith('#')
|
||||
)
|
||||
unresolved = sorted(set(re.findall(r'__[A-Z0-9_]+__', live)))
|
||||
if unresolved:
|
||||
raise Exception(f'Unresolved macros in {src}: {", ".join(unresolved)}')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue