Skip to content

Commit

Permalink
Put dotnet_diagnostic.CA1852.severity = warning into effect. Fix the …
Browse files Browse the repository at this point in the history
…resulting warnings
  • Loading branch information
Henr1k80 committed Sep 17, 2024
1 parent 62e2773 commit b627992
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions eng/analyzers/Library.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,7 @@ dotnet_diagnostic.CA1851.severity = suggestion
# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852
# Tags : Telemetry, EnabledRuleInAggressiveMode, CompilationEnd
dotnet_diagnostic.CA1852.severity = warning
dotnet_code_quality.CA1852.ignore_internalsvisibleto = true

# Title : Unnecessary call to 'Dictionary.ContainsKey(key)'
# Category : Performance
Expand Down
2 changes: 1 addition & 1 deletion src/Snippets/Docs/Chaos.Behavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static void Pattern_InjectDelay()
}
}

internal class RedisConnectionException : Exception
internal sealed class RedisConnectionException : Exception
{
public RedisConnectionException()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Snippets/Docs/Chaos.Index.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public static void CentralPipelineIntegration(IServiceCollection services)
#region chaos-extension

// Options that represent the chaos pipeline
public class MyChaosOptions
public sealed class MyChaosOptions
{
public ChaosFaultStrategyOptions Fault { get; set; } = new()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Snippets/Docs/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public static async Task KeyedServicesDefine(IServiceCollection services)

#region di-keyed-services-use

public class MyApi
public sealed class MyApi
{
private readonly ResiliencePipeline _pipeline;
private readonly ResiliencePipeline<HttpResponseMessage> _genericPipeline;
Expand Down
4 changes: 2 additions & 2 deletions src/Snippets/Docs/Fallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ public static void Usage()
#endregion
}

public class UserAvatar
public sealed class UserAvatar
{
public static readonly UserAvatar Blank = new();

public static UserAvatar GetRandomAvatar() => new();
}

private class CustomNetworkException : Exception
private sealed class CustomNetworkException : Exception
{
public CustomNetworkException()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Snippets/Docs/Hedging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ internal static class ResilienceKeys

#region hedging-handler

internal class HedgingHandler : DelegatingHandler
internal sealed class HedgingHandler : DelegatingHandler
{
private readonly ResiliencePipeline<HttpResponseMessage> _pipeline;

Expand Down
4 changes: 2 additions & 2 deletions src/Snippets/Docs/Performance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ static async (context, state) =>

private static ValueTask<Member> GetMemberAsync(string id, CancellationToken token) => default;

public class Member
public sealed class Member
{
}

#region perf-reuse-pipelines

public class MyApi
public sealed class MyApi
{
private readonly ResiliencePipelineRegistry<string> _registry;

Expand Down
4 changes: 2 additions & 2 deletions src/Snippets/Docs/Telemetry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ public static void AddResiliencePipelineWithTelemetry()

#region telemetry-listeners

internal class MyTelemetryListener : TelemetryListener
internal sealed class MyTelemetryListener : TelemetryListener
{
public override void Write<TResult, TArgs>(in TelemetryEventArguments<TResult, TArgs> args)
{
Console.WriteLine($"Telemetry event occurred: {args.Event.EventName}");
}
}

internal class MyMeteringEnricher : MeteringEnricher
internal sealed class MyMeteringEnricher : MeteringEnricher
{
public override void Enrich<TResult, TArgs>(in EnrichmentContext<TResult, TArgs> context)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Snippets/Docs/Utils/SomeExceptionType.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Snippets.Docs.Utils;

internal class SomeExceptionType : Exception
internal sealed class SomeExceptionType : Exception
{
public SomeExceptionType(string message)
: base(message)
Expand Down

0 comments on commit b627992

Please sign in to comment.