diff --git a/DisCatSharp.Attributes/DeprecatedAttribute.cs b/DisCatSharp.Attributes/DeprecatedAttribute.cs index d0758cea1..bfcd0c2ae 100644 --- a/DisCatSharp.Attributes/DeprecatedAttribute.cs +++ b/DisCatSharp.Attributes/DeprecatedAttribute.cs @@ -19,5 +19,6 @@ public DeprecatedAttribute(string message) } public DeprecatedAttribute() - { } + { + } } diff --git a/DisCatSharp.Attributes/DiscordDeprecatedAttribute.cs b/DisCatSharp.Attributes/DiscordDeprecatedAttribute.cs index c51d37e83..ef14588c4 100644 --- a/DisCatSharp.Attributes/DiscordDeprecatedAttribute.cs +++ b/DisCatSharp.Attributes/DiscordDeprecatedAttribute.cs @@ -19,5 +19,6 @@ public DiscordDeprecatedAttribute(string message) } public DiscordDeprecatedAttribute() - { } + { + } } diff --git a/DisCatSharp.Attributes/DiscordInExperimentAttribute.cs b/DisCatSharp.Attributes/DiscordInExperimentAttribute.cs index cac91f3b8..ed6931160 100644 --- a/DisCatSharp.Attributes/DiscordInExperimentAttribute.cs +++ b/DisCatSharp.Attributes/DiscordInExperimentAttribute.cs @@ -19,5 +19,6 @@ public DiscordInExperimentAttribute(string message) } public DiscordInExperimentAttribute() - { } + { + } } diff --git a/DisCatSharp.Attributes/DiscordUnreleasedAttribute.cs b/DisCatSharp.Attributes/DiscordUnreleasedAttribute.cs index 6374c5743..7ba89a8cc 100644 --- a/DisCatSharp.Attributes/DiscordUnreleasedAttribute.cs +++ b/DisCatSharp.Attributes/DiscordUnreleasedAttribute.cs @@ -19,5 +19,6 @@ public DiscordUnreleasedAttribute(string message) } public DiscordUnreleasedAttribute() - { } + { + } } diff --git a/DisCatSharp.Attributes/ExperimentalAttribute.cs b/DisCatSharp.Attributes/ExperimentalAttribute.cs index c6a99a5ad..2cf4442ff 100644 --- a/DisCatSharp.Attributes/ExperimentalAttribute.cs +++ b/DisCatSharp.Attributes/ExperimentalAttribute.cs @@ -19,5 +19,6 @@ public ExperimentalAttribute(string message) } public ExperimentalAttribute() - { } + { + } } diff --git a/DisCatSharp.Experimental/DisCatSharp.Experimental.csproj b/DisCatSharp.Experimental/DisCatSharp.Experimental.csproj index 85de93f57..aa9ae6159 100644 --- a/DisCatSharp.Experimental/DisCatSharp.Experimental.csproj +++ b/DisCatSharp.Experimental/DisCatSharp.Experimental.csproj @@ -25,20 +25,20 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + - - - + + + diff --git a/DisCatSharp.Experimental/DisCatSharpExtensions.cs b/DisCatSharp.Experimental/DisCatSharpExtensions.cs index a335fc221..e69bebb9a 100644 --- a/DisCatSharp.Experimental/DisCatSharpExtensions.cs +++ b/DisCatSharp.Experimental/DisCatSharpExtensions.cs @@ -26,7 +26,8 @@ public static async Task GetUsernameAsync(this DiscordClient client, ulo /// /// The discord client. /// The profile id to get. - [RequiresFeature(Features.Override | Features.Experiment, "This method requires the guild and/or user to have access to clyde with treatment 5."), DiscordDeprecated] // TODO: Change to Features.Experiment + [RequiresFeature(Features.Override | Features.Experiment, "This method requires the guild and/or user to have access to clyde with treatment 5."), + DiscordDeprecated] // TODO: Change to Features.Experiment public static async Task GetClydeProfileAsync(this DiscordClient client, ulong profileId) { DiscordApiClientHook hook = new(client.ApiClient); @@ -37,7 +38,8 @@ public static async Task GetClydeProfileAsync(this DiscordClient c /// Gets the clyde settings for the given . /// /// The guild to get clyde's settings for. - [RequiresFeature(Features.Override | Features.Experiment, "This method requires the guild and/or user to have access to clyde with treatment 5."), DiscordDeprecated] // TODO: Change to Features.Experiment + [RequiresFeature(Features.Override | Features.Experiment, "This method requires the guild and/or user to have access to clyde with treatment 5."), + DiscordDeprecated] // TODO: Change to Features.Experiment public static async Task GetClydeSettingsAsync(this DiscordGuild guild) { DiscordApiClientHook hook = new(guild.Discord.ApiClient); @@ -49,7 +51,8 @@ public static async Task GetClydeSettingsAsync(this DiscordGuild /// /// The guild to modify clyde's settings for. /// The profile id to apply. - [RequiresFeature(Features.Override | Features.Experiment, "This method requires the guild and/or user to have access to clyde with treatment 5."), DiscordDeprecated] // TODO: Change to Features.Experiment + [RequiresFeature(Features.Override | Features.Experiment, "This method requires the guild and/or user to have access to clyde with treatment 5."), + DiscordDeprecated] // TODO: Change to Features.Experiment public static async Task ModifyClydeSettingsAsync(this DiscordGuild guild, ulong profileId) { DiscordApiClientHook hook = new(guild.Discord.ApiClient); @@ -65,7 +68,8 @@ public static async Task ModifyClydeSettingsAsync(this DiscordGui /// The new avatar. /// The new banner. /// The new theme colors. - [RequiresFeature(Features.Override | Features.Experiment, "This method requires the guild and/or user to have access to clyde with treatment 5."), DiscordDeprecated] // TODO: Change to Features.Experiment + [RequiresFeature(Features.Override | Features.Experiment, "This method requires the guild and/or user to have access to clyde with treatment 5."), + DiscordDeprecated] // TODO: Change to Features.Experiment public static async Task ModifyClydeSettingsAsync( this DiscordGuild guild, Optional name, @@ -77,11 +81,12 @@ public static async Task ModifyClydeSettingsAsync( { DiscordApiClientHook hook = new(guild.Discord.ApiClient); - return await hook.ModifyClydeSettingsAsync(guild.Id, name, personality, ImageTool.Base64FromStream(avatar), ImageTool.Base64FromStream(banner), themeColors.HasValue && themeColors.Value.Count != 0 - ? themeColors.Value.Select(x => x.Value).ToList() - : themeColors.HasValue - ? Optional.FromNullable?>(null) - : Optional.None); + return await hook.ModifyClydeSettingsAsync(guild.Id, name, personality, ImageTool.Base64FromStream(avatar), ImageTool.Base64FromStream(banner), + themeColors.HasValue && themeColors.Value.Count != 0 + ? themeColors.Value.Select(x => x.Value).ToList() + : themeColors.HasValue + ? Optional.FromNullable?>(null) + : Optional.None); } /// @@ -89,7 +94,8 @@ public static async Task ModifyClydeSettingsAsync( /// /// The discord client. /// The base base personality to generate a new one from. - [RequiresFeature(Features.Override | Features.Experiment, "This method requires the guild and/or user to have access to clyde with treatment 5."), DiscordDeprecated] // TODO: Change to Features.Experiment + [RequiresFeature(Features.Override | Features.Experiment, "This method requires the guild and/or user to have access to clyde with treatment 5."), + DiscordDeprecated] // TODO: Change to Features.Experiment public static async Task GenerateClydePersonalityAsync(this DiscordClient client, string? basePersonality = null) { DiscordApiClientHook hook = new(client.ApiClient); diff --git a/DisCatSharp.Experimental/DiscordApiClientHook.cs b/DisCatSharp.Experimental/DiscordApiClientHook.cs index 687010373..270417658 100644 --- a/DisCatSharp.Experimental/DiscordApiClientHook.cs +++ b/DisCatSharp.Experimental/DiscordApiClientHook.cs @@ -39,10 +39,7 @@ internal DiscordApiClientHook(DiscordApiClient apiClient) internal async Task GetClydeProfileAsync(ulong profileId) { var route = $"{Endpoints.CLYDE_PROFILES}/:profile_id"; - var bucket = this.ApiClient.Rest.GetBucket(RestRequestMethod.GET, route, new - { - profile_id = profileId - }, out var path); + var bucket = this.ApiClient.Rest.GetBucket(RestRequestMethod.GET, route, new { profile_id = profileId }, out var path); var url = Utilities.GetApiUriFor(path, this.ApiClient.Discord.Configuration); var res = await this.ApiClient.DoRequestAsync(this.ApiClient.Discord, bucket, url, RestRequestMethod.GET, route).ConfigureAwait(false); @@ -59,10 +56,7 @@ internal async Task GetClydeProfileAsync(ulong profileId) internal async Task GetClydeSettingsAsync(ulong guildId) { var route = $"{Endpoints.GUILDS}/:guild_id{Endpoints.CLYDE_SETTINGS}"; - var bucket = this.ApiClient.Rest.GetBucket(RestRequestMethod.GET, route, new - { - guild_id = guildId - }, out var path); + var bucket = this.ApiClient.Rest.GetBucket(RestRequestMethod.GET, route, new { guild_id = guildId }, out var path); var url = Utilities.GetApiUriFor(path, this.ApiClient.Discord.Configuration); var res = await this.ApiClient.DoRequestAsync(this.ApiClient.Discord, bucket, url, RestRequestMethod.GET, route).ConfigureAwait(false); @@ -79,16 +73,10 @@ internal async Task GetClydeSettingsAsync(ulong guildId) [DiscordDeprecated] internal async Task ModifyClydeSettingsAsync(ulong guildId, ulong profileId) { - ClydeSettingsProfileIdOnlyUpdatePayload pld = new() - { - ClydeProfileId = profileId - }; + ClydeSettingsProfileIdOnlyUpdatePayload pld = new() { ClydeProfileId = profileId }; var route = $"{Endpoints.GUILDS}/:guild_id{Endpoints.CLYDE_SETTINGS}"; - var bucket = this.ApiClient.Rest.GetBucket(RestRequestMethod.PATCH, route, new - { - guild_id = guildId - }, out var path); + var bucket = this.ApiClient.Rest.GetBucket(RestRequestMethod.PATCH, route, new { guild_id = guildId }, out var path); var url = Utilities.GetApiUriFor(path, this.ApiClient.Discord.Configuration); var res = await this.ApiClient.DoRequestAsync(this.ApiClient.Discord, bucket, url, RestRequestMethod.PATCH, route, payload: DiscordJson.SerializeObject(pld)).ConfigureAwait(false); @@ -128,10 +116,7 @@ internal async Task ModifyClydeSettingsAsync( }; var route = $"{Endpoints.GUILDS}/:guild_id{Endpoints.CLYDE_SETTINGS}"; - var bucket = this.ApiClient.Rest.GetBucket(RestRequestMethod.PATCH, route, new - { - guild_id = guildId - }, out var path); + var bucket = this.ApiClient.Rest.GetBucket(RestRequestMethod.PATCH, route, new { guild_id = guildId }, out var path); var url = Utilities.GetApiUriFor(path, this.ApiClient.Discord.Configuration); var res = await this.ApiClient.DoRequestAsync(this.ApiClient.Discord, bucket, url, RestRequestMethod.PATCH, route, payload: DiscordJson.SerializeObject(pld)).ConfigureAwait(false); @@ -149,14 +134,10 @@ internal async Task ModifyClydeSettingsAsync( [DiscordDeprecated] internal async Task GenerateClydePersonalityAsync(string? basePersonality = null) { - PersonalityGenerationPayload pld = new() - { - Personality = basePersonality ?? string.Empty - }; + PersonalityGenerationPayload pld = new() { Personality = basePersonality ?? string.Empty }; var route = $"{Endpoints.CLYDE_PROFILES}{Endpoints.GENERATE_PERSONALITY}"; - var bucket = this.ApiClient.Rest.GetBucket(RestRequestMethod.POST, route, new - { }, out var path); + var bucket = this.ApiClient.Rest.GetBucket(RestRequestMethod.POST, route, new { }, out var path); var url = Utilities.GetApiUriFor(path, this.ApiClient.Discord.Configuration); var res = await this.ApiClient.DoRequestAsync(this.ApiClient.Discord, bucket, url, RestRequestMethod.POST, route, payload: DiscordJson.SerializeObject(pld)).ConfigureAwait(false); diff --git a/DisCatSharp.Experimental/Entities/Clyde/ClydeProfile.cs b/DisCatSharp.Experimental/Entities/Clyde/ClydeProfile.cs index 9aa87388c..bc10262b8 100644 --- a/DisCatSharp.Experimental/Entities/Clyde/ClydeProfile.cs +++ b/DisCatSharp.Experimental/Entities/Clyde/ClydeProfile.cs @@ -61,7 +61,9 @@ public sealed class ClydeProfile : ObservableApiObject /// [JsonIgnore] public IReadOnlyList? ThemeColors - => !(this.ThemeColorsInternal is not null && this.ThemeColorsInternal.Count != 0) ? null : this.ThemeColorsInternal.Select(x => new DiscordColor(x)).ToList(); + => !(this.ThemeColorsInternal is not null && this.ThemeColorsInternal.Count != 0) + ? null + : this.ThemeColorsInternal.Select(x => new DiscordColor(x)).ToList(); /// /// Gets clyde's profile id. diff --git a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer.Package/DisCatSharp.Analyzer.Package.csproj b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer.Package/DisCatSharp.Analyzer.Package.csproj index 5d5949ec6..933649bff 100644 --- a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer.Package/DisCatSharp.Analyzer.Package.csproj +++ b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer.Package/DisCatSharp.Analyzer.Package.csproj @@ -9,8 +9,8 @@ DisCatSharp.Analyzer.Roselyn - 6.2.0 - 6.2.0 + 6.2.1 + 6.2.1 AITSYS false DisCatSharp Analyzer @@ -60,11 +60,11 @@ 7 - embedded + portable 7 - embedded + portable diff --git a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AnalyzerReleases.Shipped.md b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AnalyzerReleases.Shipped.md index 73d585f4e..9c225af8b 100644 --- a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AnalyzerReleases.Shipped.md +++ b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AnalyzerReleases.Shipped.md @@ -92,3 +92,10 @@ DCS0200 | Usage | Info | DCS0200_Requires_Feature_Attribute_Analyzer, [Do Rule ID | Category | Severity | Notes --------|----------|----------|-------------------- DCS0200 | Usage | Info | DCS0200_Requires_Feature_Attribute_Analyzer, [Documentation](https://docs.dcs.aitsys.dev/vs/analyzer/dcs/0200) + +## Release 6.2.1 + +### Changed Rules + +Rule ID | Category | Severity | Notes +--------|----------|----------|-------------------- diff --git a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AttributeAnalyzer.cs b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AttributeAnalyzer.cs index b1591e04f..d28055bb6 100644 --- a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AttributeAnalyzer.cs +++ b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AttributeAnalyzer.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; +using System.Diagnostics; using System.Linq; using System.Reflection; @@ -19,35 +20,74 @@ public class AttributeAnalyzer : DiagnosticAnalyzer public const string CATEGORY = "Usage"; private static readonly LocalizableString s_titleExperimental = new LocalizableResourceString(nameof(Resources.AnalyzerTitleExperimental), Resources.ResourceManager, typeof(Resources)); - private static readonly LocalizableString s_messageFormatExperimental = new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatExperimental), Resources.ResourceManager, typeof(Resources)); - private static readonly LocalizableString s_descriptionExperimental = new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionExperimental), Resources.ResourceManager, typeof(Resources)); + + private static readonly LocalizableString s_messageFormatExperimental = + new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatExperimental), Resources.ResourceManager, typeof(Resources)); + + private static readonly LocalizableString s_descriptionExperimental = + new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionExperimental), Resources.ResourceManager, typeof(Resources)); private static readonly LocalizableString s_titleDeprecated = new LocalizableResourceString(nameof(Resources.AnalyzerTitleDeprecated), Resources.ResourceManager, typeof(Resources)); - private static readonly LocalizableString s_messageFormatDeprecated = new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatDeprecated), Resources.ResourceManager, typeof(Resources)); - private static readonly LocalizableString s_descriptionDeprecated = new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionDeprecated), Resources.ResourceManager, typeof(Resources)); - private static readonly LocalizableString s_titleDiscordInExperiment = new LocalizableResourceString(nameof(Resources.AnalyzerTitleDiscordInExperiment), Resources.ResourceManager, typeof(Resources)); - private static readonly LocalizableString s_messageFormatDiscordInExperiment = new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatDiscordInExperiment), Resources.ResourceManager, typeof(Resources)); - private static readonly LocalizableString s_descriptionDiscordInExperiment = new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionDiscordInExperiment), Resources.ResourceManager, typeof(Resources)); + private static readonly LocalizableString s_messageFormatDeprecated = + new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatDeprecated), Resources.ResourceManager, typeof(Resources)); + + private static readonly LocalizableString s_descriptionDeprecated = + new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionDeprecated), Resources.ResourceManager, typeof(Resources)); + + private static readonly LocalizableString s_titleDiscordInExperiment = + new LocalizableResourceString(nameof(Resources.AnalyzerTitleDiscordInExperiment), Resources.ResourceManager, typeof(Resources)); + + private static readonly LocalizableString s_messageFormatDiscordInExperiment = + new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatDiscordInExperiment), Resources.ResourceManager, typeof(Resources)); + + private static readonly LocalizableString s_descriptionDiscordInExperiment = + new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionDiscordInExperiment), Resources.ResourceManager, typeof(Resources)); + + private static readonly LocalizableString s_titleDiscordDeprecated = + new LocalizableResourceString(nameof(Resources.AnalyzerTitleDiscordDeprecated), Resources.ResourceManager, typeof(Resources)); + + private static readonly LocalizableString s_messageFormatDiscordDeprecated = + new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatDiscordDeprecated), Resources.ResourceManager, typeof(Resources)); + + private static readonly LocalizableString s_descriptionDiscordDeprecated = + new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionDiscordDeprecated), Resources.ResourceManager, typeof(Resources)); + + private static readonly LocalizableString s_titleDiscordUnreleased = + new LocalizableResourceString(nameof(Resources.AnalyzerTitleDiscordUnreleased), Resources.ResourceManager, typeof(Resources)); + + private static readonly LocalizableString s_messageFormatDiscordUnreleased = + new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatDiscordUnreleased), Resources.ResourceManager, typeof(Resources)); + + private static readonly LocalizableString s_descriptionDiscordUnreleased = + new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionDiscordUnreleased), Resources.ResourceManager, typeof(Resources)); + + private static readonly LocalizableString s_titleRequiresFeature = + new LocalizableResourceString(nameof(Resources.AnalyzerTitleRequiresFeature), Resources.ResourceManager, typeof(Resources)); + + private static readonly LocalizableString s_messageFormatRequiresFeature = + new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatRequiresFeature), Resources.ResourceManager, typeof(Resources)); + + private static readonly LocalizableString s_descriptionRequiresFeature = + new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionRequiresFeature), Resources.ResourceManager, typeof(Resources)); + + private static readonly DiagnosticDescriptor s_experimentalRule = new DiagnosticDescriptor(DIAGNOSTIC_ID_PREFIX + "0001", s_titleExperimental, s_messageFormatExperimental, CATEGORY, + DiagnosticSeverity.Warning, true, s_descriptionExperimental, "https://docs.dcs.aitsys.dev/vs/analyzer/dcs/0001"); + + private static readonly DiagnosticDescriptor s_deprecatedRule = new DiagnosticDescriptor(DIAGNOSTIC_ID_PREFIX + "0002", s_titleDeprecated, s_messageFormatDeprecated, CATEGORY, + DiagnosticSeverity.Warning, true, s_descriptionDeprecated, "https://docs.dcs.aitsys.dev/vs/analyzer/dcs/0002"); - private static readonly LocalizableString s_titleDiscordDeprecated = new LocalizableResourceString(nameof(Resources.AnalyzerTitleDiscordDeprecated), Resources.ResourceManager, typeof(Resources)); - private static readonly LocalizableString s_messageFormatDiscordDeprecated = new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatDiscordDeprecated), Resources.ResourceManager, typeof(Resources)); - private static readonly LocalizableString s_descriptionDiscordDeprecated = new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionDiscordDeprecated), Resources.ResourceManager, typeof(Resources)); + private static readonly DiagnosticDescriptor s_discordInExperimentRule = new DiagnosticDescriptor(DIAGNOSTIC_ID_PREFIX + "0101", s_titleDiscordInExperiment, + s_messageFormatDiscordInExperiment, CATEGORY, DiagnosticSeverity.Warning, true, s_descriptionDiscordInExperiment, "https://docs.dcs.aitsys.dev/vs/analyzer/dcs/0101"); - private static readonly LocalizableString s_titleDiscordUnreleased = new LocalizableResourceString(nameof(Resources.AnalyzerTitleDiscordUnreleased), Resources.ResourceManager, typeof(Resources)); - private static readonly LocalizableString s_messageFormatDiscordUnreleased = new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatDiscordUnreleased), Resources.ResourceManager, typeof(Resources)); - private static readonly LocalizableString s_descriptionDiscordUnreleased = new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionDiscordUnreleased), Resources.ResourceManager, typeof(Resources)); + private static readonly DiagnosticDescriptor s_discordDeprecatedRule = new DiagnosticDescriptor(DIAGNOSTIC_ID_PREFIX + "0102", s_titleDiscordDeprecated, s_messageFormatDiscordDeprecated, + CATEGORY, DiagnosticSeverity.Warning, true, s_descriptionDiscordDeprecated, "https://docs.dcs.aitsys.dev/vs/analyzer/dcs/0102"); - private static readonly LocalizableString s_titleRequiresFeature = new LocalizableResourceString(nameof(Resources.AnalyzerTitleRequiresFeature), Resources.ResourceManager, typeof(Resources)); - private static readonly LocalizableString s_messageFormatRequiresFeature = new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatRequiresFeature), Resources.ResourceManager, typeof(Resources)); - private static readonly LocalizableString s_descriptionRequiresFeature = new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionRequiresFeature), Resources.ResourceManager, typeof(Resources)); + private static readonly DiagnosticDescriptor s_discordUnreleasedRule = new DiagnosticDescriptor(DIAGNOSTIC_ID_PREFIX + "0103", s_titleDiscordUnreleased, s_messageFormatDiscordUnreleased, + CATEGORY, DiagnosticSeverity.Warning, true, s_descriptionDiscordUnreleased, "https://docs.dcs.aitsys.dev/vs/analyzer/dcs/0103"); - private static readonly DiagnosticDescriptor s_experimentalRule = new DiagnosticDescriptor(DIAGNOSTIC_ID_PREFIX + "0001", s_titleExperimental, s_messageFormatExperimental, CATEGORY, DiagnosticSeverity.Warning, true, s_descriptionExperimental, "https://docs.dcs.aitsys.dev/vs/analyzer/dcs/0001"); - private static readonly DiagnosticDescriptor s_deprecatedRule = new DiagnosticDescriptor(DIAGNOSTIC_ID_PREFIX + "0002", s_titleDeprecated, s_messageFormatDeprecated, CATEGORY, DiagnosticSeverity.Warning, true, s_descriptionDeprecated, "https://docs.dcs.aitsys.dev/vs/analyzer/dcs/0002"); - private static readonly DiagnosticDescriptor s_discordInExperimentRule = new DiagnosticDescriptor(DIAGNOSTIC_ID_PREFIX + "0101", s_titleDiscordInExperiment, s_messageFormatDiscordInExperiment, CATEGORY, DiagnosticSeverity.Warning, true, s_descriptionDiscordInExperiment, "https://docs.dcs.aitsys.dev/vs/analyzer/dcs/0101"); - private static readonly DiagnosticDescriptor s_discordDeprecatedRule = new DiagnosticDescriptor(DIAGNOSTIC_ID_PREFIX + "0102", s_titleDiscordDeprecated, s_messageFormatDiscordDeprecated, CATEGORY, DiagnosticSeverity.Warning, true, s_descriptionDiscordDeprecated, "https://docs.dcs.aitsys.dev/vs/analyzer/dcs/0102"); - private static readonly DiagnosticDescriptor s_discordUnreleasedRule = new DiagnosticDescriptor(DIAGNOSTIC_ID_PREFIX + "0103", s_titleDiscordUnreleased, s_messageFormatDiscordUnreleased, CATEGORY, DiagnosticSeverity.Warning, true, s_descriptionDiscordUnreleased, "https://docs.dcs.aitsys.dev/vs/analyzer/dcs/0103"); - private static readonly DiagnosticDescriptor s_requiresFeatureRule = new DiagnosticDescriptor(DIAGNOSTIC_ID_PREFIX + "0200", s_titleRequiresFeature, s_messageFormatRequiresFeature, CATEGORY, DiagnosticSeverity.Warning, true, s_descriptionRequiresFeature, "https://docs.dcs.aitsys.dev/vs/analyzer/dcs/0200"); + private static readonly DiagnosticDescriptor s_requiresFeatureRule = new DiagnosticDescriptor(DIAGNOSTIC_ID_PREFIX + "0200", s_titleRequiresFeature, s_messageFormatRequiresFeature, + CATEGORY, DiagnosticSeverity.Warning, true, s_descriptionRequiresFeature, "https://docs.dcs.aitsys.dev/vs/analyzer/dcs/0200"); public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(s_experimentalRule, s_deprecatedRule, s_discordInExperimentRule, s_discordDeprecatedRule, s_discordUnreleasedRule, s_requiresFeatureRule); @@ -220,7 +260,9 @@ private static bool IsRequiredAttribute(SemanticModel semanticModel, AttributeDa } private static string GetMessage(AttributeData attribute) - => attribute.ConstructorArguments.Length < 1 ? "Do not use in production." : attribute.ConstructorArguments[0].Value as string; + => attribute.ConstructorArguments.Length < 1 + ? "Do not use in production." + : attribute.ConstructorArguments[0].Value as string; private static string GetFeatureMessage(AttributeData attribute) { diff --git a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/DisCatSharp.Analyzer.csproj b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/DisCatSharp.Analyzer.csproj index 9efa9c038..72a11753e 100644 --- a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/DisCatSharp.Analyzer.csproj +++ b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/DisCatSharp.Analyzer.csproj @@ -18,8 +18,10 @@ true true true - True - True + False + False + False + False @@ -38,7 +40,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/GlobalSuppressions.cs b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/GlobalSuppressions.cs index 1639bbb93..dca878d8c 100644 --- a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/GlobalSuppressions.cs +++ b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/GlobalSuppressions.cs @@ -5,4 +5,6 @@ using System.Diagnostics.CodeAnalysis; -[assembly: SuppressMessage("MicrosoftCodeAnalysisCorrectness", "RS1030:Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer", Justification = "", Scope = "member", Target = "~M:DisCatSharp.Analyzer.AttributeAnalyzer.ExperimentalAnalyzer(Microsoft.CodeAnalysis.Diagnostics.SymbolAnalysisContext)")] +[assembly: + SuppressMessage("MicrosoftCodeAnalysisCorrectness", "RS1030:Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer", Justification = "", Scope = "member", + Target = "~M:DisCatSharp.Analyzer.AttributeAnalyzer.ExperimentalAnalyzer(Microsoft.CodeAnalysis.Diagnostics.SymbolAnalysisContext)")] diff --git a/DisCatSharp.Tools/DisCatSharp.Tools.sln b/DisCatSharp.Tools/DisCatSharp.Tools.sln index 6fd2c748b..6141183cc 100644 --- a/DisCatSharp.Tools/DisCatSharp.Tools.sln +++ b/DisCatSharp.Tools/DisCatSharp.Tools.sln @@ -9,13 +9,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DisCatSharp.Analyzer.Packag EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DisCatSharp.Attributes", "..\DisCatSharp.Attributes\DisCatSharp.Attributes.csproj", "{6EB1F99C-22FC-44D8-A1B6-539393C34810}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DisCatSharp.Experimental", ..\"DisCatSharp.Experimental\DisCatSharp.Experimental.csproj", "{BD09D64B-7725-4357-8FCA-56B93FB607AD}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6CBDA593-E86C-44F3-9F22-BB5F32D7D48E}" ProjectSection(SolutionItems) = preProject DisCatSharp.ruleset = DisCatSharp.ruleset EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DisCatSharp.Experimental", "..\DisCatSharp.Experimental\DisCatSharp.Experimental.csproj", "{58B4D657-A00E-4C47-B4D6-1EE881E5E387}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -34,10 +34,10 @@ Global {6EB1F99C-22FC-44D8-A1B6-539393C34810}.Debug|Any CPU.Build.0 = Debug|Any CPU {6EB1F99C-22FC-44D8-A1B6-539393C34810}.Release|Any CPU.ActiveCfg = Release|Any CPU {6EB1F99C-22FC-44D8-A1B6-539393C34810}.Release|Any CPU.Build.0 = Release|Any CPU - {BD09D64B-7725-4357-8FCA-56B93FB607AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BD09D64B-7725-4357-8FCA-56B93FB607AD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BD09D64B-7725-4357-8FCA-56B93FB607AD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BD09D64B-7725-4357-8FCA-56B93FB607AD}.Release|Any CPU.Build.0 = Release|Any CPU + {58B4D657-A00E-4C47-B4D6-1EE881E5E387}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {58B4D657-A00E-4C47-B4D6-1EE881E5E387}.Debug|Any CPU.Build.0 = Debug|Any CPU + {58B4D657-A00E-4C47-B4D6-1EE881E5E387}.Release|Any CPU.ActiveCfg = Release|Any CPU + {58B4D657-A00E-4C47-B4D6-1EE881E5E387}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE