Add deletable-table-tag linter category

Change-Id: I48000170a74363872edbce8f78780bccf160600c
This commit is contained in:
Subramanya Sastry 2017-04-06 12:41:18 -05:00
parent 1944b6f4fb
commit 619ddc8677
5 changed files with 13 additions and 0 deletions

View file

@ -80,6 +80,10 @@
"self-closed-tag": { "self-closed-tag": {
"severity": "warning", "severity": "warning",
"enabled": true "enabled": true
},
"deletable-table-tag": {
"severity": "error",
"enabled": true
} }
}, },
"LinterSubmitterWhitelist": { "LinterSubmitterWhitelist": {

View file

@ -14,6 +14,7 @@
"linter-pager-missing-end-tag-details": "Missing end tag", "linter-pager-missing-end-tag-details": "Missing end tag",
"linter-pager-stripped-tag-details": "Stripped tag", "linter-pager-stripped-tag-details": "Stripped tag",
"linter-pager-self-closed-tag-details": "Self-closed 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": "Fostered content",
"linter-category-fostered-desc": "These pages have fostered content.", "linter-category-fostered-desc": "These pages have fostered content.",
"linter-category-obsolete-tag": "Obsolete HTML tags", "linter-category-obsolete-tag": "Obsolete HTML tags",
@ -26,6 +27,8 @@
"linter-category-stripped-tag-desc": "These pages have stripped tags.", "linter-category-stripped-tag-desc": "These pages have stripped tags.",
"linter-category-self-closed-tag": "Self-closed tags", "linter-category-self-closed-tag": "Self-closed tags",
"linter-category-self-closed-tag-desc": "These pages have 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}})", "linter-numerrors": "($1 {{PLURAL:$1|error|errors}})",
"linker-page-title-edit": "$1 ($2)", "linker-page-title-edit": "$1 ($2)",
"linker-page-edit": "edit", "linker-page-edit": "edit",

View file

@ -16,6 +16,7 @@
"linter-pager-missing-end-tag-details": "Table column heading", "linter-pager-missing-end-tag-details": "Table column heading",
"linter-pager-stripped-tag-details": "Table column heading", "linter-pager-stripped-tag-details": "Table column heading",
"linter-pager-self-closed-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": "Name of lint error category. See [[:mw:Help:Extension:Linter/fostered]]",
"linter-category-fostered-desc": "Description of category.", "linter-category-fostered-desc": "Description of category.",
"linter-category-obsolete-tag": "Name of lint error category. See [[:mw:Help:Extension:Linter/obsolete-tag]]", "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-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": "Name of lint error category. See [[:mw:Help:Extension:Linter/self-closed-tag]]",
"linter-category-self-closed-tag-desc": "Description of category", "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}}", "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-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}}", "linker-page-edit": "Link text for edit link in {{msg-mw|linker-page-title-edit}}\n{{Identical|Edit}}",

View file

@ -41,6 +41,7 @@ class CategoryManager {
'missing-end-tag' => 4, 'missing-end-tag' => 4,
'stripped-tag' => 5, 'stripped-tag' => 5,
'self-closed-tag' => 6, 'self-closed-tag' => 6,
'deletable-table-tag' => 7,
]; ];
/** /**

View file

@ -108,6 +108,8 @@ class LintErrorsPager extends TablePager {
->rawParams( $viewLink, $editHistLinks ) ->rawParams( $viewLink, $editHistLinks )
->escaped(); ->escaped();
case 'details': 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' ]; $hasNameCats = [ 'obsolete-tag', 'missing-end-tag', 'self-closed-tag' ];
if ( in_array( $this->category, $hasNameCats ) && isset( $lintError->params['name'] ) ) { if ( in_array( $this->category, $hasNameCats ) && isset( $lintError->params['name'] ) ) {
return Html::element( 'code', [], $lintError->params['name'] ); return Html::element( 'code', [], $lintError->params['name'] );