diff --git a/Dalamud/Plugin/Internal/PluginValidator.cs b/Dalamud/Plugin/Internal/PluginValidator.cs index a1b08e327..21144ca11 100644 --- a/Dalamud/Plugin/Internal/PluginValidator.cs +++ b/Dalamud/Plugin/Internal/PluginValidator.cs @@ -11,6 +11,8 @@ namespace Dalamud.Plugin.Internal; /// internal static class PluginValidator { + private static readonly char[] LineSeparator = new[] { ' ', '\n', '\r' }; + /// /// Represents the severity of a validation problem. /// @@ -48,7 +50,7 @@ internal static class PluginValidator /// Localized string to be shown to the developer. public string GetLocalizedDescription(); } - + /// /// Check for problems in a plugin. /// @@ -75,6 +77,12 @@ internal static class PluginValidator problems.Add(new CommandWithoutHelpTextProblem(cmd.Key)); } + 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) + problems.Add(new NoDescriptionProblem()); + return problems; } @@ -114,4 +122,28 @@ internal static class PluginValidator /// public string GetLocalizedDescription() => $"The plugin has a command ({commandName}) without a help message. Please consider adding a help message to the command when registering it."; } + + /// + /// Representing a problem where a plugin does not have any tags in its manifest. + /// + public class NoTagsProblem : IValidationProblem + { + /// + public ValidationSeverity Severity => ValidationSeverity.Information; + + /// + public string GetLocalizedDescription() => "Your plugin does not have any tags in its manifest. Please consider adding some to make it easier for users to find your plugin in the installer."; + } + + /// + /// Representing a problem where a plugin does not have a description in its manifest. + /// + public class NoDescriptionProblem : IValidationProblem + { + /// + public ValidationSeverity Severity => ValidationSeverity.Information; + + /// + 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."; + } }