Use SuppressMessage attribute instead of #pragma warning
MODIFY
WalletWasabi.Backend/Startup.cs
WalletWasabi.Backend/Startup.cs
@@ -9,6 +9,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.OpenApi.Models;
using NBitcoin;
using System;
+using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
@@ -70,11 +71,8 @@ namespace WalletWasabi.Backend
services.AddResponseCompression();
}
- // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
-#pragma warning disable IDE0060 // Remove unused parameter
-
+ [SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "This method gets called by the runtime. Use this method to configure the HTTP request pipeline")]
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, Global global)
-#pragma warning restore IDE0060 // Remove unused parameter
{
app.UseStaticFiles();

MODIFY
WalletWasabi.Packager/NSubsys/PeUtility.cs
WalletWasabi.Packager/NSubsys/PeUtility.cs
using System;
+using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
@@ -67,12 +68,11 @@ namespace NSubsys
InternalBinReader?.Dispose();
}
-#pragma warning disable IDE1006 // Naming Styles
-
[StructLayout(LayoutKind.Explicit)]
public struct ImageDosHeader
{
[FieldOffset(60)]
+ [SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Public fields are not allowed")]
public uint FileAddressNew;
}
@@ -80,9 +80,8 @@ namespace NSubsys
public struct ImageOptionalHeader
{
[FieldOffset(68)]
+ [SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Public fields are not allowed")]
public ushort Subsystem;
}
-
-#pragma warning restore IDE1006 // Naming Styles
}
}

MODIFY
WalletWasabi.Tests/TestableRpcService.cs
WalletWasabi.Tests/TestableRpcService.cs
using System;
+using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Gui.Rpc;
@@ -37,12 +38,9 @@ namespace WalletWasabi.Tests
await Task.FromResult((JsonRpcResponse)null);
}
-#pragma warning disable IDE0060 // unused parameter
-
+ [SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "")]
private void Unused(object item)
{
}
-
-#pragma warning restore IDE0060
}
}

MODIFY
WalletWasabi/Blockchain/Transactions/SmartTransaction.cs
WalletWasabi/Blockchain/Transactions/SmartTransaction.cs
@@ -2,6 +2,7 @@ using NBitcoin;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Linq;
using WalletWasabi.Blockchain.Analysis.Clustering;
using WalletWasabi.Helpers;
@@ -64,9 +65,8 @@ namespace WalletWasabi.Blockchain.Transactions
[JsonProperty(PropertyName = "FirstSeenIfMempoolTime")]
[JsonConverter(typeof(BlockCypherDateTimeOffsetJsonConverter))]
[Obsolete("This property exists only for json backwards compatibility. If someone tries to set it, it'll set the FirstSeen. https://stackoverflow.com/a/43715009/2061103", error: true)]
-#pragma warning disable IDE0051 // Remove unused private members
+ [SuppressMessage("CodeQuality", "IDE0051:Remove unused private members", Justification = "json backwards compatibility")]
private DateTimeOffset? FirstSeenCompatibility
-#pragma warning restore IDE0051 // Remove unused private members
{
set
{

Use SuppressMessage attribute instead of #pragma warning