From 1c87004740dbd6366d7462cae3f21017b2ffb706 Mon Sep 17 00:00:00 2001 From: Sebastien Lebreton Date: Sat, 31 Aug 2024 16:26:02 +0200 Subject: [PATCH] Fix messages --- .editorconfig | 4 ++++ ConsoleCommands/SpawnBot.cs | 5 ++--- Features/Commands.cs | 2 +- Features/Health.cs | 2 ++ Features/SceneDumper.cs | 10 ---------- Installer/InstallCommand.cs | 2 +- 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/.editorconfig b/.editorconfig index 2c6ba23c..219e4295 100644 --- a/.editorconfig +++ b/.editorconfig @@ -132,6 +132,10 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false csharp_space_between_parentheses = false csharp_space_between_square_brackets = false +# Disabled diagnostics +dotnet_diagnostic.CA1016.severity = none +dotnet_diagnostic.CA1824.severity = none + # C++ Files [*.{cpp,h,in}] curly_bracket_next_line = true diff --git a/ConsoleCommands/SpawnBot.cs b/ConsoleCommands/SpawnBot.cs index 80f8d27e..92088b91 100644 --- a/ConsoleCommands/SpawnBot.cs +++ b/ConsoleCommands/SpawnBot.cs @@ -67,10 +67,9 @@ private static string[] GetBotNames() { var filter = new[] { "test", "event", "spirit", "shooterbtr" }; - return Enum + return [.. Enum .GetNames(typeof(WildSpawnType)) .Where(n => !filter.Any(f => n.IndexOf(f, StringComparison.OrdinalIgnoreCase) >= 0)) - .OrderBy(n => n) - .ToArray(); + .OrderBy(n => n)]; } } diff --git a/Features/Commands.cs b/Features/Commands.cs index b77253a3..9af1b99d 100644 --- a/Features/Commands.cs +++ b/Features/Commands.cs @@ -29,7 +29,7 @@ internal class Commands : FeatureRenderer public override KeyCode Key { get; set; } = KeyCode.RightAlt; private bool Registered { get; set; } = false; - private Dictionary PropertyDisplays { get; } = new(); + private Dictionary PropertyDisplays { get; } = []; protected override void Update() { diff --git a/Features/Health.cs b/Features/Health.cs index 3a325c6d..7cc5dd67 100644 --- a/Features/Health.cs +++ b/Features/Health.cs @@ -29,6 +29,7 @@ internal class Health : ToggleFeature private static readonly Array _bodyParts = Enum.GetValues(typeof(EBodyPart)); +#pragma warning disable IDE0060 [UsedImplicitly] protected static bool ApplyDamagePrefix(EBodyPart bodyPart, ActiveHealthController? __instance, ref float __result) { @@ -44,6 +45,7 @@ protected static bool ReceiveDamagePrefix(float damage, EBodyPart part, EDamageT { return UseBuiltinDamageLogic(__instance, part); } +#pragma warning restore IDE0060 protected static bool UseBuiltinDamageLogic(Player? player, EBodyPart bodyPart) { diff --git a/Features/SceneDumper.cs b/Features/SceneDumper.cs index 180b3c1f..9f2a023d 100644 --- a/Features/SceneDumper.cs +++ b/Features/SceneDumper.cs @@ -15,11 +15,6 @@ public class NamedData { public string? Name; - [UsedImplicitly] - public NamedData() - { - } - public override string ToString() { return Name ?? string.Empty; @@ -57,11 +52,6 @@ public class ComponentData { public string? Type; - [UsedImplicitly] - public ComponentData() - { - } - public override string ToString() { return Type ?? string.Empty; diff --git a/Installer/InstallCommand.cs b/Installer/InstallCommand.cs index d18108c2..0dc7659e 100644 --- a/Installer/InstallCommand.cs +++ b/Installer/InstallCommand.cs @@ -281,7 +281,7 @@ private static async Task GetCompilationAsync(CompilationCont .GetResources(context) .ToArray(); - if (compiler.IsLocalizationSupported() && !resources.Any()) + if (compiler.IsLocalizationSupported() && resources.Length == 0) { AnsiConsole.MarkupLine($"[yellow]Warning: no localization support for language '{context.Language.EscapeMarkup()}'.[/]"); compilation = null;