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:
Nick Shirokov
2026-03-09 18:14:44 +03:00
parent 93e4130ff2
commit 422e397381
30 changed files with 685 additions and 816 deletions
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# form-validate v1.0 — Validate 1C managed form
# form-validate v1.1 — Validate 1C managed form
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
@@ -23,10 +23,12 @@ def main():
sys.stderr.reconfigure(encoding="utf-8")
parser = argparse.ArgumentParser(description="Validate 1C managed form", allow_abbrev=False)
parser.add_argument("-FormPath", required=True)
parser.add_argument("-Detailed", action="store_true")
parser.add_argument("-MaxErrors", type=int, default=30)
args = parser.parse_args()
form_path = args.FormPath
detailed = args.Detailed
max_errors = args.MaxErrors
if not os.path.isfile(form_path):
@@ -48,22 +50,27 @@ def main():
errors = 0
warnings = 0
ok_count = 0
stopped = False
output_lines = []
def report_ok(msg):
print(f"[OK] {msg}")
nonlocal ok_count
ok_count += 1
if detailed:
output_lines.append(f"[OK] {msg}")
def report_error(msg):
nonlocal errors, stopped
errors += 1
print(f"[ERROR] {msg}")
output_lines.append(f"[ERROR] {msg}")
if errors >= max_errors:
stopped = True
def report_warn(msg):
nonlocal warnings
warnings += 1
print(f"[WARN] {msg}")
output_lines.append(f"[WARN] {msg}")
# --- Form name from path ---
form_name = os.path.splitext(os.path.basename(form_path))[0]
@@ -75,8 +82,8 @@ def main():
if form_dir:
form_name = os.path.basename(form_dir)
print(f"=== Validation: {form_name} ===")
print()
output_lines.append(f"=== Validation: Form.{form_name} ===")
output_lines.append("")
# Early BaseForm detection
has_base_form = root.find(f"{{{F_NS}}}BaseForm") is not None
@@ -319,8 +326,6 @@ def main():
path_msg = f"{path_msg}, {skip_note}" if path_msg else skip_note
if path_errors == 0 and path_msg:
report_ok(f"DataPath references: {path_msg}")
elif path_errors == 0:
report_ok("DataPath references: none")
# --- Check 6: Button command references ---
if not stopped:
@@ -355,8 +360,6 @@ def main():
if cmd_errors == 0 and cmd_checked > 0:
report_ok(f"Command references: {cmd_checked} buttons checked")
elif cmd_checked == 0:
report_ok("Command references: none")
# --- Check 7: Events have handler names ---
if not stopped:
@@ -396,8 +399,6 @@ def main():
if event_errors == 0 and event_checked > 0:
report_ok(f"Event handlers: {event_checked} events checked")
elif event_checked == 0:
report_ok("Event handlers: none")
# --- Check 8: Command actions ---
if not stopped:
@@ -416,8 +417,6 @@ def main():
if action_errors == 0 and action_checked > 0:
report_ok(f"Command actions: {action_checked} commands checked")
elif action_checked == 0:
report_ok("Command actions: none")
# --- Check 9: MainAttribute count ---
if not stopped:
@@ -568,18 +567,16 @@ def main():
if call_type_without_base:
report_warn("callType attributes found but no BaseForm \u2014 possible incorrect structure")
# --- Summary ---
print()
print("---")
print(f"Total: {len(all_elements)} elements, {len(attr_nodes)} attributes, {len(cmd_nodes)} commands")
if stopped:
print(f"Stopped after {max_errors} errors. Fix and re-run.")
if errors == 0 and warnings == 0:
print("All checks passed.")
# --- Finalize ---
checks = ok_count + errors + warnings
if errors == 0 and warnings == 0 and not detailed:
result = f"=== Validation OK: Form.{form_name} ({checks} checks) ==="
else:
print(f"Errors: {errors}, Warnings: {warnings}")
output_lines.append("")
output_lines.append(f"=== Result: {errors} errors, {warnings} warnings ({checks} checks) ===")
result = "\n".join(output_lines)
print(result)
if errors > 0:
sys.exit(1)