diff --git a/Wabbajack.App.Wpf/Wabbajack.App.Wpf.csproj b/Wabbajack.App.Wpf/Wabbajack.App.Wpf.csproj index 93c5008b..92592bdc 100644 --- a/Wabbajack.App.Wpf/Wabbajack.App.Wpf.csproj +++ b/Wabbajack.App.Wpf/Wabbajack.App.Wpf.csproj @@ -15,9 +15,11 @@ true Wabbajack - CS8600 - CS8601 - CS8618 + + + + + CS8600,CS8601,CS8618,CS8604,CS8632 diff --git a/Wabbajack.Compiler.Test/Wabbajack.Compiler.Test.csproj b/Wabbajack.Compiler.Test/Wabbajack.Compiler.Test.csproj index e24059ce..68dbc575 100644 --- a/Wabbajack.Compiler.Test/Wabbajack.Compiler.Test.csproj +++ b/Wabbajack.Compiler.Test/Wabbajack.Compiler.Test.csproj @@ -25,6 +25,10 @@ all + + + CS8600,CS8601,CS8618,CS8604 + diff --git a/Wabbajack.Compiler/CompilationSteps/DropAll.cs b/Wabbajack.Compiler/CompilationSteps/DropAll.cs index 302a0f65..3d2f7320 100644 --- a/Wabbajack.Compiler/CompilationSteps/DropAll.cs +++ b/Wabbajack.Compiler/CompilationSteps/DropAll.cs @@ -10,10 +10,10 @@ public class DropAll : ACompilationStep { } - public override async ValueTask Run(RawSourceFile source) + public override ValueTask Run(RawSourceFile source) { var result = source.EvolveTo(); result.Reason = "No Match in Stack"; - return result; + return ValueTask.FromResult(result); } } \ No newline at end of file diff --git a/Wabbajack.Compression.BSA.Test/CompressionTests.cs b/Wabbajack.Compression.BSA.Test/CompressionTests.cs index 4dc09a99..ead5ee50 100644 --- a/Wabbajack.Compression.BSA.Test/CompressionTests.cs +++ b/Wabbajack.Compression.BSA.Test/CompressionTests.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Threading; @@ -12,6 +13,7 @@ using Xunit; namespace Wabbajack.Compression.BSA.Test; +[SuppressMessage("Usage", "xUnit1026:Theory methods should use all of their parameters")] public class CompressionTests { private readonly ILogger _logger; diff --git a/Wabbajack.Compression.BSA/FO4Archive/Reader.cs b/Wabbajack.Compression.BSA/FO4Archive/Reader.cs index 327b4220..ecbf4dae 100644 --- a/Wabbajack.Compression.BSA/FO4Archive/Reader.cs +++ b/Wabbajack.Compression.BSA/FO4Archive/Reader.cs @@ -48,7 +48,7 @@ public class Reader : IReader return rdr; } - private async Task LoadHeaders() + private Task LoadHeaders() { _headerMagic = Encoding.ASCII.GetString(_rdr.ReadBytes(4)); @@ -91,5 +91,7 @@ public class Reader : IReader Files = files; _stream?.Dispose(); _rdr.Dispose(); + + return Task.CompletedTask; } } \ No newline at end of file diff --git a/Wabbajack.Compression.BSA/TES3Archive/Builder.cs b/Wabbajack.Compression.BSA/TES3Archive/Builder.cs index 79913db0..128d7195 100644 --- a/Wabbajack.Compression.BSA/TES3Archive/Builder.cs +++ b/Wabbajack.Compression.BSA/TES3Archive/Builder.cs @@ -71,8 +71,8 @@ public class Builder : IBuilder } } - public async ValueTask DisposeAsync() + public ValueTask DisposeAsync() { - return; + return ValueTask.CompletedTask; } } \ No newline at end of file diff --git a/Wabbajack.Compression.BSA/TES3Archive/Reader.cs b/Wabbajack.Compression.BSA/TES3Archive/Reader.cs index 243eca8c..cafe2204 100644 --- a/Wabbajack.Compression.BSA/TES3Archive/Reader.cs +++ b/Wabbajack.Compression.BSA/TES3Archive/Reader.cs @@ -76,8 +76,9 @@ public class Reader : IReader return rdr; } - public async ValueTask DisposeAsync() + public ValueTask DisposeAsync() { + return ValueTask.CompletedTask; } public void Dump(Action print) diff --git a/Wabbajack.Downloaders.Dispatcher.Test/DownloaderTests.cs b/Wabbajack.Downloaders.Dispatcher.Test/DownloaderTests.cs index 4cacb020..5eba9549 100644 --- a/Wabbajack.Downloaders.Dispatcher.Test/DownloaderTests.cs +++ b/Wabbajack.Downloaders.Dispatcher.Test/DownloaderTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -14,6 +15,7 @@ using Xunit; namespace Wabbajack.Downloaders.Dispatcher.Test; +[SuppressMessage("Usage", "xUnit1026:Theory methods should use all of their parameters")] public class DownloaderTests { private readonly DownloadDispatcher _dispatcher; diff --git a/Wabbajack.Downloaders.Nexus/NexusDownloader.cs b/Wabbajack.Downloaders.Nexus/NexusDownloader.cs index 8bb1eb88..883dd5ef 100644 --- a/Wabbajack.Downloaders.Nexus/NexusDownloader.cs +++ b/Wabbajack.Downloaders.Nexus/NexusDownloader.cs @@ -46,9 +46,9 @@ public class NexusDownloader : ADownloader, IUrlDownloader _interventionLimiter = interventionLimiter; } - public override async Task Prepare() + public override Task Prepare() { - return _api.ApiKey.HaveToken(); + return Task.FromResult(_api.ApiKey.HaveToken()); } public override bool IsAllowed(ServerAllowList allowList, IDownloadState state) diff --git a/Wabbajack.Launcher/Wabbajack.Launcher.csproj b/Wabbajack.Launcher/Wabbajack.Launcher.csproj index fb961238..2b668595 100644 --- a/Wabbajack.Launcher/Wabbajack.Launcher.csproj +++ b/Wabbajack.Launcher/Wabbajack.Launcher.csproj @@ -6,6 +6,11 @@ enable Wabbajack + + + CS8600,CS8601,CS8618,CS8604 + + diff --git a/Wabbajack.Networking.NexusApi/NexusApi.cs b/Wabbajack.Networking.NexusApi/NexusApi.cs index 88e7e95e..caa4cbb9 100644 --- a/Wabbajack.Networking.NexusApi/NexusApi.cs +++ b/Wabbajack.Networking.NexusApi/NexusApi.cs @@ -15,7 +15,6 @@ using Wabbajack.DTOs.Logins; using Wabbajack.Networking.Http; using Wabbajack.Networking.Http.Interfaces; using Wabbajack.Networking.NexusApi.DTOs; -using Wabbajack.Paths; using Wabbajack.Paths.IO; using Wabbajack.RateLimiter; using Wabbajack.Server.DTOs; @@ -245,7 +244,7 @@ public class NexusApi throw new HttpException(result); var response = await result.Content.ReadFromJsonAsync(_jsonOptions); - return response; + return response!; } public async Task UploadFile(UploadDefinition d) { @@ -327,7 +326,7 @@ public class NexusApi _logger.LogInformation("Checking file status of {Uuid}", chunkStatus.UUID); var data = await _client.GetFromJsonAsync( $"https://upload.nexusmods.com/uploads/check_status?id={chunkStatus.UUID}"); - if (data.FileChunksAssembled) + if (data!.FileChunksAssembled) return data; await Task.Delay(TimeSpan.FromSeconds(5)); } diff --git a/Wabbajack.Networking.NexusApi/ProxiedNexusApi.cs b/Wabbajack.Networking.NexusApi/ProxiedNexusApi.cs index ef4d46a6..21397c0d 100644 --- a/Wabbajack.Networking.NexusApi/ProxiedNexusApi.cs +++ b/Wabbajack.Networking.NexusApi/ProxiedNexusApi.cs @@ -36,7 +36,7 @@ public class ProxiedNexusApi : NexusApi } protected override async ValueTask GenerateMessage(HttpMethod method, string uri, - params object[] parameters) + params object?[] parameters) { var msg = await base.GenerateMessage(method, uri, parameters); if (ProxiedEndpoints.Contains(uri)) diff --git a/Wabbajack.Networking.NexusApi/Wabbajack.Networking.NexusApi.csproj b/Wabbajack.Networking.NexusApi/Wabbajack.Networking.NexusApi.csproj index bee69700..7dfd728f 100644 --- a/Wabbajack.Networking.NexusApi/Wabbajack.Networking.NexusApi.csproj +++ b/Wabbajack.Networking.NexusApi/Wabbajack.Networking.NexusApi.csproj @@ -6,6 +6,10 @@ GPL-3.0-or-later $(VERSION) + + + CS8600,CS8601,CS8618,CS8604 + diff --git a/Wabbajack.Networking.WabbajackClientApi/CesiVFSCache.cs b/Wabbajack.Networking.WabbajackClientApi/CesiVFSCache.cs index 29f8ef80..311a5360 100644 --- a/Wabbajack.Networking.WabbajackClientApi/CesiVFSCache.cs +++ b/Wabbajack.Networking.WabbajackClientApi/CesiVFSCache.cs @@ -40,18 +40,18 @@ public class CesiVFSCache : IVfsCache } catch (Exception exception) { - _logger.LogInformation("Requesting CESI Information for: {Hash} - Not Found", hash.ToHex()); + _logger.LogInformation(exception, "Requesting CESI Information for: {Hash} - Not Found", hash.ToHex()); return null; } } - public async Task Put(IndexedVirtualFile file, CancellationToken token) + public Task Put(IndexedVirtualFile file, CancellationToken token) { - return; + return Task.CompletedTask; } - public async Task Clean() + public Task Clean() { - return; + return Task.CompletedTask; } } \ No newline at end of file diff --git a/Wabbajack.Networking.WabbajackClientApi/Client.cs b/Wabbajack.Networking.WabbajackClientApi/Client.cs index cd294d51..fdaf4e70 100644 --- a/Wabbajack.Networking.WabbajackClientApi/Client.cs +++ b/Wabbajack.Networking.WabbajackClientApi/Client.cs @@ -45,7 +45,6 @@ public class Client private readonly IResource _hashLimiter; private readonly IResource _limiter; private readonly ILogger _logger; - private readonly ParallelOptions _parallelOptions; private readonly ITokenProvider _token; @@ -461,7 +460,7 @@ public class Client var result = await _client.SendAsync(msg); return result.IsSuccessStatusCode; } - catch (Exception ex) + catch (Exception) { return false; } diff --git a/Wabbajack.Server.Lib/Wabbajack.Server.Lib.csproj b/Wabbajack.Server.Lib/Wabbajack.Server.Lib.csproj index 415aedb7..e6ee4394 100644 --- a/Wabbajack.Server.Lib/Wabbajack.Server.Lib.csproj +++ b/Wabbajack.Server.Lib/Wabbajack.Server.Lib.csproj @@ -4,6 +4,10 @@ net6.0 enable + + + CS8600,CS8601,CS8618,CS8604 + diff --git a/Wabbajack.VFS.Test/VFSTests.cs b/Wabbajack.VFS.Test/VFSTests.cs index fe8dee91..41f229d0 100644 --- a/Wabbajack.VFS.Test/VFSTests.cs +++ b/Wabbajack.VFS.Test/VFSTests.cs @@ -144,8 +144,8 @@ public class VFSTests : IDisposable await AddFile(_archiveTestTxt, "This is a test"); await ZipUpFolder(_archiveTestTxt.Parent, _testZip); - var inner_dir = @"archive\other\dir".ToRelativePath().RelativeTo(_vfsTestDir); - inner_dir.CreateDirectory(); + var innerDir = @"archive\other\dir".ToRelativePath().RelativeTo(_vfsTestDir); + innerDir.CreateDirectory(); await _testZip.MoveToAsync(@"archive\other\dir\nested.zip".ToRelativePath().RelativeTo(_vfsTestDir), true, CancellationToken.None); await ZipUpFolder(_archiveTestTxt.Parent, _testZip); @@ -168,9 +168,10 @@ public class VFSTests : IDisposable await filename.WriteAllTextAsync(text); } - private static async Task ZipUpFolder(AbsolutePath folder, AbsolutePath output) + private static Task ZipUpFolder(AbsolutePath folder, AbsolutePath output) { ZipFile.CreateFromDirectory(folder.ToString(), output.ToString()); folder.DeleteDirectory(); + return Task.CompletedTask; } } \ No newline at end of file diff --git a/Wabbajack.VFS/Context.cs b/Wabbajack.VFS/Context.cs index 3ad4fe3a..1461ed80 100644 --- a/Wabbajack.VFS/Context.cs +++ b/Wabbajack.VFS/Context.cs @@ -132,7 +132,7 @@ public class Context token, fileNames.Keys.ToHashSet()); } - catch (Exception ex) + catch (Exception) { await using var stream = await sfn.GetStream(); var hash = await stream.HashingCopy(Stream.Null, token); diff --git a/Wabbajack.VFS/IndexRoot.cs b/Wabbajack.VFS/IndexRoot.cs index 0c22a5b8..12070858 100644 --- a/Wabbajack.VFS/IndexRoot.cs +++ b/Wabbajack.VFS/IndexRoot.cs @@ -37,7 +37,7 @@ public class IndexRoot public IReadOnlyList AllFiles { get; } public IDictionary ByFullPath { get; } public ILookup ByHash { get; } - public ILookup ByName { get; set; } + public ILookup ByName { get; set; } public IDictionary ByRootPath { get; } public async Task Integrate(IEnumerable files) @@ -77,7 +77,7 @@ public class IndexRoot public static class EmptyLookup { - public static ILookup Instance { get; } = + public static ILookup Instance { get; } = Enumerable.Empty().ToLookup(x => default(TKey)); } } \ No newline at end of file diff --git a/Wabbajack.VFS/VirtualFile.cs b/Wabbajack.VFS/VirtualFile.cs index 9f6719bb..f15e43d6 100644 --- a/Wabbajack.VFS/VirtualFile.cs +++ b/Wabbajack.VFS/VirtualFile.cs @@ -26,7 +26,7 @@ public class VirtualFile private static readonly SignatureChecker DDSSig = new(FileType.DDS); - private IEnumerable _thisAndAllChildren; + private IEnumerable? _thisAndAllChildren; public IPath Name { get; internal set; } @@ -45,7 +45,7 @@ public class VirtualFile public ulong LastAnalyzed { get; internal set; } - public VirtualFile Parent { get; internal set; } + public VirtualFile? Parent { get; internal set; } public Context Context { get; set; } @@ -107,7 +107,7 @@ public class VirtualFile } - public VirtualFile TopParent => IsNative ? this : Parent.TopParent; + public VirtualFile TopParent => IsNative ? this : Parent!.TopParent; public T ThisAndAllChildrenReduced(T acc, Func fn) @@ -193,7 +193,7 @@ public class VirtualFile { Context = context, Name = relPath, - Parent = parent, + Parent = parent!, Size = stream.Length, LastModified = extractedFile.LastModifiedUtc.AsUnixTime(), LastAnalyzed = DateTime.Now.AsUnixTime(), @@ -277,11 +277,11 @@ public class VirtualFile var self = this; for (var idx = depth; idx != 0; idx -= 1) { - paths[idx - 1] = self.RelativeName; + paths[idx - 1] = self!.RelativeName; self = self.Parent; } - FullPath = new FullPath(self.AbsoluteName, paths); + FullPath = new FullPath(self!.AbsoluteName, paths); } } @@ -304,7 +304,7 @@ public class VirtualFile return Read(context, null, br); } - private static VirtualFile Read(Context context, VirtualFile parent, BinaryReader br) + private static VirtualFile Read(Context context, VirtualFile? parent, BinaryReader br) { var vf = new VirtualFile { @@ -371,7 +371,7 @@ public class VirtualFile return path; } - public VirtualFile InSameFolder(RelativePath relativePath) + public VirtualFile? InSameFolder(RelativePath relativePath) { var newPath = FullPath.InSameFolder(relativePath); return Context.Index.ByFullPath.TryGetValue(newPath, out var found) ? found : null; diff --git a/Wabbajack.VFS/Wabbajack.VFS.csproj b/Wabbajack.VFS/Wabbajack.VFS.csproj index 1a6b7a31..3f238cd6 100644 --- a/Wabbajack.VFS/Wabbajack.VFS.csproj +++ b/Wabbajack.VFS/Wabbajack.VFS.csproj @@ -6,6 +6,10 @@ $(VERSION) GPL-3.0-or-later + + + CS8600,CS8601,CS8618,CS8604 +