Skip to content

Commit f7b276f

Browse files
authored
Always check for globally excluded fields (#3150)
When deciding whether a field is excluded in the work item validation, check both the list of excluded fields specific to the work item type, and the list from the `AllWorkItemTypes` (`*`) section that should apply to all work item types. Previously, if the work item type had its own list of excluded fields, the global list of excluded fields was not checked anymore, requiring duplication in the configuration. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Internal code structure improvements with no user-visible changes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents f0f1523 + b6f47c4 commit f7b276f

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/MigrationTools.Clients.TfsObjectModel/Tools/TfsWorkItemTypeValidatorToolOptions.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,15 @@ public void Normalize()
101101
/// <param name="fieldReferenceName">Target field reference name.</param>
102102
public bool IsSourceFieldExcluded(string workItemType, string fieldReferenceName)
103103
{
104-
if (ExcludeSourceFields.TryGetValue(workItemType, out List<string> excludedFields))
104+
if (ExcludeSourceFields.TryGetValue(workItemType, out List<string> excludedFields)
105+
&& excludedFields.Contains(fieldReferenceName, _normalizedComparer))
105106
{
106-
return excludedFields.Contains(fieldReferenceName, _normalizedComparer);
107+
return true;
107108
}
108-
if (ExcludeSourceFields.TryGetValue(AllWorkItemTypes, out excludedFields))
109+
if (ExcludeSourceFields.TryGetValue(AllWorkItemTypes, out excludedFields)
110+
&& excludedFields.Contains(fieldReferenceName, _normalizedComparer))
109111
{
110-
return excludedFields.Contains(fieldReferenceName, _normalizedComparer);
112+
return true;
111113
}
112114
return false;
113115
}

0 commit comments

Comments
 (0)