mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-20 01:20:59 +03:00
feat(validate): brief output by default, -Detailed for verbose
All 10 validation skills (meta, epf, skd, cf, cfe, form, mxl, role, subsystem, interface) now output a single summary line on success: === Validation OK: Type.Name (N checks) === Errors/warnings always shown. Full per-check [OK] output behind -Detailed flag. Removed all N/A check lines. Unified role-validate output format. Trimmed SKILL.md files from 42-119 to 51-67 lines. Version bumps: meta-validate v1.2, all others v1.1. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
93e4130ff2
commit
422e397381
@@ -1,10 +1,12 @@
|
||||
# epf-validate v1.0 — Validate 1C external data processor / report structure
|
||||
# epf-validate v1.1 — Validate 1C external data processor / report structure
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
# Works for both EPF (ExternalDataProcessor) and ERF (ExternalReport) — auto-detects
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string]$ObjectPath,
|
||||
|
||||
[switch]$Detailed,
|
||||
|
||||
[int]$MaxErrors = 30,
|
||||
|
||||
[string]$OutFile
|
||||
@@ -60,6 +62,7 @@ $srcDir = Split-Path $resolvedPath -Parent
|
||||
|
||||
$script:errors = 0
|
||||
$script:warnings = 0
|
||||
$script:okCount = 0
|
||||
$script:stopped = $false
|
||||
$script:output = New-Object System.Text.StringBuilder 8192
|
||||
|
||||
@@ -70,7 +73,8 @@ function Out-Line {
|
||||
|
||||
function Report-OK {
|
||||
param([string]$msg)
|
||||
Out-Line "[OK] $msg"
|
||||
$script:okCount++
|
||||
if ($Detailed) { Out-Line "[OK] $msg" }
|
||||
}
|
||||
|
||||
function Report-Error {
|
||||
@@ -89,10 +93,14 @@ function Report-Warn {
|
||||
}
|
||||
|
||||
$finalize = {
|
||||
Out-Line ""
|
||||
Out-Line "=== Result: $($script:errors) errors, $($script:warnings) warnings ==="
|
||||
|
||||
$result = $script:output.ToString()
|
||||
$checks = $script:okCount + $script:errors + $script:warnings
|
||||
if ($script:errors -eq 0 -and $script:warnings -eq 0 -and -not $Detailed) {
|
||||
$result = "=== Validation OK: $shortType.$objName ($checks checks) ==="
|
||||
} else {
|
||||
Out-Line ""
|
||||
Out-Line "=== Result: $($script:errors) errors, $($script:warnings) warnings ($checks checks) ==="
|
||||
$result = $script:output.ToString()
|
||||
}
|
||||
Write-Host $result
|
||||
|
||||
if ($OutFile) {
|
||||
@@ -554,8 +562,6 @@ if ($childObjNode) {
|
||||
} else {
|
||||
Report-OK "6. Attributes: none"
|
||||
}
|
||||
} else {
|
||||
Report-OK "6. Attributes: N/A"
|
||||
}
|
||||
|
||||
if ($script:stopped) { & $finalize; exit 1 }
|
||||
@@ -631,8 +637,6 @@ if ($childObjNode) {
|
||||
} else {
|
||||
Report-OK "7. TabularSections: none"
|
||||
}
|
||||
} else {
|
||||
Report-OK "7. TabularSections: N/A"
|
||||
}
|
||||
|
||||
if ($script:stopped) { & $finalize; exit 1 }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# epf-validate v1.0 — Validate 1C external data processor / report structure
|
||||
# epf-validate v1.1 — Validate 1C external data processor / report structure
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
# Works for both EPF (ExternalDataProcessor) and ERF (ExternalReport) — auto-detects
|
||||
|
||||
@@ -47,6 +47,7 @@ def main():
|
||||
sys.stderr.reconfigure(encoding="utf-8")
|
||||
parser = argparse.ArgumentParser(description="Validate 1C external data processor/report structure", allow_abbrev=False)
|
||||
parser.add_argument("-ObjectPath", required=True)
|
||||
parser.add_argument("-Detailed", action="store_true")
|
||||
parser.add_argument("-MaxErrors", type=int, default=30)
|
||||
parser.add_argument("-OutFile", default=None)
|
||||
args = parser.parse_args()
|
||||
@@ -91,8 +92,10 @@ def main():
|
||||
src_dir = os.path.dirname(resolved_path)
|
||||
|
||||
# --- Output infrastructure ---
|
||||
detailed = args.Detailed
|
||||
errors = 0
|
||||
warnings = 0
|
||||
ok_count = 0
|
||||
stopped = False
|
||||
output_lines = []
|
||||
|
||||
@@ -100,7 +103,10 @@ def main():
|
||||
output_lines.append(msg)
|
||||
|
||||
def report_ok(msg):
|
||||
out_line(f"[OK] {msg}")
|
||||
nonlocal ok_count
|
||||
ok_count += 1
|
||||
if detailed:
|
||||
out_line(f"[OK] {msg}")
|
||||
|
||||
def report_error(msg):
|
||||
nonlocal errors, stopped
|
||||
@@ -115,9 +121,13 @@ def main():
|
||||
out_line(f"[WARN] {msg}")
|
||||
|
||||
def finalize():
|
||||
out_line("")
|
||||
out_line(f"=== Result: {errors} errors, {warnings} warnings ===")
|
||||
result = "\n".join(output_lines)
|
||||
checks = ok_count + errors + warnings
|
||||
if errors == 0 and warnings == 0 and not detailed:
|
||||
result = f"=== Validation OK: {short_type}.{obj_name} ({checks} checks) ==="
|
||||
else:
|
||||
out_line("")
|
||||
out_line(f"=== Result: {errors} errors, {warnings} warnings ({checks} checks) ===")
|
||||
result = "\n".join(output_lines)
|
||||
print(result)
|
||||
if args.OutFile:
|
||||
with open(args.OutFile, "w", encoding="utf-8-sig") as fh:
|
||||
@@ -352,7 +362,7 @@ def main():
|
||||
else:
|
||||
report_ok("4. ChildObjects: empty")
|
||||
else:
|
||||
report_ok("4. ChildObjects: absent")
|
||||
pass # no ChildObjects — nothing to check
|
||||
|
||||
if stopped:
|
||||
finalize()
|
||||
@@ -400,7 +410,7 @@ def main():
|
||||
if refs:
|
||||
report_ok(f"5. Cross-references: {', '.join(refs)} valid")
|
||||
else:
|
||||
report_ok("5. Cross-references: none to check")
|
||||
pass # no cross-references to check
|
||||
|
||||
if stopped:
|
||||
finalize()
|
||||
@@ -461,9 +471,9 @@ def main():
|
||||
if check6_ok:
|
||||
report_ok(f"6. Attributes: {attr_count} checked (UUID, Name, Type)")
|
||||
else:
|
||||
report_ok("6. Attributes: none")
|
||||
pass # no attributes
|
||||
else:
|
||||
report_ok("6. Attributes: N/A")
|
||||
pass # no ChildObjects
|
||||
|
||||
if stopped:
|
||||
finalize()
|
||||
@@ -527,9 +537,9 @@ def main():
|
||||
if check7_ok:
|
||||
report_ok(f"7. TabularSections: {ts_count} sections, {ts_attr_total} inner attributes")
|
||||
else:
|
||||
report_ok("7. TabularSections: none")
|
||||
pass # no tabular sections
|
||||
else:
|
||||
report_ok("7. TabularSections: N/A")
|
||||
pass # no ChildObjects
|
||||
|
||||
if stopped:
|
||||
finalize()
|
||||
@@ -628,7 +638,7 @@ def main():
|
||||
if files_checked > 0:
|
||||
report_ok(f"9. File existence: {files_checked} files verified")
|
||||
else:
|
||||
report_ok("9. File existence: no forms/templates to check")
|
||||
pass # no forms/templates to check
|
||||
|
||||
if stopped:
|
||||
finalize()
|
||||
@@ -684,7 +694,7 @@ def main():
|
||||
if forms_checked > 0:
|
||||
report_ok(f"10. Form descriptors: {forms_checked} checked")
|
||||
else:
|
||||
report_ok("10. Form descriptors: none to check")
|
||||
pass # no form descriptors to check
|
||||
|
||||
# --- Final output ---
|
||||
finalize()
|
||||
|
||||
Reference in New Issue
Block a user