Skip to content

Commit

Permalink
Suppress S3236
Browse files Browse the repository at this point in the history
Suppress S3236 warnings.
  • Loading branch information
martincostello committed Aug 14, 2024
1 parent 483a4e5 commit 0d249c4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Polly.Core/ResilienceContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ internal void InitializeFrom(ResilienceContext context, CancellationToken cancel
Properties.AddOrReplaceProperties(context.Properties);
}

#pragma warning disable S3236 // Remove this argument from the method call; it hides the caller information.
[ExcludeFromCodeCoverage]
[Conditional("DEBUG")]
internal void AssertInitialized() => Debug.Assert(IsInitialized, "The resilience context is not initialized.");
#pragma warning restore S3236 // Remove this argument from the method call; it hides the caller information.

internal ResilienceContext Initialize<TResult>(bool isSynchronous)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Polly.Core/Retry/RetryHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ private static TimeSpan DecorrelatedJitterBackoffV2(int attempt, TimeSpan baseDe

long ticks = (long)Math.Min(formulaIntrinsicValue * RpScalingFactor * targetTicksFirstDelay, MaxTimeSpanTicks);

#pragma warning disable S3236 // Remove this argument from the method call; it hides the caller information.
Debug.Assert(ticks >= 0, "ticks cannot be negative");
#pragma warning restore S3236 // Remove this argument from the method call; it hides the caller information.

return TimeSpan.FromTicks(ticks);
}
Expand Down
2 changes: 2 additions & 0 deletions src/Polly.Core/Retry/RetryResilienceStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ protected internal override async ValueTask<Outcome<T>> ExecuteCore<TState>(Func
}
}

#pragma warning disable S3236 // Remove this argument from the method call; it hides the caller information.
Debug.Assert(delay >= TimeSpan.Zero, "The delay cannot be negative.");
#pragma warning restore S3236 // Remove this argument from the method call; it hides the caller information.

var onRetryArgs = new OnRetryArguments<T>(context, outcome, attempt, delay, executionTime);
_telemetry.Report<OnRetryArguments<T>, T>(new(ResilienceEventSeverity.Warning, RetryConstants.OnRetryEvent), onRetryArgs);
Expand Down
1 change: 1 addition & 0 deletions src/Polly.Core/Utils/TaskHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace Polly.Utils;

#pragma warning disable S3236 // Remove this argument from the method call; it hides the caller information.
#pragma warning disable S5034 // "ValueTask" should be consumed correctly

internal static class TaskHelper
Expand Down

0 comments on commit 0d249c4

Please sign in to comment.