From 472b13d7c496f8631d29e594a13c8f57d2dfa4de Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Wed, 10 Nov 2021 06:32:47 -0700 Subject: [PATCH] Update ruleset, fix new warnings --- .../Destinations/Discord/DiscordClient.cs | 2 +- .../Helpers/HandlebarsFunctionHelpers.cs | 3 +- jellyfin.ruleset | 180 ++++++++++-------- 3 files changed, 106 insertions(+), 79 deletions(-) diff --git a/Jellyfin.Plugin.Webhook/Destinations/Discord/DiscordClient.cs b/Jellyfin.Plugin.Webhook/Destinations/Discord/DiscordClient.cs index 27db71c..43a8fb9 100644 --- a/Jellyfin.Plugin.Webhook/Destinations/Discord/DiscordClient.cs +++ b/Jellyfin.Plugin.Webhook/Destinations/Discord/DiscordClient.cs @@ -80,7 +80,7 @@ namespace Jellyfin.Plugin.Webhook.Destinations.Discord private static int FormatColorCode(string hexCode) { - return int.Parse(hexCode.Substring(1, 6), NumberStyles.HexNumber, CultureInfo.InvariantCulture); + return int.Parse(hexCode[1..6], NumberStyles.HexNumber, CultureInfo.InvariantCulture); } private static string GetMentionType(DiscordMentionType mentionType) diff --git a/Jellyfin.Plugin.Webhook/Helpers/HandlebarsFunctionHelpers.cs b/Jellyfin.Plugin.Webhook/Helpers/HandlebarsFunctionHelpers.cs index 6515029..bd41a0f 100644 --- a/Jellyfin.Plugin.Webhook/Helpers/HandlebarsFunctionHelpers.cs +++ b/Jellyfin.Plugin.Webhook/Helpers/HandlebarsFunctionHelpers.cs @@ -1,4 +1,5 @@ using System; +using System.Globalization; using HandlebarsDotNet; namespace Jellyfin.Plugin.Webhook.Helpers @@ -82,7 +83,7 @@ namespace Jellyfin.Plugin.Webhook.Helpers // UndefinedBindingResult means the parameter was a part of the provided dataset. return input is UndefinedBindingResult or null ? null - : Convert.ToString(input); + : Convert.ToString(input, CultureInfo.InvariantCulture); } } } diff --git a/jellyfin.ruleset b/jellyfin.ruleset index a1a75e9..8af791c 100644 --- a/jellyfin.ruleset +++ b/jellyfin.ruleset @@ -1,82 +1,108 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +