Resolve CA1508

This commit is contained in:
JustArchi 2021-05-07 16:49:02 +02:00
parent 377df12924
commit 90ff43dc98
9 changed files with 15 additions and 2 deletions

View file

@ -111,7 +111,6 @@ dotnet_diagnostic.ca1028.severity = silent
dotnet_diagnostic.ca1031.severity = silent
# TODO - one at a time
dotnet_diagnostic.ca1508.severity = silent
dotnet_diagnostic.ca1819.severity = silent
dotnet_diagnostic.ca1812.severity = silent
dotnet_diagnostic.ca1823.severity = silent

View file

@ -351,7 +351,9 @@ namespace ArchiSteamFarm {
try {
#if NETFRAMEWORK
#pragma warning disable CA1508 // False positive
using (memoryStream) {
#pragma warning restore CA1508 // False positive
#else
await using (memoryStream.ConfigureAwait(false)) {
#endif

View file

@ -720,7 +720,9 @@ namespace ArchiSteamFarm {
throw new ArgumentNullException(nameof(appIDs));
}
#pragma warning disable CA1508 // False positive
ISet<uint> uniqueAppIDs = appIDs as ISet<uint> ?? appIDs.ToHashSet();
#pragma warning restore CA1508 // False positive
switch (ASF.GlobalConfig?.OptimizationMode) {
case GlobalConfig.EOptimizationMode.MinMemoryUsage:

View file

@ -179,7 +179,9 @@ namespace ArchiSteamFarm.Helpers {
}
try {
#pragma warning disable CA1508 // False positive
using (new FileStream(FilePath, FileMode.CreateNew)) { }
#pragma warning restore CA1508 // False positive
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
FileInfo fileInfo = new(FilePath);

View file

@ -152,7 +152,9 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
}
try {
#pragma warning disable CA1508 // False positive
if (cancellationToken.IsCancellationRequested || (webSocket.State != WebSocketState.Open)) {
#pragma warning restore CA1508 // False positive
return;
}

View file

@ -111,7 +111,7 @@ namespace ArchiSteamFarm {
Mutex? singleInstance = null;
for (byte i = 0; (i < WebBrowser.MaxTries) && (singleInstance == null); i++) {
for (byte i = 0; i < WebBrowser.MaxTries; i++) {
if (i > 0) {
await Task.Delay(1000).ConfigureAwait(false);
}

View file

@ -96,7 +96,9 @@ namespace ArchiSteamFarm {
LastChangeNumber = picsChanges.CurrentChangeNumber;
#pragma warning disable CA1508 // False positive
if (picsChanges.RequiresFullAppUpdate || picsChanges.RequiresFullPackageUpdate || ((picsChanges.AppChanges.Count == 0) && (picsChanges.PackageChanges.Count == 0))) {
#pragma warning restore CA1508 // False positive
if (ASF.GlobalDatabase != null) {
await ASF.GlobalDatabase.OnPICSChangesRestart(picsChanges.CurrentChangeNumber).ConfigureAwait(false);
}

View file

@ -312,7 +312,9 @@ namespace ArchiSteamFarm {
throw new ArgumentNullException(nameof(directory));
}
#pragma warning disable CA1508 // False positive
if ((prefixes == null) || (prefixes.Length == 0)) {
#pragma warning restore CA1508 // False positive
throw new ArgumentNullException(nameof(prefixes));
}

View file

@ -143,7 +143,9 @@ namespace ArchiSteamFarm.Web {
MemoryStream ms = new((int) response.Length);
#if NETFRAMEWORK
#pragma warning disable CA1508 // False positive
using (ms) {
#pragma warning restore CA1508 // False positive
#else
await using (ms.ConfigureAwait(false)) {
#endif