Skip to content

Commit 8bd7f91

Browse files
committed
fix: use legacyPattern in type mapping validation to detect dash-stripped variable names
The legacyPattern variable (dash-stripped form of legacy variable name) was computed but never used in CheckTypeMappingUsageAsync. The Contains check only looked for the original hyphenated form, missing cases where COBOL variables like WS-ACCOUNT-NUM appear as WSACCOUNTNUM in converted code. Now checks for both forms, consistent with CheckSignatureUsageAsync above. Resolves github-code-quality warning on PR #22.
1 parent eea5baf commit 8bd7f91

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Chunking/Validation/ConversionValidator.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,15 +363,16 @@ private Task<List<ConsistencyIssue>> CheckTypeMappingUsageAsync(
363363
// Check for legacy variable name usage in converted code
364364
var legacyPattern = mapping.LegacyVariable.Replace("-", "");
365365

366-
if (chunk.ConvertedCode.Contains(mapping.LegacyVariable, StringComparison.OrdinalIgnoreCase))
366+
if (chunk.ConvertedCode.Contains(mapping.LegacyVariable, StringComparison.OrdinalIgnoreCase) ||
367+
chunk.ConvertedCode.Contains(legacyPattern, StringComparison.OrdinalIgnoreCase))
367368
{
368369
issues.Add(new ConsistencyIssue
369370
{
370371
IssueType = ConsistencyIssueType.VariableNameMismatch,
371372
EntityName = mapping.LegacyVariable,
372373
Expected = mapping.TargetFieldName,
373374
Actual = mapping.LegacyVariable,
374-
Description = $"Found legacy variable name '{mapping.LegacyVariable}' " +
375+
Description = $"Found legacy variable name '{mapping.LegacyVariable}' (or pattern '{legacyPattern}') " +
375376
$"in converted code - should be '{mapping.TargetFieldName}'",
376377
Severity = IssueSeverity.Warning,
377378
CanAutoFix = true

0 commit comments

Comments
 (0)