From 0416e501c3cd96007489c547b724d457c5883833 Mon Sep 17 00:00:00 2001 From: SquirrelKiev Date: Fri, 7 Jun 2024 00:08:48 +0100 Subject: [PATCH] docker please i want to sleep --- .../DibariBot.Analyzers.csproj | 14 ----- .../SlashCommandSummaryAnalyzer.cs | 61 ------------------- DibariBot.sln | 6 -- DibariBot/DibariBot.csproj | 4 -- 4 files changed, 85 deletions(-) delete mode 100644 DibariBot.Analyzers/DibariBot.Analyzers.csproj delete mode 100644 DibariBot.Analyzers/SlashCommandSummaryAnalyzer.cs diff --git a/DibariBot.Analyzers/DibariBot.Analyzers.csproj b/DibariBot.Analyzers/DibariBot.Analyzers.csproj deleted file mode 100644 index 820f3e9..0000000 --- a/DibariBot.Analyzers/DibariBot.Analyzers.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - netstandard2.0 - enable - latest - true - - - - - - - diff --git a/DibariBot.Analyzers/SlashCommandSummaryAnalyzer.cs b/DibariBot.Analyzers/SlashCommandSummaryAnalyzer.cs deleted file mode 100644 index 1d62b78..0000000 --- a/DibariBot.Analyzers/SlashCommandSummaryAnalyzer.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System.Collections.Immutable; -using System.Linq; -using Discord.Interactions; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.Diagnostics; - -namespace DibariBot.Analyzers; - -[DiagnosticAnalyzer(LanguageNames.CSharp)] -public class SlashCommandSummaryAnalyzer : DiagnosticAnalyzer -{ - private const string DiagnosticId = "DA0001"; - private const string Title = "Slash command parameter is missing a description"; - private const string MessageFormat = "Slash command parameter '{0}' is missing a description"; - private const string Description = "Slash command parameters should have a description."; - private const string Category = "Usage"; - -#pragma warning disable RS2008 // Enable analyzer release tracking - private static readonly DiagnosticDescriptor Rule = - new(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true, description: Description); -#pragma warning restore RS2008 // Enable analyzer release tracking - - public override ImmutableArray SupportedDiagnostics => [Rule]; - - public override void Initialize(AnalysisContext context) - { - context.EnableConcurrentExecution(); - context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics); - context.RegisterSyntaxNodeAction(AnalyzeMethod, SyntaxKind.MethodDeclaration); - } - - private static void AnalyzeMethod(SyntaxNodeAnalysisContext context) - { - var methodDeclaration = (MethodDeclarationSyntax)context.Node; - - var methodSymbol = context.SemanticModel.GetDeclaredSymbol(methodDeclaration)!; - var methodAttributes = methodSymbol.GetAttributes(); - if (!methodAttributes.Any(a => a.AttributeClass?.Name == nameof(SlashCommandAttribute))) - { - return; - } - - foreach (var parameter in methodDeclaration.ParameterList.Parameters) - { - var parameterSymbol = context.SemanticModel.GetDeclaredSymbol(parameter); - var summaryAttribute = parameterSymbol!.GetAttributes() - .FirstOrDefault(a => a.AttributeClass!.Name.ToString() == nameof(SummaryAttribute)); - - if (summaryAttribute is null) - { - var diagnostic = Diagnostic.Create(Rule, parameter.GetLocation(), parameter.Identifier.Text); - context.ReportDiagnostic(diagnostic); - continue; - } - - // should probably check if the attribute has a description set but this is probably fine - } - } -} \ No newline at end of file diff --git a/DibariBot.sln b/DibariBot.sln index 23dad3e..1cc205d 100644 --- a/DibariBot.sln +++ b/DibariBot.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 17.7.34018.315 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DibariBot", "DibariBot\DibariBot.csproj", "{F5686273-6D1A-4ACF-BB74-6B16FC4163B6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DibariBot.Analyzers", "DibariBot.Analyzers\DibariBot.Analyzers.csproj", "{86E4C583-5D07-4D2A-A47D-0A3C8C7A9D0A}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -17,10 +15,6 @@ Global {F5686273-6D1A-4ACF-BB74-6B16FC4163B6}.Debug|Any CPU.Build.0 = Debug|Any CPU {F5686273-6D1A-4ACF-BB74-6B16FC4163B6}.Release|Any CPU.ActiveCfg = Release|Any CPU {F5686273-6D1A-4ACF-BB74-6B16FC4163B6}.Release|Any CPU.Build.0 = Release|Any CPU - {86E4C583-5D07-4D2A-A47D-0A3C8C7A9D0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {86E4C583-5D07-4D2A-A47D-0A3C8C7A9D0A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {86E4C583-5D07-4D2A-A47D-0A3C8C7A9D0A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {86E4C583-5D07-4D2A-A47D-0A3C8C7A9D0A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/DibariBot/DibariBot.csproj b/DibariBot/DibariBot.csproj index 3288f78..3a2d0a2 100644 --- a/DibariBot/DibariBot.csproj +++ b/DibariBot/DibariBot.csproj @@ -26,10 +26,6 @@ - - - -