From 34ec982c5c3f09aa08b5651d3512b9c6624e9fbb Mon Sep 17 00:00:00 2001 From: Tayrtahn Date: Tue, 19 May 2026 09:45:59 -0400 Subject: [PATCH] Replace generated code check with GeneratedCodeAnalysisFlags --- Robust.Analyzers/AccessAnalyzer.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Robust.Analyzers/AccessAnalyzer.cs b/Robust.Analyzers/AccessAnalyzer.cs index 3068d806dd5..7a37281617e 100644 --- a/Robust.Analyzers/AccessAnalyzer.cs +++ b/Robust.Analyzers/AccessAnalyzer.cs @@ -1,7 +1,5 @@ -using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics.CodeAnalysis; -using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Operations; @@ -14,7 +12,6 @@ namespace Robust.Analyzers public class AccessAnalyzer : DiagnosticAnalyzer { private const string AccessAttributeType = "Robust.Shared.Analyzers.AccessAttribute"; - private const string RobustAutoGeneratedAttributeType = "Robust.Shared.Analyzers.RobustAutoGeneratedAttribute"; private const string PureAttributeType = "System.Diagnostics.Contracts.PureAttribute"; [SuppressMessage("ReSharper", "RS2008")] @@ -32,7 +29,7 @@ public class AccessAnalyzer : DiagnosticAnalyzer public override void Initialize(AnalysisContext context) { - context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics); + context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); context.EnableConcurrentExecution(); context.RegisterOperationAction(CheckFriendship, OperationKind.FieldReference, @@ -76,20 +73,11 @@ private void CheckFriendship(OperationAnalysisContext context) // Get the attributes var friendAttribute = context.Compilation.GetTypeByMetadataName(AccessAttributeType); - var autoGenAttribute = context.Compilation.GetTypeByMetadataName(RobustAutoGeneratedAttributeType); // Get the type that is containing this expression, or, the type where this is happening. if (context.ContainingSymbol?.ContainingType is not {} accessingType) return; - // Should we ignore the access attempt due to the accessing type being auto-generated? - if (accessingType.GetAttributes().FirstOrDefault(a => - a.AttributeClass != null && - a.AttributeClass.Equals(autoGenAttribute, SymbolEqualityComparer.Default)) is { } attr) - { - return; - } - // Determine which type of access is happening here... Read, write or execute? var accessAttempt = DetermineAccess(context, targetAccess, operation);