Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanLarsson committed Apr 5, 2023
1 parent 79011ad commit 3c10ee3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions Gu.Roslyn.Asserts.Tests/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ dotnet_diagnostic.VSTHRD200.severity = none
# VSTHRD103: Call async methods when in an async method
dotnet_diagnostic.VSTHRD103.severity = none

dotnet_diagnostic.REFL039.severity = none
9 changes: 5 additions & 4 deletions Gu.Roslyn.Asserts/Internals/DefaultEnabledAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,24 @@ internal sealed class DefaultEnabledAnalyzer : DiagnosticAnalyzer
{
private readonly DiagnosticAnalyzer inner;

public DefaultEnabledAnalyzer(DiagnosticAnalyzer inner)
internal DefaultEnabledAnalyzer(DiagnosticAnalyzer inner)
{
this.inner = inner;
this.SupportedDiagnostics = EnabledDiagnostics(inner.SupportedDiagnostics);

static ImmutableArray<DiagnosticDescriptor> EnabledDiagnostics(ImmutableArray<DiagnosticDescriptor> source)
{
var builder = ImmutableArray.CreateBuilder<DiagnosticDescriptor>(source.Length);
for (var i = 0; i < source.Length; i++)
foreach (var diagnostic in source)
{
var diagnostic = source[i];
builder.Add(
new DiagnosticDescriptor(
diagnostic.Id,
diagnostic.Title,
diagnostic.MessageFormat,
diagnostic.Category,
diagnostic.DefaultSeverity,
true,
isEnabledByDefault: true,
diagnostic.Description,
diagnostic.HelpLinkUri,
diagnostic.CustomTags?.ToArray() ?? Array.Empty<string>()));
Expand All @@ -45,5 +44,7 @@ static ImmutableArray<DiagnosticDescriptor> EnabledDiagnostics(ImmutableArray<Di

public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; }

#pragma warning disable RS1025, RS1026
public override void Initialize(AnalysisContext context) => this.inner.Initialize(context);
#pragma warning restore RS1025, RS1026
}
5 changes: 3 additions & 2 deletions Gu.Roslyn.Asserts/Internals/StringLoader.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Gu.Roslyn.Asserts.Internals;
namespace Gu.Roslyn.Asserts.Internals;

using System.Text;
using System.Threading;
Expand Down Expand Up @@ -32,7 +32,8 @@ internal StringLoader(string document)
internal string Code { get; }

/// <inheritdoc />
public override Task<TextAndVersion> LoadTextAndVersionAsync(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken) => this.textAndVersion;
[System.Obsolete]
public override Task<TextAndVersion> LoadTextAndVersionAsync(Workspace? workspace, DocumentId? documentId, CancellationToken cancellationToken) => this.textAndVersion;

/// <summary>
/// Create a <see cref="StringLoader"/> for the document.
Expand Down

0 comments on commit 3c10ee3

Please sign in to comment.