suppress non-applicable code warnings

This commit is contained in:
Jesse Plamondon-Willard 2021-12-04 15:55:16 -05:00
parent 1d7340f598
commit 711e17a4f9
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
6 changed files with 26 additions and 0 deletions

View File

@ -9,6 +9,21 @@
<!--set platform-->
<DefineConstants Condition="$(OS) == 'Windows_NT'">$(DefineConstants);SMAPI_FOR_WINDOWS</DefineConstants>
<CopyToGameFolder>true</CopyToGameFolder>
<!-- allow mods to be compiled as AnyCPU for compatibility with older platforms -->
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
<!--
suppress warnings that don't apply, so it's easier to spot actual issues.
warning | builds | summary | rationale
┄┄┄┄┄┄┄ | ┄┄┄┄┄┄┄ | ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ | ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
CS0436 | all | local type conflicts with imported type | SMAPI needs to use certain low-level code during very early compatibility checks, before it's safe to load any other DLLs.
CA1416 | all | platform code available on all platforms | Compiler doesn't recognize the #if constants used by SMAPI.
CS0809 | all | obsolete overload for non-onsolete member | This is deliberate to signal to mods that certain APIs are only implemented for the game and shouldn't be called by mods.
NU1701 | all | NuGet package targets older .NET version | All such packages are carefully tested to make sure they do work.
-->
<NoWarn>$(NoWarn);CS0436;CA1416;CS0809;NU1701</NoWarn>
</PropertyGroup>
<!--find game folder-->

View File

@ -4,6 +4,8 @@ using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using HarmonyLib;
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters that shouldn't be called directly.
namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades
{
/// <summary>Maps Harmony 1.x <see cref="AccessTools"/> methods to Harmony 2.x to avoid breaking older mods.</summary>

View File

@ -5,6 +5,8 @@ using System.Reflection;
using System.Reflection.Emit;
using HarmonyLib;
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters that shouldn't be called directly.
namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades
{
/// <summary>Maps Harmony 1.x <code>HarmonyInstance</code> methods to Harmony 2.x's <see cref="Harmony"/> to avoid breaking older mods.</summary>

View File

@ -3,6 +3,8 @@ using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using HarmonyLib;
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters that shouldn't be called directly.
namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades
{
/// <summary>Maps Harmony 1.x <see cref="HarmonyMethod"/> methods to Harmony 2.x to avoid breaking older mods.</summary>

View File

@ -2,6 +2,9 @@ using System.Diagnostics.CodeAnalysis;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
#pragma warning disable CS0109 // Member does not hide an inherited member, new keyword is not required: This is deliberate to support legacy XNA Framework platforms.
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member: This is internal code to support rewriters that shouldn't be called directly.
namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades
{
/// <summary>Provides <see cref="SpriteBatch"/> method signatures that can be injected into mod code for compatibility with mods written for XNA Framework before Stardew Valley 1.5.5.</summary>

View File

@ -105,7 +105,9 @@ namespace StardewModdingAPI.Utilities
/// <summary>Get the keybind state relative to the previous tick.</summary>
public SButtonState GetState()
{
#pragma warning disable CS0618 // Type or member is obsolete: deliberate call to GetButtonState() for unit tests
SButtonState[] states = this.Buttons.Select(this.GetButtonState).Distinct().ToArray();
#pragma warning restore CS0618
// single state
if (states.Length == 1)