jenkins-bot has submitted this change and it was merged.

Change subject: Update pywikibot checker/insertables
......................................................................


Update pywikibot checker/insertables

Parameter checks were already correct (see T98004)
Added brace balance check as there are many links
Added insertables for the message parameters

Change-Id: I40f27473e076629c6ed54166d9ee85afad52c933
---
M groups/Pywikibot/Pywikibot.yaml
A groups/Pywikibot/Suggester.php
2 files changed, 26 insertions(+), 1 deletion(-)

Approvals:
  XZise: Looks good to me, but someone else must approve
  Nikerabbit: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/groups/Pywikibot/Pywikibot.yaml b/groups/Pywikibot/Pywikibot.yaml
index 4f5ee54..1554c42 100644
--- a/groups/Pywikibot/Pywikibot.yaml
+++ b/groups/Pywikibot/Pywikibot.yaml
@@ -35,8 +35,14 @@
   CHECKER:
     class: MessageChecker
     checks:
-      # This check should be renamed when we use JSON for everything
       - pythonInterpolationCheck
+      - braceBalanceCheck
+
+  INSERTABLES:
+    class: PywikibotInsertablesSuggester
+
+  AUTOLOAD:
+    PywikibotInsertablesSuggester: Suggester.php
 
   LANGUAGES:
     blacklist:
diff --git a/groups/Pywikibot/Suggester.php b/groups/Pywikibot/Suggester.php
new file mode 100644
index 0000000..ef5c221
--- /dev/null
+++ b/groups/Pywikibot/Suggester.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * @file
+ * @author Niklas Laxström
+ * @license GPL-2.0+
+ */
+
+class PywikibotInsertablesSuggester {
+       public function getInsertables( $text ) {
+               // %(title)s
+               $matches = array();
+               preg_match_all( '\%\([^)]+\)[diouxXeEfFgGcrs]/U', $text, 
$matches, PREG_SET_ORDER );
+               $insertables = array_map( function( $match ) {
+                       return new Insertable( $match[0], $match[0] );
+               }, $matches );
+
+               return $insertables;
+       }
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I40f27473e076629c6ed54166d9ee85afad52c933
Gerrit-PatchSet: 2
Gerrit-Project: translatewiki
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
Gerrit-Reviewer: Nemo bis <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: XZise <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to