Skip to content

Commit

Permalink
Update process name check in CustomResourceDefinitionGenerator
Browse files Browse the repository at this point in the history
Removed the static readonly string array `allowedProcesses` from `CustomResourceDefinitionGenerator.cs` in the `Neon.Operator.Analyzers` namespace. Replaced the check for the current process name in the `allowedProcesses` array with a check for whether the process name contains any of the previously allowed process names ("VBCSCompiler", "testhost", "dotnet"). This check is now stored in the `shouldRunLive` variable. Also, updated the condition in the `if` statement to use the `shouldRunLive` variable instead of checking the `allowedProcesses` array.
  • Loading branch information
marcusbooyah committed Mar 20, 2024
1 parent eeb1546 commit 679a7f3
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ public class CustomResourceDefinitionGenerator : ISourceGenerator

public static XmlDocumentationProvider DocumentationProvider { get; set; } = new XmlDocumentationProvider();

private static readonly string[] allowedProcesses = { "VBCSCompiler", "testhost", "dotnet" };

public void Initialize(GeneratorInitializationContext context)
{
AppDomain.CurrentDomain.AssemblyResolve += OnResolveAssembly;
Expand Down Expand Up @@ -95,7 +93,9 @@ public void Execute(GeneratorExecutionContext context)

var processName = System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName;

if (!allowedProcesses.Contains(processName))
var shouldRunLive = processName.Contains("VBCSCompiler") || processName.Contains("testhost") || processName.Contains("dotnet");

if (!shouldRunLive)
{
// this is a hack to disable the analyzer during live editing

Expand Down

0 comments on commit 679a7f3

Please sign in to comment.