Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix S3800/CA1821/S2955 #2020

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Polly/Policy.HandleSyntax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static PolicyBuilder<TResult> HandleResult<TResult>(Func<TResult, bool> r
/// <remarks>This policy filter matches the <paramref name="result"/> value returned using .Equals(), ideally suited for value types such as int and enum. To match characteristics of class return types, consider the overload taking a result predicate.</remarks>
/// <returns>The PolicyBuilder instance.</returns>
public static PolicyBuilder<TResult> HandleResult<TResult>(TResult result) =>
HandleResult(new Func<TResult, bool>(r => (r != null && r.Equals(result)) || (r == null && result == null)));
HandleResult(new Func<TResult, bool>(r => (!Equals(r, default(TResult)) && r.Equals(result)) || (Equals(r, default(TResult)) && Equals(result, default(TResult)))));
}

public partial class Policy<TResult>
Expand Down Expand Up @@ -123,5 +123,5 @@ public static PolicyBuilder<TResult> HandleResult(Func<TResult, bool> resultPred
/// <remarks>This policy filter matches the <paramref name="result"/> value returned using .Equals(), ideally suited for value types such as int and enum. To match characteristics of class return types, consider the overload taking a result predicate.</remarks>
/// <returns>The PolicyBuilder instance.</returns>
public static PolicyBuilder<TResult> HandleResult(TResult result) =>
HandleResult(r => (r != null && r.Equals(result)) || (r == null && result == null));
HandleResult(r => (!Equals(r, default(TResult)) && r.Equals(result)) || (Equals(r, default(TResult)) && Equals(result, default(TResult))));
}
4 changes: 2 additions & 2 deletions src/Polly/PolicyBuilder.OrSyntax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public PolicyBuilder<TResult> OrResult<TResult>(Func<TResult, bool> resultPredic
/// <remarks>This policy filter matches the <paramref name="result"/> value returned using .Equals(), ideally suited for value types such as int and enum. To match characteristics of class return types, consider the overload taking a result predicate.</remarks>
/// <returns>The PolicyBuilder instance.</returns>
public PolicyBuilder<TResult> OrResult<TResult>(TResult result) =>
OrResult<TResult>(r => (r != null && r.Equals(result)) || (r == null && result == null));
OrResult<TResult>(r => (!Equals(r, default(TResult)) && r.Equals(result)) || (Equals(r, default(TResult)) && Equals(result, default(TResult))));

#endregion
}
Expand Down Expand Up @@ -130,7 +130,7 @@ public PolicyBuilder<TResult> OrResult(Func<TResult, bool> resultPredicate)
/// <remarks>This policy filter matches the <paramref name="result"/> value returned using .Equals(), ideally suited for value types such as int and enum. To match characteristics of class return types, consider the overload taking a result predicate.</remarks>
/// <returns>The PolicyBuilder instance.</returns>
public PolicyBuilder<TResult> OrResult(TResult result) =>
OrResult(r => (r != null && r.Equals(result)) || (r == null && result == null));
OrResult(r => (!Equals(r, default(TResult)) && r.Equals(result)) || (Equals(r, default(TResult)) && Equals(result, default(TResult))));

#endregion

Expand Down
6 changes: 3 additions & 3 deletions src/Polly/Polly.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<ProjectType>Library</ProjectType>
<MutationScore>70</MutationScore>
<IncludePollyUsings>true</IncludePollyUsings>
<NoWarn>$(NoWarn);IDE0011;S103;S3872;SA1402;SA1414;S3215;S2955</NoWarn>
<NoWarn>$(NoWarn);IDE0011;S103;S3872;SA1402;SA1414;S3215</NoWarn>
<NoWarn>$(NoWarn);IDE1006;CA1062;S107;CA1068;S4039;CA1000;CA1063;CA1031;CA1051</NoWarn>
<NoWarn>$(NoWarn);CA2211;S2223;CA1032;CA1815;CA1816;S4457;SA1615;SA1618;CA1033</NoWarn>
<NoWarn>$(NoWarn);S4023;CA1010;S3442;S3880;CA1064;SA1649;SA1625;SA1623;SA1118</NoWarn>
<NoWarn>$(NoWarn);S4023;CA1010;S3442;CA1064;SA1649;SA1625;SA1623;SA1118</NoWarn>
<NoWarn>$(NoWarn);S3253;S3971;S6605;CA1724;CA1716;SA1108;CA1710;S4049;S3246</NoWarn>
<NoWarn>$(NoWarn);CA1805;CA1821</NoWarn>
<NoWarn>$(NoWarn);CA1805</NoWarn>

<!--Pulic API Analyzers: We do not need to fix these as it would break compatibility with released Polly versions-->
<NoWarn>$(NoWarn);RS0037;</NoWarn>
Expand Down
4 changes: 2 additions & 2 deletions src/Polly/Utilities/TimedLock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ public void Dispose()
// in order to detect when the object is not freed.)
private class Sentinel
{
#if NETSTANDARD2_0
~Sentinel()
{
// If this finalizer runs, someone somewhere failed to
// call Dispose, which means we've failed to leave
// a monitor!
#if NETSTANDARD2_0
System.Diagnostics.Debug.Fail("Undisposed lock");
#endif
}
#endif
}

private readonly Sentinel _leakDetector;
Expand Down
Loading