mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-18 01:00:24 +03:00
fix(cfe-validate): проверка модулей затирала имя расширения в итоговой строке
Новая проверка (сверка «файл модуля ↔ пометка») переиспользовала $objName — ту же переменную, из которой собирается финальная строка отчёта. В расширении с заимствованным объектом ps1 печатал «Validation OK: Extension.Цены» — имя последнего проверенного объекта вместо имени расширения. py-порт был прав, то есть порты разошлись молча. Расхождение видно только на непустом расширении с чистым результатом, поэтому ни один существующий кейс его не ловил: тесты сверяют снапшот, а итоговую строку — нет. Добавлены утверждения на неё в кейсы valid, with-borrowed-object и module-state-file-without-flag; проверено, что на старой версии скрипта они падают. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
8fe727e32f
commit
113dc9e928
@@ -1,4 +1,4 @@
|
|||||||
# cfe-validate v1.12 — Validate 1C configuration extension structure (CFE)
|
# cfe-validate v1.13 — Validate 1C configuration extension structure (CFE)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
@@ -1268,22 +1268,22 @@ if ($versionRank -ge 219 -and $childObjNode) {
|
|||||||
$typeName = $child.LocalName
|
$typeName = $child.LocalName
|
||||||
if (-not $moduleKindsByType.ContainsKey($typeName)) { continue }
|
if (-not $moduleKindsByType.ContainsKey($typeName)) { continue }
|
||||||
if (-not $childTypeDirMap.ContainsKey($typeName)) { continue }
|
if (-not $childTypeDirMap.ContainsKey($typeName)) { continue }
|
||||||
$objName = $child.InnerText.Trim()
|
$stateObjName = $child.InnerText.Trim()
|
||||||
if (-not $objName) { continue }
|
if (-not $stateObjName) { continue }
|
||||||
$typeDir = Join-Path $configDir $childTypeDirMap[$typeName]
|
$typeDir = Join-Path $configDir $childTypeDirMap[$typeName]
|
||||||
$objFile = Join-Path $typeDir "$objName.xml"
|
$objFile = Join-Path $typeDir "$stateObjName.xml"
|
||||||
if (-not (Test-Path $objFile)) { continue }
|
if (-not (Test-Path $objFile)) { continue }
|
||||||
$objText = [System.IO.File]::ReadAllText($objFile, [System.Text.Encoding]::UTF8)
|
$objText = [System.IO.File]::ReadAllText($objFile, [System.Text.Encoding]::UTF8)
|
||||||
if ($objText -notmatch '<ObjectBelonging>Adopted</ObjectBelonging>') { continue }
|
if ($objText -notmatch '<ObjectBelonging>Adopted</ObjectBelonging>') { continue }
|
||||||
|
|
||||||
foreach ($kind in $moduleKindsByType[$typeName]) {
|
foreach ($kind in $moduleKindsByType[$typeName]) {
|
||||||
$stateChecked++
|
$stateChecked++
|
||||||
$hasFile = Test-Path (Join-Path (Join-Path (Join-Path $typeDir $objName) "Ext") "$kind.bsl")
|
$hasFile = Test-Path (Join-Path (Join-Path (Join-Path $typeDir $stateObjName) "Ext") "$kind.bsl")
|
||||||
$hasFlag = $objText -match "<xr:Property>$kind</xr:Property>"
|
$hasFlag = $objText -match "<xr:Property>$kind</xr:Property>"
|
||||||
if ($hasFile -and -not $hasFlag) {
|
if ($hasFile -and -not $hasFlag) {
|
||||||
$stateIssues += "$typeName.$objName — есть $kind.bsl, но нет <xr:PropertyState> для $kind"
|
$stateIssues += "$typeName.$stateObjName — есть $kind.bsl, но нет <xr:PropertyState> для $kind"
|
||||||
} elseif ($hasFlag -and -not $hasFile) {
|
} elseif ($hasFlag -and -not $hasFile) {
|
||||||
$stateIssues += "$typeName.$objName — есть <xr:PropertyState> для $kind, но нет $kind.bsl"
|
$stateIssues += "$typeName.$stateObjName — есть <xr:PropertyState> для $kind, но нет $kind.bsl"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# cfe-validate v1.12 — Validate 1C configuration extension XML structure (CFE)
|
# cfe-validate v1.13 — Validate 1C configuration extension XML structure (CFE)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
"""Validates extension Configuration.xml: root, InternalInfo, extension properties, ChildObjects, borrowed objects."""
|
"""Validates extension Configuration.xml: root, InternalInfo, extension properties, ChildObjects, borrowed objects."""
|
||||||
import sys, os, argparse, re
|
import sys, os, argparse, re
|
||||||
|
|||||||
@@ -28,5 +28,10 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"params": { "extensionPath": "cfe" },
|
"params": { "extensionPath": "cfe" },
|
||||||
"expect": { "stdoutContains": "есть Module.bsl, но нет <xr:PropertyState> для Module" }
|
"expect": {
|
||||||
|
"stdoutContains": [
|
||||||
|
"есть Module.bsl, но нет <xr:PropertyState> для Module",
|
||||||
|
"=== Validation: Extension.Тест ==="
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,5 +6,6 @@
|
|||||||
"args": { "-Name": "Тест", "-OutputDir": "{workDir}/ext", "-ConfigPath": "{workDir}" }
|
"args": { "-Name": "Тест", "-OutputDir": "{workDir}/ext", "-ConfigPath": "{workDir}" }
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"params": { "extensionPath": "ext" }
|
"params": { "extensionPath": "ext" },
|
||||||
|
"expect": { "stdoutContains": "=== Validation OK: Extension.Тест" }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,5 +15,6 @@
|
|||||||
"args": { "-ExtensionPath": "{workDir}/ext", "-ConfigPath": "{workDir}", "-Object": "Catalog.Товары" }
|
"args": { "-ExtensionPath": "{workDir}/ext", "-ConfigPath": "{workDir}", "-Object": "Catalog.Товары" }
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"params": { "extensionPath": "ext" }
|
"params": { "extensionPath": "ext" },
|
||||||
|
"expect": { "stdoutContains": "=== Validation OK: Extension.Тест" }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user