diff --git a/src/as-validator-issue-tag.h b/src/as-validator-issue-tag.h index 5714dd9c..cf27bb3f 100644 --- a/src/as-validator-issue-tag.h +++ b/src/as-validator-issue-tag.h @@ -465,6 +465,11 @@ AsValidatorIssueTag as_validator_issue_tag_list[] = { N_("The component is missing a name ( tag).") }, + { "component-name-too-long", + AS_ISSUE_SEVERITY_WARNING, + N_("The name of this component is excessively long and can likely not be displayed properly in most layouts.") + }, + { "component-summary-missing", AS_ISSUE_SEVERITY_ERROR, N_("The component is missing a summary ( tag).") @@ -505,6 +510,11 @@ AsValidatorIssueTag as_validator_issue_tag_list[] = { N_("The summary text does not start with a capitalized word, project name or number.") }, + { "summary-too-long", + AS_ISSUE_SEVERITY_WARNING, + N_("The summary text is very long, and will likely not be displayed properly everywhere.") + }, + { "icon-stock-cached-has-url", AS_ISSUE_SEVERITY_ERROR, /* TRANSLATORS: Please do not translate AppStream tag and property names (in backticks). */ @@ -755,7 +765,7 @@ AsValidatorIssueTag as_validator_issue_tag_list[] = { }, { "screenshot-caption-too-long", - AS_ISSUE_SEVERITY_PEDANTIC, + AS_ISSUE_SEVERITY_INFO, N_("The screenshot caption is too long (should be <= 100 characters)"), }, diff --git a/src/as-validator.c b/src/as-validator.c index 3424a6e4..a40b9254 100644 --- a/src/as-validator.c +++ b/src/as-validator.c @@ -2921,6 +2921,8 @@ as_validator_validate_component_node (AsValidator *validator, AsContext *ctx, xm } else if (g_strcmp0 (node_name, "source_pkgname") == 0) { as_validator_check_appear_once (validator, iter, found_tags, FALSE); } else if (g_strcmp0 (node_name, "name") == 0) { + g_autofree gchar *lang = as_xml_get_prop_value (iter, "lang"); + as_validator_check_appear_once (validator, iter, found_tags, TRUE); if (g_str_has_suffix (node_content, ".")) as_validator_add_issue (validator, @@ -2928,6 +2930,13 @@ as_validator_validate_component_node (AsValidator *validator, AsContext *ctx, xm "name-has-dot-suffix", node_content); + if (lang == NULL && strlen (node_content) > 40) { + as_validator_add_issue (validator, + iter, + "component-name-too-long", + node_content); + } + } else if (g_strcmp0 (node_name, "summary") == 0) { g_autofree gchar *lang = NULL; const gchar *summary = node_content; @@ -2962,6 +2971,13 @@ as_validator_validate_component_node (AsValidator *validator, AsContext *ctx, xm "summary-first-word-not-capitalized", NULL); + if (lang == NULL && strlen (summary) > 90) { + as_validator_add_issue (validator, + iter, + "summary-too-long", + summary); + } + } else if (g_strcmp0 (node_name, "description") == 0) { as_validator_check_appear_once (validator, iter, found_tags, TRUE); as_validator_check_description_tag (validator, iter, mode, TRUE);