From 5a498f47e555b548e71eb87b4f2b52099fe4da0c Mon Sep 17 00:00:00 2001
From: Arthur van de Vondervoort <arthur.vandevondervoort@vanroey.be>
Date: Tue, 19 Dec 2023 12:15:55 +0100
Subject: [PATCH] Move SkipFieldsNotMatchingType validation

---
 Design/Rule0044AnalyzeTransferField.cs | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/Design/Rule0044AnalyzeTransferField.cs b/Design/Rule0044AnalyzeTransferField.cs
index 4ec1373b..615a0433 100644
--- a/Design/Rule0044AnalyzeTransferField.cs
+++ b/Design/Rule0044AnalyzeTransferField.cs
@@ -58,10 +58,6 @@ private async void AnalyzeTransferFields(OperationAnalysisContext ctx)
             if (ctx.Operation.Syntax.GetType() != typeof(InvocationExpressionSyntax))
                 return;
 
-            IArgument? skipFieldsNotMatchingTypeParam = ((IInvocationExpression)ctx.Operation).Arguments.Where(args => SemanticFacts.IsSameName(args.Parameter.Name, "SkipFieldsNotMatchingType")).SingleOrDefault() as IArgument;
-            if (skipFieldsNotMatchingTypeParam != null)
-                if (skipFieldsNotMatchingTypeParam.Value.ConstantValue.HasValue && (bool)skipFieldsNotMatchingTypeParam.Value.ConstantValue.Value) return;
-
             InvocationExpressionSyntax invocationExpression = (InvocationExpressionSyntax)ctx.Operation.Syntax;
 
             Tuple<string, string>? records = GetInvokingRecordNames(invocationExpression);
@@ -243,6 +239,8 @@ private void ReportFieldDiagnostics(SyntaxNodeAnalysisContext ctx, Table table,
             if (invocationExpression.ArgumentList.Arguments.Count < 1)
                 return null;
 
+            if (invocationExpression.ArgumentList.Arguments.Count == 3 && invocationExpression.ArgumentList.Arguments[2].GetIdentifierOrLiteralValue() == "true") return null;
+
             if (invocationExpression.Expression.GetType() == typeof(MemberAccessExpressionSyntax))
             {
                 MemberAccessExpressionSyntax memberAccessExpression = (MemberAccessExpressionSyntax)invocationExpression.Expression;