diff --git a/src/as-validator-issue-tag.h b/src/as-validator-issue-tag.h index 06517efa..1992b0ce 100644 --- a/src/as-validator-issue-tag.h +++ b/src/as-validator-issue-tag.h @@ -590,17 +590,17 @@ AsValidatorIssueTag as_validator_issue_tag_list[] = { "`developer` block instead."), }, - { "developer-name-has-url", - AS_ISSUE_SEVERITY_WARNING, + { "developer-info-missing", + AS_ISSUE_SEVERITY_INFO, /* TRANSLATORS: Please do not translate AppStream tag and property names (in backticks). */ - N_("The `name` child of a `developer` block must not contain a hyperlink."), + N_("This component contains no `developer` element with information about its author."), }, { "developer-id-missing", - AS_ISSUE_SEVERITY_INFO, + AS_ISSUE_SEVERITY_WARNING, /* TRANSLATORS: Please do not translate AppStream tag and property names (in backticks). */ N_("The `developer` element is missing an `id` property, containing a unique string ID for the developer. " - "Consider adding a unique ID."), + "Consider adding a unique ID."), }, { "developer-id-invalid", @@ -609,6 +609,18 @@ AsValidatorIssueTag as_validator_issue_tag_list[] = { "It must also only contain lowercase ASCII letters, numbers and punctuation."), }, + { "developer-name-missing", + AS_ISSUE_SEVERITY_WARNING, + /* TRANSLATORS: Please do not translate AppStream tag and property names (in backticks). */ + N_("The `developer` block does not have a `name` element with a human-readable project author name."), + }, + + { "developer-name-has-url", + AS_ISSUE_SEVERITY_WARNING, + /* TRANSLATORS: Please do not translate AppStream tag and property names (in backticks). */ + N_("The `name` child of a `developer` block must not contain a hyperlink."), + }, + { "unknown-desktop-id", AS_ISSUE_SEVERITY_ERROR, N_("The set value is not an identifier for a desktop environment as registered with Freedesktop.org."), diff --git a/src/as-validator.c b/src/as-validator.c index 1736a0cb..6ec1652e 100644 --- a/src/as-validator.c +++ b/src/as-validator.c @@ -645,8 +645,12 @@ as_validator_add_override (AsValidator *validator, "tag-empty", /* allow GNOME to validate metadata using its new versioning scheme (until a better solution is found) */ "releases-not-in-order", + /* very rarely (e.g. for apps like Wine) not having a launchable is actually okay */ + "desktop-app-launchable-missing", /* allowed for a while, as part of the deprecation phase */ "developer-name-tag-deprecated", + /* temporarily allowed to ease transition a bit */ + "developer-id-missing", NULL }; @@ -1489,6 +1493,7 @@ static void as_validator_check_developer (AsValidator *validator, xmlNode *node) { g_autofree gchar *devid = NULL; + gboolean developer_name_found = FALSE; devid = as_xml_get_prop_value (node, "id"); if (devid == NULL) { @@ -1522,6 +1527,8 @@ as_validator_check_developer (AsValidator *validator, xmlNode *node) if (as_str_equal0 (iter->name, "name")) { g_autofree gchar *content = as_xml_get_node_value (iter); + + developer_name_found = TRUE; if (as_validate_has_hyperlink (content)) as_validator_add_issue (validator, iter, @@ -1529,6 +1536,14 @@ as_validator_check_developer (AsValidator *validator, xmlNode *node) NULL); } } + + if (!developer_name_found) { + as_validator_add_issue (validator, + node, + "developer-name-missing", + NULL); + + } } /** @@ -3536,6 +3551,11 @@ as_validator_validate_component_node (AsValidator *validator, AsContext *ctx, xm } } + /* check if we had a developer tag */ + if (!g_hash_table_contains (found_tags, "developer")) { + as_validator_add_issue (validator, NULL, "developer-info-missing", NULL); + } + as_validator_clear_current_cpt (validator); return cpt; }