Skip to content

Commit

Permalink
fix - Fixed warning illustration in standalone ana...
Browse files Browse the repository at this point in the history
...lyzers

---

We shouldn't illustrate warnings as "failures" just because they get printed as red. We've changed the message to align with the warning more appropriately.

---

Type: fix
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Sep 9, 2024
1 parent 643f995 commit 0461c38
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
8 changes: 7 additions & 1 deletion private/Nitrocid.LocaleCheckerStandalone/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//

using Microsoft.Build.Locator;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.MSBuild;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
Expand Down Expand Up @@ -53,7 +54,12 @@ static async Task Main()
// Create a workspace using the instance
using var workspace = MSBuildWorkspace.Create();
workspace.WorkspaceFailed += (o, e) =>
TextWriterColor.WriteColor($"Failed to load the workspace: [{e.Diagnostic.Kind}] {e.Diagnostic.Message}", true, ConsoleColors.Red);
{
if (e.Diagnostic.Kind == WorkspaceDiagnosticKind.Warning)
TextWriterColor.WriteColor($"Warning while loading the workspace: [{e.Diagnostic.Kind}] {e.Diagnostic.Message}", true, ConsoleColors.Yellow);
else
TextWriterColor.WriteColor($"Failed to load the workspace: [{e.Diagnostic.Kind}] {e.Diagnostic.Message}", true, ConsoleColors.Red);
};

// Check for Nitrocid solution
var solutionPath = "../../../../../Nitrocid.sln";
Expand Down
8 changes: 7 additions & 1 deletion private/Nitrocid.LocaleClean/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//

using Microsoft.Build.Locator;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.MSBuild;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
Expand Down Expand Up @@ -53,7 +54,12 @@ static async Task Main()
// Create a workspace using the instance
using var workspace = MSBuildWorkspace.Create();
workspace.WorkspaceFailed += (o, e) =>
TextWriterColor.WriteColor($"Failed to load the workspace: [{e.Diagnostic.Kind}] {e.Diagnostic.Message}", true, ConsoleColors.Red);
{
if (e.Diagnostic.Kind == WorkspaceDiagnosticKind.Warning)
TextWriterColor.WriteColor($"Warning while loading the workspace: [{e.Diagnostic.Kind}] {e.Diagnostic.Message}", true, ConsoleColors.Yellow);
else
TextWriterColor.WriteColor($"Failed to load the workspace: [{e.Diagnostic.Kind}] {e.Diagnostic.Message}", true, ConsoleColors.Red);
};

// Check for Nitrocid solution
var solutionPath = "../../../../../Nitrocid.sln";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//

using Microsoft.Build.Locator;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.MSBuild;
using System;
using System.IO;
Expand Down Expand Up @@ -51,7 +52,12 @@ static async Task Main(string[] args)
// Create a workspace using the instance
using var workspace = MSBuildWorkspace.Create();
workspace.WorkspaceFailed += (o, e) =>
TextWriterColor.WriteColor($"Failed to load the workspace: [{e.Diagnostic.Kind}] {e.Diagnostic.Message}", true, ConsoleColors.Red);
{
if (e.Diagnostic.Kind == WorkspaceDiagnosticKind.Warning)
TextWriterColor.WriteColor($"Warning while loading the workspace: [{e.Diagnostic.Kind}] {e.Diagnostic.Message}", true, ConsoleColors.Yellow);
else
TextWriterColor.WriteColor($"Failed to load the workspace: [{e.Diagnostic.Kind}] {e.Diagnostic.Message}", true, ConsoleColors.Red);
};

// Load the solution
var solutionPath = args[0];
Expand Down

0 comments on commit 0461c38

Please sign in to comment.