jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/396162 )

Change subject: Move category IDs into the extension.json information
......................................................................


Move category IDs into the extension.json information

This reduces the number of different files that need to be modified
in order to add a new linter category.

Change-Id: Id095317d6d761c57e2ce632d34ebd962bf85e785
---
M extension.json
M includes/CategoryManager.php
2 files changed, 24 insertions(+), 19 deletions(-)

Approvals:
  Subramanya Sastry: Looks good to me, but someone else must approve
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/extension.json b/extension.json
index d5a48d1..064a136 100644
--- a/extension.json
+++ b/extension.json
@@ -65,89 +65,106 @@
        "config": {
                "LinterCategories": {
                        "fostered": {
+                               "dbid": 1,
                                "enabled": true,
                                "priority": "medium"
                        },
                        "obsolete-tag": {
+                               "dbid": 2,
                                "enabled": true,
                                "priority": "low",
                                "has-name": true
                        },
                        "bogus-image-options": {
+                               "dbid": 3,
                                "enabled": true,
                                "priority": "medium"
                        },
                        "missing-end-tag": {
+                               "dbid": 4,
                                "enabled": true,
                                "priority": "low",
                                "has-name": true
                        },
                        "stripped-tag": {
+                               "dbid": 5,
                                "enabled": true,
                                "priority": "low",
                                "has-name": true
                        },
                        "self-closed-tag": {
+                               "dbid": 6,
                                "enabled": true,
                                "priority": "high",
                                "has-name": true,
                                "parser-migration": true
                        },
                        "deletable-table-tag": {
+                               "dbid": 7,
                                "enabled": true,
                                "priority": "high",
                                "has-name": true,
                                "parser-migration": true
                        },
                        "misnested-tag": {
+                               "dbid": 8,
                                "enabled": true,
                                "priority": "medium",
                                "has-name": true
                        },
                        "pwrap-bug-workaround": {
+                               "dbid": 9,
                                "enabled": true,
                                "priority": "high",
                                "parser-migration": true
                        },
                        "tidy-whitespace-bug": {
+                               "dbid": 10,
                                "enabled": true,
                                "priority": "high",
                                "parser-migration": true
                        },
                        "multi-colon-escape": {
+                               "dbid": 11,
                                "enabled": true,
                                "priority": "medium"
                        },
                        "html5-misnesting": {
+                               "dbid": 12,
                                "enabled": true,
                                "priority": "high",
                                "has-name": true,
                                "parser-migration": true
                        },
                        "tidy-font-bug": {
+                               "dbid": 13,
                                "enabled": true,
                                "priority": "high",
                                "has-name": true,
                                "parser-migration": true
                        },
                        "multiple-unclosed-formatting-tags": {
+                               "dbid": 14,
                                "enabled": true,
                                "priority": "high",
                                "has-name": true,
                                "parser-migration": true
                        },
                        "unclosed-quotes-in-heading": {
+                               "dbid": 15,
                                "enabled": true,
                                "priority": "high",
                                "has-name": true,
                                "parser-migration": true
                        },
                        "multiline-html-table-in-list": {
+                               "dbid": 16,
                                "enabled": true,
                                "priority": "high",
                                "parser-migration": true
                        },
                        "misc-tidy-replacement-issues": {
+                               "dbid": 17,
                                "enabled": true,
                                "priority": "high",
                                "parser-migration": true
diff --git a/includes/CategoryManager.php b/includes/CategoryManager.php
index ab110bb..d08b887 100644
--- a/includes/CategoryManager.php
+++ b/includes/CategoryManager.php
@@ -35,25 +35,7 @@
         *
         * @var int[]
         */
-       private $categoryIds = [
-               'fostered' => 1,
-               'obsolete-tag' => 2,
-               'bogus-image-options' => 3,
-               'missing-end-tag' => 4,
-               'stripped-tag' => 5,
-               'self-closed-tag' => 6,
-               'deletable-table-tag' => 7,
-               'misnested-tag' => 8,
-               'pwrap-bug-workaround' => 9,
-               'tidy-whitespace-bug' => 10,
-               'multi-colon-escape' => 11,
-               'html5-misnesting' => 12,
-               'tidy-font-bug' => 13,
-               'multiple-unclosed-formatting-tags' => 14,
-               'unclosed-quotes-in-heading' => 15,
-               'multiline-html-table-in-list' => 16,
-               'misc-tidy-replacement-issues' => 17,
-       ];
+       private $categoryIds = [];
 
        /**
         * @var string[][]
@@ -86,6 +68,12 @@
                        if ( isset( $info['has-name'] ) ) {
                                $this->hasNameParam[$name] = true;
                        }
+                       if ( isset( $info['dbid'] ) ) {
+                               if ( isset( $this->categoryIds[$name] ) ) {
+                                       throw new InvalidArgumentException( 
"duplicate ID: $name" );
+                               }
+                               $this->categoryIds[$name] = $info['dbid'];
+                       }
                }
 
                sort( $this->categories[self::HIGH] );

-- 
To view, visit https://gerrit.wikimedia.org/r/396162
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id095317d6d761c57e2ce632d34ebd962bf85e785
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/Linter
Gerrit-Branch: master
Gerrit-Owner: C. Scott Ananian <[email protected]>
Gerrit-Reviewer: C. Scott Ananian <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to