From 0dbc76f96f513c2b32094bb700cee22f311e89f3 Mon Sep 17 00:00:00 2001 From: goaaats Date: Thu, 28 Mar 2024 00:14:51 +0100 Subject: [PATCH] pi: some more manifest validation --- Dalamud/Plugin/Internal/PluginValidator.cs | 47 +++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/Dalamud/Plugin/Internal/PluginValidator.cs b/Dalamud/Plugin/Internal/PluginValidator.cs index 21144ca11..134bb2a4c 100644 --- a/Dalamud/Plugin/Internal/PluginValidator.cs +++ b/Dalamud/Plugin/Internal/PluginValidator.cs @@ -80,9 +80,18 @@ internal static class PluginValidator if (plugin.Manifest.Tags == null || plugin.Manifest.Tags.Count == 0) problems.Add(new NoTagsProblem()); - if (string.IsNullOrEmpty(plugin.Manifest.Description) || plugin.Manifest.Description.Split(LineSeparator, StringSplitOptions.RemoveEmptyEntries).Length <= 2) + if (string.IsNullOrEmpty(plugin.Manifest.Description) || plugin.Manifest.Description.Split(LineSeparator, StringSplitOptions.RemoveEmptyEntries).Length <= 1) problems.Add(new NoDescriptionProblem()); + if (string.IsNullOrEmpty(plugin.Manifest.Punchline)) + problems.Add(new NoPunchlineProblem()); + + if (string.IsNullOrEmpty(plugin.Manifest.Name)) + problems.Add(new NoNameProblem()); + + if (string.IsNullOrEmpty(plugin.Manifest.Author)) + problems.Add(new NoAuthorProblem()); + return problems; } @@ -146,4 +155,40 @@ internal static class PluginValidator /// public string GetLocalizedDescription() => "Your plugin does not have a description in its manifest, or it is very terse. Please consider adding one to give users more information about your plugin."; } + + /// + /// Representing a problem where a plugin has no punchline in its manifest. + /// + public class NoPunchlineProblem : IValidationProblem + { + /// + public ValidationSeverity Severity => ValidationSeverity.Information; + + /// + public string GetLocalizedDescription() => "Your plugin does not have a punchline in its manifest. Please consider adding one to give users a quick overview of what your plugin does."; + } + + /// + /// Representing a problem where a plugin has no name in its manifest. + /// + public class NoNameProblem : IValidationProblem + { + /// + public ValidationSeverity Severity => ValidationSeverity.Fatal; + + /// + public string GetLocalizedDescription() => "Your plugin does not have a name in its manifest."; + } + + /// + /// Representing a problem where a plugin has no author in its manifest. + /// + public class NoAuthorProblem : IValidationProblem + { + /// + public ValidationSeverity Severity => ValidationSeverity.Fatal; + + /// + public string GetLocalizedDescription() => "Your plugin does not have an author in its manifest."; + } }