From 619ddc8677e498bb86596373ab7cd6718573fdef Mon Sep 17 00:00:00 2001 From: Subramanya Sastry Date: Thu, 6 Apr 2017 12:41:18 -0500 Subject: [PATCH] Add deletable-table-tag linter category Change-Id: I48000170a74363872edbce8f78780bccf160600c --- extension.json | 4 ++++ i18n/en.json | 3 +++ i18n/qqq.json | 3 +++ includes/CategoryManager.php | 1 + includes/LintErrorsPager.php | 2 ++ 5 files changed, 13 insertions(+) diff --git a/extension.json b/extension.json index 7d2c51b0..90f841b7 100644 --- a/extension.json +++ b/extension.json @@ -80,6 +80,10 @@ "self-closed-tag": { "severity": "warning", "enabled": true + }, + "deletable-table-tag": { + "severity": "error", + "enabled": true } }, "LinterSubmitterWhitelist": { diff --git a/i18n/en.json b/i18n/en.json index 7f1d800e..736c03b8 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -14,6 +14,7 @@ "linter-pager-missing-end-tag-details": "Missing end tag", "linter-pager-stripped-tag-details": "Stripped tag", "linter-pager-self-closed-tag-details": "Self-closed tag", + "linter-pager-deletable-table-tag-details": "Table tag that should be deleted", "linter-category-fostered": "Fostered content", "linter-category-fostered-desc": "These pages have fostered content.", "linter-category-obsolete-tag": "Obsolete HTML tags", @@ -26,6 +27,8 @@ "linter-category-stripped-tag-desc": "These pages have stripped tags.", "linter-category-self-closed-tag": "Self-closed tags", "linter-category-self-closed-tag-desc": "These pages have self-closed tags.", + "linter-category-deletable-table-tag": "Table tag that should be deleted", + "linter-category-deletable-table-tag-desc": "These pages have table tags that should be deleted.", "linter-numerrors": "($1 {{PLURAL:$1|error|errors}})", "linker-page-title-edit": "$1 ($2)", "linker-page-edit": "edit", diff --git a/i18n/qqq.json b/i18n/qqq.json index 0d89ebba..20764d19 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -16,6 +16,7 @@ "linter-pager-missing-end-tag-details": "Table column heading", "linter-pager-stripped-tag-details": "Table column heading", "linter-pager-self-closed-tag-details": "Table column heading", + "linter-pager-deletable-table-tag-details": "Table column heading", "linter-category-fostered": "Name of lint error category. See [[:mw:Help:Extension:Linter/fostered]]", "linter-category-fostered-desc": "Description of category.", "linter-category-obsolete-tag": "Name of lint error category. See [[:mw:Help:Extension:Linter/obsolete-tag]]", @@ -28,6 +29,8 @@ "linter-category-stripped-tag-desc": "Description of category", "linter-category-self-closed-tag": "Name of lint error category. See [[:mw:Help:Extension:Linter/self-closed-tag]]", "linter-category-self-closed-tag-desc": "Description of category", + "linter-category-deletable-table-tag": "Name of lint error category. See [[:mw:Help:Extension:Linter/deletable-table-tag]]", + "linter-category-deletable-table-tag-desc": "Description of category.", "linter-numerrors": "Shown after a category link to indicate how many errors are in that category. $1 is the number of errors, and can be used for PLURAL.\n{{Identical|Error}}", "linker-page-title-edit": "Used in a table cell. $1 is a link to the page, $2 is pipe separated links to the edit and history pages, the link text is {{msg-mw|linker-page-edit}} and {{msg-mw|linker-page-history}}", "linker-page-edit": "Link text for edit link in {{msg-mw|linker-page-title-edit}}\n{{Identical|Edit}}", diff --git a/includes/CategoryManager.php b/includes/CategoryManager.php index ac3107c2..a1d0d78d 100644 --- a/includes/CategoryManager.php +++ b/includes/CategoryManager.php @@ -41,6 +41,7 @@ class CategoryManager { 'missing-end-tag' => 4, 'stripped-tag' => 5, 'self-closed-tag' => 6, + 'deletable-table-tag' => 7, ]; /** diff --git a/includes/LintErrorsPager.php b/includes/LintErrorsPager.php index e65a8deb..4817ba8f 100644 --- a/includes/LintErrorsPager.php +++ b/includes/LintErrorsPager.php @@ -108,6 +108,8 @@ class LintErrorsPager extends TablePager { ->rawParams( $viewLink, $editHistLinks ) ->escaped(); case 'details': + // While deletable-table-tag has params set, it adds no new information + // and is not included here since the error category has the tag name. $hasNameCats = [ 'obsolete-tag', 'missing-end-tag', 'self-closed-tag' ]; if ( in_array( $this->category, $hasNameCats ) && isset( $lintError->params['name'] ) ) { return Html::element( 'code', [], $lintError->params['name'] );