Skip to content

Commit 6a43c8b

Browse files
committed
Don't use System.Diagnostics.CodeAnalysis as it can be conflicting with Hangfire.Annotations
1 parent f99227a commit 6a43c8b

7 files changed

+7
-14
lines changed

Diff for: src/Hangfire.Core/Dashboard/EmbeddedResourceDispatcher.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
// License along with Hangfire. If not, see <http://www.gnu.org/licenses/>.
1515

1616
using System;
17-
using System.Diagnostics.CodeAnalysis;
1817
using System.Reflection;
1918
using System.Threading.Tasks;
2019
using Hangfire.Annotations;
@@ -52,7 +51,7 @@ protected virtual Task WriteResponse(DashboardResponse response)
5251
return WriteResource(response, _assembly, _resourceName);
5352
}
5453

55-
[SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Context can be potentially accessed in derived classes.")]
54+
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Context can be potentially accessed in derived classes.")]
5655
protected async Task WriteResource(DashboardResponse response, Assembly assembly, string resourceName)
5756
{
5857
using (var inputStream = assembly.GetManifestResourceStream(resourceName))

Diff for: src/Hangfire.Core/Dashboard/HtmlHelper.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
using System.Text;
2121
using Hangfire.Common;
2222
using System.ComponentModel;
23-
using System.Diagnostics.CodeAnalysis;
2423
using System.Globalization;
2524
using System.Linq.Expressions;
2625
using System.Reflection;
@@ -31,7 +30,7 @@
3130

3231
namespace Hangfire.Dashboard
3332
{
34-
[SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "We use instance methods in this class for better observability.")]
33+
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "We use instance methods in this class for better observability.")]
3534
public class HtmlHelper
3635
{
3736
private static readonly Type DisplayNameType;

Diff for: src/Hangfire.Core/Dashboard/RouteCollection.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515

1616
using System;
1717
using System.Collections.Generic;
18-
using System.Diagnostics.CodeAnalysis;
1918
using System.Text.RegularExpressions;
2019
using Hangfire.Annotations;
2120

2221
namespace Hangfire.Dashboard
2322
{
24-
[SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix", Justification = "Public API, can not change in minor versions.")]
23+
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix", Justification = "Public API, can not change in minor versions.")]
2524
public class RouteCollection
2625
{
2726
private readonly List<Tuple<string, IDashboardDispatcher>> _dispatchers

Diff for: src/Hangfire.Core/GlobalConfiguration.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717

1818
using System;
1919
using System.ComponentModel;
20-
using System.Diagnostics.CodeAnalysis;
2120
using System.Threading;
2221
using Hangfire.Annotations;
2322

2423
namespace Hangfire
2524
{
26-
[SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Public API, can not touch in minor versions.")]
25+
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Public API, can not touch in minor versions.")]
2726
public enum CompatibilityLevel
2827
{
2928
Version_110 = 110,

Diff for: src/Hangfire.Core/Server/ServerJobCancellationToken.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
using Hangfire.Storage;
2121
using System.Collections.Concurrent;
2222
using System.Collections.Generic;
23-
using System.Diagnostics.CodeAnalysis;
2423
using System.Linq;
2524

2625
namespace Hangfire.Server
@@ -80,7 +79,7 @@ public void Dispose()
8079
}
8180
}
8281

83-
[SuppressMessage("SonarLint", "S4275:GettersAndSettersShouldAccessTheExpectedFields", Justification = "Bad property naming for backwards compatibility.")]
82+
[System.Diagnostics.CodeAnalysis.SuppressMessage("SonarLint", "S4275:GettersAndSettersShouldAccessTheExpectedFields", Justification = "Bad property naming for backwards compatibility.")]
8483
public CancellationToken ShutdownToken
8584
{
8685
get

Diff for: src/Hangfire.Core/States/StateChangeContext.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@
1515

1616
using System;
1717
using System.Collections.Generic;
18-
using System.Diagnostics.CodeAnalysis;
1918
using System.Threading;
2019
using Hangfire.Annotations;
2120
using Hangfire.Profiling;
2221
using Hangfire.Storage;
2322

2423
namespace Hangfire.States
2524
{
26-
[SuppressMessage("Design", "CA1068:CancellationToken parameters must come last", Justification = "Cancellation tokens in this class are used only as a part of a general context and don't have usual meaning.")]
25+
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1068:CancellationToken parameters must come last", Justification = "Cancellation tokens in this class are used only as a part of a general context and don't have usual meaning.")]
2726
public class StateChangeContext
2827
{
2928
public StateChangeContext(

Diff for: src/Hangfire.Core/States/StateMachine.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
using System;
1717
using System.Collections.Generic;
18-
using System.Diagnostics.CodeAnalysis;
1918
using Hangfire.Annotations;
2019
using Hangfire.Common;
2120
using Hangfire.Profiling;
@@ -46,7 +45,7 @@ internal StateMachine(
4645

4746
public IStateMachine InnerStateMachine => _innerStateMachine;
4847

49-
[SuppressMessage("Naming", "CA1725:Parameter names should match base declaration", Justification = "Parameter name changed to avoid ambiguity and errors in the method's implementation.")]
48+
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1725:Parameter names should match base declaration", Justification = "Parameter name changed to avoid ambiguity and errors in the method's implementation.")]
5049
public IState ApplyState(ApplyStateContext initialContext)
5150
{
5251
if (initialContext == null) throw new ArgumentNullException(nameof(initialContext));

0 commit comments

Comments
 (0)