refactor(validate): свести Report-* к общему эталону вывода

interface-validate, subsystem-validate и xdto-validate отличались от остальных
шести валидаторов только стилем: инлайн-сигнатура вместо param-блока и
однострочный if. Приведены к эталону cf-validate.

form-validate и mxl-validate оставлены отдельным вариантом с обоснованием:
они пишут через Write-Host, а не через буферизованный Out-Line. Буферизация
нужна для -OutFile (тот же отчёт в файл), которого у этих двух навыков нет;
для модели-потребителя stdout одинаков — на успешном прогоне обе ветки дают
одну строку.

Семьи Report-OK/Error/Warn переведены из храповика в реестр с эталоном.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-08-08 21:23:58 +03:00
co-authored by Claude Opus 5
parent fadda6a287
commit f2216745e6
7 changed files with 61 additions and 18 deletions
@@ -1,4 +1,4 @@
# interface-validate v1.1 — Validate 1C CommandInterface.xml structure # interface-validate v1.2 — Validate 1C CommandInterface.xml structure (+Report-*: общий эталон вывода валидаторов)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param( param(
[Parameter(Mandatory)][Alias('Path')][string]$CIPath, [Parameter(Mandatory)][Alias('Path')][string]$CIPath,
@@ -55,12 +55,16 @@ function Report-OK([string]$msg) {
$script:okCount++ $script:okCount++
if ($Detailed) { Out-Line "[OK] $msg" } if ($Detailed) { Out-Line "[OK] $msg" }
} }
function Report-Error([string]$msg) { function Report-Error {
param([string]$msg)
$script:errors++ $script:errors++
Out-Line "[ERROR] $msg" Out-Line "[ERROR] $msg"
if ($script:errors -ge $MaxErrors) { $script:stopped = $true } if ($script:errors -ge $MaxErrors) {
$script:stopped = $true
}
} }
function Report-Warn([string]$msg) { function Report-Warn {
param([string]$msg)
$script:warnings++ $script:warnings++
Out-Line "[WARN] $msg" Out-Line "[WARN] $msg"
} }
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# interface-validate v1.1 — Validate 1C CommandInterface.xml structure # interface-validate v1.2 — Validate 1C CommandInterface.xml structure (+Report-*: общий эталон вывода валидаторов)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
"""Validates CommandInterface.xml sections, command references, order, duplicates.""" """Validates CommandInterface.xml sections, command references, order, duplicates."""
import sys, os, argparse, re import sys, os, argparse, re
@@ -1,4 +1,4 @@
# subsystem-validate v1.2 — Validate 1C subsystem XML structure # subsystem-validate v1.3 — Validate 1C subsystem XML structure (+Report-*: общий эталон вывода валидаторов)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param( param(
[Parameter(Mandatory)][Alias('Path')][string]$SubsystemPath, [Parameter(Mandatory)][Alias('Path')][string]$SubsystemPath,
@@ -52,12 +52,16 @@ function Report-OK([string]$msg) {
$script:okCount++ $script:okCount++
if ($Detailed) { Out-Line "[OK] $msg" } if ($Detailed) { Out-Line "[OK] $msg" }
} }
function Report-Error([string]$msg) { function Report-Error {
param([string]$msg)
$script:errors++ $script:errors++
Out-Line "[ERROR] $msg" Out-Line "[ERROR] $msg"
if ($script:errors -ge $MaxErrors) { $script:stopped = $true } if ($script:errors -ge $MaxErrors) {
$script:stopped = $true
}
} }
function Report-Warn([string]$msg) { function Report-Warn {
param([string]$msg)
$script:warnings++ $script:warnings++
Out-Line "[WARN] $msg" Out-Line "[WARN] $msg"
} }
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# subsystem-validate v1.2 — Validate 1C subsystem XML structure # subsystem-validate v1.3 — Validate 1C subsystem XML structure (+Report-*: общий эталон вывода валидаторов)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
"""Validates subsystem XML file structure, properties, content items, child objects.""" """Validates subsystem XML file structure, properties, content items, child objects."""
import sys, os, argparse, re import sys, os, argparse, re
@@ -1,4 +1,4 @@
# xdto-validate v1.1 — Validate a 1C XDTO package # xdto-validate v1.2 — Validate a 1C XDTO package (+Report-*: общий эталон вывода валидаторов)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param( param(
[Parameter(Mandatory)] [Parameter(Mandatory)]
@@ -47,12 +47,16 @@ function Report-OK([string]$msg) {
$script:okCount++ $script:okCount++
if ($Detailed) { Out-Line "[OK] $msg" } if ($Detailed) { Out-Line "[OK] $msg" }
} }
function Report-Error([string]$msg) { function Report-Error {
param([string]$msg)
$script:errors++ $script:errors++
Out-Line "[ERROR] $msg" Out-Line "[ERROR] $msg"
if ($script:errors -ge $MaxErrors) { $script:stopped = $true } if ($script:errors -ge $MaxErrors) {
$script:stopped = $true
}
} }
function Report-Warn([string]$msg) { function Report-Warn {
param([string]$msg)
$script:warnings++ $script:warnings++
Out-Line "[WARN] $msg" Out-Line "[WARN] $msg"
} }
@@ -1,4 +1,4 @@
# xdto-validate v1.1 — Validate a 1C XDTO package (Python port) # xdto-validate v1.2 — Validate a 1C XDTO package (Python port) (+Report-*: общий эталон вывода валидаторов)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse import argparse
import os import os
+34 -3
View File
@@ -111,6 +111,40 @@ const FAMILIES = [
], ],
}, },
// ─── Отчёт валидаторов ───────────────────────────────────────────────────
// Два варианта по способу вывода: буферизованный Out-Line копит отчёт в $script:output, что даёт
// -OutFile (та же выдача в файл) и вставку заголовка в начало; потоковый Write-Host этого не умеет.
// Для модели-потребителя stdout одинаков: на успешном прогоне обе ветки дают одну строку.
{
name: 'validate: report_error', py: null, ps1: 'Report-Error',
variants: [
{ id: 'buffered', authority: 'cf-validate',
consumers: ['cfe-validate', 'epf-validate', 'interface-validate', 'meta-validate',
'role-validate', 'skd-validate', 'subsystem-validate', 'xdto-validate'] },
{ id: 'streamed', authority: 'form-validate', consumers: ['mxl-validate'],
why: 'потоковый вывод вместо буферизованного — эти навыки не поддерживают -OutFile' },
],
},
{
name: 'validate: report_warn', py: null, ps1: 'Report-Warn',
variants: [
{ id: 'buffered', authority: 'cf-validate',
consumers: ['cfe-validate', 'epf-validate', 'interface-validate', 'meta-validate',
'role-validate', 'skd-validate', 'subsystem-validate', 'xdto-validate'] },
{ id: 'streamed', authority: 'form-validate', consumers: ['mxl-validate'],
why: 'потоковый вывод вместо буферизованного — эти навыки не поддерживают -OutFile' },
],
},
{
name: 'validate: report_ok', py: null, ps1: 'Report-OK',
variants: [
{ id: 'buffered', authority: 'cf-validate',
consumers: ['cfe-validate', 'epf-validate', 'meta-validate', 'role-validate', 'skd-validate'] },
{ id: 'streamed', authority: 'form-validate', consumers: ['mxl-validate'],
why: 'потоковый вывод вместо буферизованного — эти навыки не поддерживают -OutFile' },
],
},
// ─── Прощающий ввод: разбор строки типа ────────────────────────────────── // ─── Прощающий ввод: разбор строки типа ──────────────────────────────────
{ {
name: 'resolve_type_str', py: 'resolve_type_str', ps1: 'Resolve-TypeStr', name: 'resolve_type_str', py: 'resolve_type_str', ps1: 'Resolve-TypeStr',
@@ -229,9 +263,6 @@ const FAMILIES = [
const DRIFTED = [ const DRIFTED = [
{ name: 'emit_mltext', py: 'emit_mltext', ps1: 'Emit-MLText', maxVariants: { py: 5, ps1: 5 } }, { name: 'emit_mltext', py: 'emit_mltext', ps1: 'Emit-MLText', maxVariants: { py: 5, ps1: 5 } },
{ name: 'get_ml_text', py: 'get_ml_text', ps1: 'Get-MLText', maxVariants: { py: 7, ps1: 6 } }, { name: 'get_ml_text', py: 'get_ml_text', ps1: 'Get-MLText', maxVariants: { py: 7, ps1: 6 } },
{ name: 'validate: report_error', py: null, ps1: 'Report-Error', maxVariants: { ps1: 3 } },
{ name: 'validate: report_warn', py: null, ps1: 'Report-Warn', maxVariants: { ps1: 3 } },
{ name: 'validate: report_ok', py: null, ps1: 'Report-OK', maxVariants: { ps1: 3 } },
{ name: 'import_fragment', py: 'import_fragment', ps1: 'Import-Fragment', maxVariants: { py: 5, ps1: 4 } }, { name: 'import_fragment', py: 'import_fragment', ps1: 'Import-Fragment', maxVariants: { py: 5, ps1: 4 } },
{ name: 'get_child_indent', py: 'get_child_indent', ps1: 'Get-ChildIndent', maxVariants: { py: 4, ps1: 3 } }, { name: 'get_child_indent', py: 'get_child_indent', ps1: 'Get-ChildIndent', maxVariants: { py: 4, ps1: 3 } },
{ name: 'write_xml_file', py: 'write_xml_file', ps1: null, maxVariants: { py: 3 } }, { name: 'write_xml_file', py: 'write_xml_file', ps1: null, maxVariants: { py: 3 } },