mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Linter
synced 2024-11-23 23:44:17 +00:00
Move $hasNameCats into the information in extension.json
Change-Id: Id4f01a2929ce43ac9d6c33655eed25bfd2cf37e3
This commit is contained in:
parent
c0ad96898d
commit
60562e74fc
|
@ -70,7 +70,8 @@
|
|||
},
|
||||
"obsolete-tag": {
|
||||
"enabled": true,
|
||||
"priority": "low"
|
||||
"priority": "low",
|
||||
"has-name": true
|
||||
},
|
||||
"bogus-image-options": {
|
||||
"enabled": true,
|
||||
|
@ -78,25 +79,30 @@
|
|||
},
|
||||
"missing-end-tag": {
|
||||
"enabled": true,
|
||||
"priority": "low"
|
||||
"priority": "low",
|
||||
"has-name": true
|
||||
},
|
||||
"stripped-tag": {
|
||||
"enabled": true,
|
||||
"priority": "low"
|
||||
"priority": "low",
|
||||
"has-name": true
|
||||
},
|
||||
"self-closed-tag": {
|
||||
"enabled": true,
|
||||
"priority": "high",
|
||||
"has-name": true,
|
||||
"parser-migration": true
|
||||
},
|
||||
"deletable-table-tag": {
|
||||
"enabled": true,
|
||||
"priority": "high",
|
||||
"has-name": true,
|
||||
"parser-migration": true
|
||||
},
|
||||
"misnested-tag": {
|
||||
"enabled": true,
|
||||
"priority": "medium"
|
||||
"priority": "medium",
|
||||
"has-name": true
|
||||
},
|
||||
"pwrap-bug-workaround": {
|
||||
"enabled": true,
|
||||
|
@ -115,21 +121,25 @@
|
|||
"html5-misnesting": {
|
||||
"enabled": true,
|
||||
"priority": "high",
|
||||
"has-name": true,
|
||||
"parser-migration": true
|
||||
},
|
||||
"tidy-font-bug": {
|
||||
"enabled": true,
|
||||
"priority": "high",
|
||||
"has-name": true,
|
||||
"parser-migration": true
|
||||
},
|
||||
"multiple-unclosed-formatting-tags": {
|
||||
"enabled": true,
|
||||
"priority": "high",
|
||||
"has-name": true,
|
||||
"parser-migration": true
|
||||
},
|
||||
"unclosed-quotes-in-heading": {
|
||||
"enabled": true,
|
||||
"priority": "high",
|
||||
"has-name": true,
|
||||
"parser-migration": true
|
||||
},
|
||||
"multiline-html-table-in-list": {
|
||||
|
|
|
@ -69,6 +69,11 @@ class CategoryManager {
|
|||
*/
|
||||
private $parserMigrationCategories = [];
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $hasNameParam = [];
|
||||
|
||||
public function __construct() {
|
||||
global $wgLinterCategories;
|
||||
foreach ( $wgLinterCategories as $name => $info ) {
|
||||
|
@ -78,6 +83,9 @@ class CategoryManager {
|
|||
if ( isset( $info['parser-migration'] ) ) {
|
||||
$this->parserMigrationCategories[$name] = true;
|
||||
}
|
||||
if ( isset( $info['has-name'] ) ) {
|
||||
$this->hasNameParam[$name] = true;
|
||||
}
|
||||
}
|
||||
|
||||
sort( $this->categories[self::HIGH] );
|
||||
|
@ -89,6 +97,10 @@ class CategoryManager {
|
|||
return isset( $this->parserMigrationCategories[$name] );
|
||||
}
|
||||
|
||||
public function hasNameParam( $name ) {
|
||||
return isset( $this->hasNameParam[$name] );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
|
|
|
@ -137,19 +137,8 @@ class LintErrorsPager extends TablePager {
|
|||
->rawParams( $viewLink, $editHistLinks )
|
||||
->escaped();
|
||||
case 'details':
|
||||
$hasNameCats = [
|
||||
'deletable-table-tag',
|
||||
'obsolete-tag',
|
||||
'missing-end-tag',
|
||||
'self-closed-tag',
|
||||
'misnested-tag',
|
||||
'stripped-tag',
|
||||
'html5-misnesting',
|
||||
'tidy-font-bug',
|
||||
'multiple-unclosed-formatting-tags',
|
||||
'unclosed-quotes-in-heading',
|
||||
];
|
||||
if ( in_array( $this->category, $hasNameCats ) && isset( $lintError->params['name'] ) ) {
|
||||
if ( $this->categoryManager->hasNameParam( $this->category ) &&
|
||||
isset( $lintError->params['name'] ) ) {
|
||||
return Html::element( 'code', [], $lintError->params['name'] );
|
||||
} elseif ( $this->category === 'bogus-image-options' && isset( $lintError->params['items'] ) ) {
|
||||
$list = array_map( function ( $in ) {
|
||||
|
|
Loading…
Reference in a new issue