diff --git a/src/ALCops.ApplicationCop/Analyzers/UseReturnValueForDatabaseReadMethods.cs b/src/ALCops.ApplicationCop/Analyzers/UseReturnValueForDatabaseReadMethods.cs index 99b352c..1894497 100644 --- a/src/ALCops.ApplicationCop/Analyzers/UseReturnValueForDatabaseReadMethods.cs +++ b/src/ALCops.ApplicationCop/Analyzers/UseReturnValueForDatabaseReadMethods.cs @@ -34,7 +34,7 @@ private void AnalyzeInvocation(OperationAnalysisContext ctx) return; if (invocation.TargetMethod.MethodKind != EnumProvider.MethodKind.BuiltInMethod || - invocation.TargetMethod.ContainingSymbol?.Name != "Table" || + invocation.Instance?.Type.OriginalDefinition.Kind != EnumProvider.SymbolKind.Table || !DatabaseReadMethods.Contains(invocation.TargetMethod.Name)) return; diff --git a/src/ALCops.PlatformCop/Analyzers/SetRangeWithFilterOperators.cs b/src/ALCops.PlatformCop/Analyzers/SetRangeWithFilterOperators.cs index bd1897e..91de825 100644 --- a/src/ALCops.PlatformCop/Analyzers/SetRangeWithFilterOperators.cs +++ b/src/ALCops.PlatformCop/Analyzers/SetRangeWithFilterOperators.cs @@ -11,6 +11,8 @@ namespace ALCops.PlatformCop.Analyzers; [DiagnosticAnalyzer] public sealed class SetRangeWithFilterOperators : DiagnosticAnalyzer { + private const string SetRangeMethodName = "SetRange"; + private readonly Lazy replacementFieldPatternLazy = new Lazy((Func)(() => new Regex(@"%\d+", RegexOptions.Compiled))); private Regex ReplacementFieldPatternLazy => this.replacementFieldPatternLazy.Value; @@ -29,8 +31,8 @@ private void AnalyzeInvocation(OperationAnalysisContext ctx) return; if (operation.TargetMethod.MethodKind != EnumProvider.MethodKind.BuiltInMethod || - operation.TargetMethod.Name != "SetRange" || - operation.TargetMethod.ContainingSymbol?.Name != "Table" || + operation.TargetMethod.Name != SetRangeMethodName || + operation.Instance?.Type.OriginalDefinition.Kind != EnumProvider.SymbolKind.Table || operation.Arguments.Length < 2) return;