fix(form-validate): add ExternalDataProcessorObject/ExternalReportObject to valid cfg prefixes

Check 12 was flagging cfg:ExternalDataProcessorObject.X as "unrecognized cfg
prefix", but this is a valid XDTO type for external data processor (EPF) forms.
Found via snapshot verification against epf-add-form snapshots.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-04-05 19:53:58 +03:00
parent b0fdc32053
commit 3bd69baae6
2 changed files with 43 additions and 4 deletions
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# form-validate v1.2 — Validate 1C managed form
# form-validate v1.3 — Validate 1C managed form
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
@@ -43,6 +43,7 @@ VALID_CFG_PREFIXES = {
'ChartOfCharacteristicTypesObject', 'ChartOfCharacteristicTypesRef',
'ConstantsSet', 'DataProcessorObject', 'DocumentObject', 'DocumentRef',
'DynamicList', 'EnumRef', 'ExchangePlanObject', 'ExchangePlanRef',
'ExternalDataProcessorObject', 'ExternalReportObject',
'InformationRegisterRecordManager', 'InformationRegisterRecordSet',
'ReportObject', 'TaskObject', 'TaskRef',
}
@@ -103,6 +104,18 @@ def main():
root = tree.getroot()
# Detect context: config vs EPF/ERF
is_config_context = False
walk_dir = os.path.dirname(os.path.abspath(form_path))
for _ in range(15):
parent = os.path.dirname(walk_dir)
if parent == walk_dir:
break
if os.path.isfile(os.path.join(walk_dir, 'Configuration.xml')):
is_config_context = True
break
walk_dir = parent
errors = 0
warnings = 0
ok_count = 0
@@ -645,7 +658,10 @@ def main():
suffix = tv[4:] # after "cfg:"
prefix = suffix.split(".")[0]
if prefix in VALID_CFG_PREFIXES or suffix == "DynamicList":
pass # OK
# ExternalDataProcessorObject/ExternalReportObject valid only in EPF/ERF context
if is_config_context and prefix in ('ExternalDataProcessorObject', 'ExternalReportObject'):
report_warn(f'12. Type "{tv}": External* type in configuration context (use DataProcessorObject/ReportObject instead)')
type_warn_count += 1
else:
report_warn(f'12. Type "{tv}": unrecognized cfg prefix')
type_warn_count += 1