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.
This commit is contained in:
Moony 2026-02-23 22:07:22 +01:00 committed by Coryler
parent 94a329fb5c
commit f421221a00
7 changed files with 22 additions and 4 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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();
}

View File

@ -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()
{

View File

@ -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;
}

View File

@ -57,6 +57,8 @@ public sealed partial class GameMapPrototype : IPrototype
/// </summary>
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
}
}

View File

@ -9,4 +9,9 @@
<IsPackable Condition="'$(IsPackable)' == ''">false</IsPackable>
<Nullable Condition="'$(Nullable)' == ''">enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>CS0618,CS0672,CS0612,CS1062,CS1064,NU1903</WarningsNotAsErrors>
</PropertyGroup>
</Project>