From f421221a006de203817e74e560edfd3a2dd53f84 Mon Sep 17 00:00:00 2001 From: Moony Date: Mon, 23 Feb 2026 22:07:22 +0100 Subject: [PATCH] Non-obsoletion warnings as errors in Release. (#42983) * Non-obsoletion warnings as errors in Release. * Add two other obsoletions related to collection expressions. These are not present in the codebase, but may become so in the future. * Exempt NU1903 so the project can't mysteriously stop building. * Fix some FULL_RELEASE mistakes. * diff fix * Resharper caught this one. Note to self: Wire up resharper to CI in another PR. --- Content.Client/Mapping/MappingState.cs | 6 +++++- Content.Server/Administration/Systems/AdminVerbSystem.cs | 2 +- Content.Server/Entry/EntryPoint.cs | 5 +++-- Content.Server/Mapping/MappingManager.cs | 2 ++ Content.Shared/Chat/SharedChatSystem.cs | 3 +++ Content.Shared/Maps/GameMapPrototype.cs | 3 +++ MSBuild/Content.props | 5 +++++ 7 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Content.Client/Mapping/MappingState.cs b/Content.Client/Mapping/MappingState.cs index 27440607cb6..190ae096769 100644 --- a/Content.Client/Mapping/MappingState.cs +++ b/Content.Client/Mapping/MappingState.cs @@ -37,7 +37,10 @@ namespace Content.Client.Mapping; public sealed class MappingState : GameplayStateBase { + #if !FULL_RELEASE [Dependency] private readonly IClientAdminManager _admin = default!; + #endif + [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IEntityNetworkManager _entityNetwork = default!; [Dependency] private readonly IInputManager _input = default!; @@ -746,12 +749,13 @@ public sealed class MappingState : GameplayStateBase { #if FULL_RELEASE return false; -#endif +#else if (!_admin.IsAdmin(true) || !_admin.HasFlag(AdminFlags.Host)) return false; SaveMap(); return true; +#endif } private bool HandleEnablePick(ICommonSession? session, EntityCoordinates coords, EntityUid uid) diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.cs b/Content.Server/Administration/Systems/AdminVerbSystem.cs index b94b4b943b1..420b5bbe74f 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.cs @@ -480,7 +480,7 @@ namespace Content.Server.Administration.Systems } // Control mob verb - if (_toolshed.ActivePermissionController?.CheckInvokable(new CommandSpec(_toolshed.DefaultEnvironment.GetCommand("mind"), "control"), player, out _) ?? false && + if ((_toolshed.ActivePermissionController?.CheckInvokable(new CommandSpec(_toolshed.DefaultEnvironment.GetCommand("mind"), "control"), player, out _) ?? false) && args.User != args.Target) { Verb verb = new() diff --git a/Content.Server/Entry/EntryPoint.cs b/Content.Server/Entry/EntryPoint.cs index d6095d9994c..fb6d3e282d9 100644 --- a/Content.Server/Entry/EntryPoint.cs +++ b/Content.Server/Entry/EntryPoint.cs @@ -1,3 +1,4 @@ +using System.Threading.Tasks; using Content.Server.Acz; using Content.Server.Administration; using Content.Server.Administration.Logs; @@ -207,8 +208,8 @@ namespace Content.Server.Entry _serverApi.Shutdown(); - // TODO Should this be awaited? - _discordLink.Shutdown(); + // We don't care when or how this finishes, just spin the task off into the void. + _ = _discordLink.Shutdown(); _discordChatLink.Shutdown(); } diff --git a/Content.Server/Mapping/MappingManager.cs b/Content.Server/Mapping/MappingManager.cs index 3a46b301e83..dc0dcf4d42c 100644 --- a/Content.Server/Mapping/MappingManager.cs +++ b/Content.Server/Mapping/MappingManager.cs @@ -14,6 +14,7 @@ namespace Content.Server.Mapping; public sealed class MappingManager : IPostInjectInit { +#if !FULL_RELEASE [Dependency] private readonly IAdminManager _admin = default!; [Dependency] private readonly ILogManager _log = default!; [Dependency] private readonly IServerNetManager _net = default!; @@ -23,6 +24,7 @@ public sealed class MappingManager : IPostInjectInit private ISawmill _sawmill = default!; private ZStdCompressionContext _zstd = default!; +#endif public void PostInject() { diff --git a/Content.Shared/Chat/SharedChatSystem.cs b/Content.Shared/Chat/SharedChatSystem.cs index cc571652f63..fbfb864bd86 100644 --- a/Content.Shared/Chat/SharedChatSystem.cs +++ b/Content.Shared/Chat/SharedChatSystem.cs @@ -303,7 +303,10 @@ public abstract partial class SharedChatSystem : EntitySystem public static string InjectTagAroundString(ChatMessage message, string targetString, string tag, string? tagParameter) { var rawmsg = message.WrappedMessage; + // TODO: Figure out if there's any way we can cache this, and if not then rewrite this to not use regex. +#pragma warning disable RA0026 rawmsg = Regex.Replace(rawmsg, "(?i)(" + targetString + ")(?-i)(?![^[]*])", $"[{tag}={tagParameter}]$1[/{tag}]"); +#pragma warning restore RA0026 return rawmsg; } diff --git a/Content.Shared/Maps/GameMapPrototype.cs b/Content.Shared/Maps/GameMapPrototype.cs index fc973764120..ec199904eaa 100644 --- a/Content.Shared/Maps/GameMapPrototype.cs +++ b/Content.Shared/Maps/GameMapPrototype.cs @@ -57,6 +57,8 @@ public sealed partial class GameMapPrototype : IPrototype /// public GameMapPrototype Persistence(ResPath mapPath) { + //TODO(Kaylie): Refactor gamemaps for this. +#pragma warning disable RA0039 return new() { ID = ID, @@ -64,5 +66,6 @@ public sealed partial class GameMapPrototype : IPrototype MapPath = mapPath, _stations = _stations }; +#pragma warning restore RA0039 } } diff --git a/MSBuild/Content.props b/MSBuild/Content.props index 7216961fa0c..de44d3ccc65 100644 --- a/MSBuild/Content.props +++ b/MSBuild/Content.props @@ -9,4 +9,9 @@ false enable + + + true + CS0618,CS0672,CS0612,CS1062,CS1064,NU1903 +