mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-06 11:40:20 +03:00
fix(subsystem): normalize content refs — plural/Russian to singular English
subsystem-compile and subsystem-edit now auto-normalize content type prefixes (Catalogs→Catalog, Справочник→Catalog, Справочники→Catalog). subsystem-validate detects plural forms as errors in check #6. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
ffc34904c5
commit
9620c3846a
@@ -1,4 +1,4 @@
|
||||
# subsystem-validate v1.1 — Validate 1C subsystem XML structure
|
||||
# subsystem-validate v1.2 — Validate 1C subsystem XML structure
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$SubsystemPath,
|
||||
@@ -65,6 +65,19 @@ function Report-Warn([string]$msg) {
|
||||
$guidPattern = '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$'
|
||||
$identPattern = '^[A-Za-z\u0410-\u042F\u0401\u0430-\u044F\u0451_][A-Za-z0-9\u0410-\u042F\u0401\u0430-\u044F\u0451_]*$'
|
||||
|
||||
# Known plural forms that are NOT valid in subsystem Content (platform expects singular)
|
||||
$knownPluralTypes = @(
|
||||
"Catalogs","Documents","Enums","Constants","Reports","DataProcessors"
|
||||
"InformationRegisters","AccumulationRegisters","AccountingRegisters","CalculationRegisters"
|
||||
"ChartsOfAccounts","ChartsOfCharacteristicTypes","ChartsOfCalculationTypes"
|
||||
"BusinessProcesses","Tasks","ExchangePlans","DocumentJournals"
|
||||
"CommonModules","CommonCommands","CommonForms","CommonPictures","CommonTemplates"
|
||||
"CommonAttributes","CommandGroups","Roles","SessionParameters","FilterCriteria"
|
||||
"XDTOPackages","WebServices","HTTPServices","WSReferences","EventSubscriptions"
|
||||
"ScheduledJobs","SettingsStorages","FunctionalOptions","FunctionalOptionsParameters"
|
||||
"DefinedTypes","DocumentNumerators","Sequences","Subsystems","StyleItems","IntegrationServices"
|
||||
)
|
||||
|
||||
# --- 1. XML well-formedness + root structure ---
|
||||
$xmlDoc = $null
|
||||
try {
|
||||
@@ -190,6 +203,13 @@ if (-not $script:stopped) {
|
||||
Report-Error "6. Content item `"$text`": invalid format (expected Type.Name or UUID)"
|
||||
$contentOk = $false
|
||||
}
|
||||
if ($text -match '^([A-Za-z]+)\.') {
|
||||
$typePart = $Matches[1]
|
||||
if ($typePart -in $knownPluralTypes) {
|
||||
Report-Error "6. Content item `"$text`": uses plural form `"$typePart`" (platform requires singular, e.g. Catalog not Catalogs)"
|
||||
$contentOk = $false
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($contentOk) { Report-OK "6. Content: $($xrItems.Count) items, all valid MDObjectRef format" }
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# subsystem-validate v1.1 — Validate 1C subsystem XML structure
|
||||
# subsystem-validate v1.2 — Validate 1C subsystem XML structure
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
"""Validates subsystem XML file structure, properties, content items, child objects."""
|
||||
import sys, os, argparse, re
|
||||
@@ -20,6 +20,18 @@ IDENT_PATTERN = re.compile(
|
||||
r'[A-Za-z0-9\u0410-\u042F\u0401\u0430-\u044F\u0451_]*$'
|
||||
)
|
||||
|
||||
KNOWN_PLURAL_TYPES = {
|
||||
'Catalogs', 'Documents', 'Enums', 'Constants', 'Reports', 'DataProcessors',
|
||||
'InformationRegisters', 'AccumulationRegisters', 'AccountingRegisters', 'CalculationRegisters',
|
||||
'ChartsOfAccounts', 'ChartsOfCharacteristicTypes', 'ChartsOfCalculationTypes',
|
||||
'BusinessProcesses', 'Tasks', 'ExchangePlans', 'DocumentJournals',
|
||||
'CommonModules', 'CommonCommands', 'CommonForms', 'CommonPictures', 'CommonTemplates',
|
||||
'CommonAttributes', 'CommandGroups', 'Roles', 'SessionParameters', 'FilterCriteria',
|
||||
'XDTOPackages', 'WebServices', 'HTTPServices', 'WSReferences', 'EventSubscriptions',
|
||||
'ScheduledJobs', 'SettingsStorages', 'FunctionalOptions', 'FunctionalOptionsParameters',
|
||||
'DefinedTypes', 'DocumentNumerators', 'Sequences', 'Subsystems', 'StyleItems', 'IntegrationServices',
|
||||
}
|
||||
|
||||
|
||||
class Reporter:
|
||||
def __init__(self, max_errors, detailed=False):
|
||||
@@ -234,6 +246,10 @@ def main():
|
||||
if not re.match(r'^[A-Za-z]+\..+$', text) and not GUID_PATTERN.match(text):
|
||||
r.error(f'6. Content item "{text}": invalid format (expected Type.Name or UUID)')
|
||||
content_ok = False
|
||||
m = re.match(r'^([A-Za-z]+)\.', text)
|
||||
if m and m.group(1) in KNOWN_PLURAL_TYPES:
|
||||
r.error(f'6. Content item "{text}": uses plural form "{m.group(1)}" (platform requires singular, e.g. Catalog not Catalogs)')
|
||||
content_ok = False
|
||||
if content_ok:
|
||||
r.ok(f'6. Content: {len(xr_items)} items, all valid MDObjectRef format')
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user