jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/926657 )

Change subject: [IMPR] Print an error message if a fixes entry is not a dict
......................................................................

[IMPR] Print an error message if a fixes entry is not a dict

If a fixes entry is different from a dict, throw an error message
and print the fix entry to logfile if -debug option is given.

https://www.mediawiki.org/wiki/Topic:Xizzw3qpwgt24d62

Change-Id: I48134579d92d7dd5a5a9d329ca81b2e1191403b1
---
M scripts/replace.py
1 file changed, 24 insertions(+), 1 deletion(-)

Approvals:
  Matěj Suchánek: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/scripts/replace.py b/scripts/replace.py
index feb6541..4cce7ab 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -883,7 +883,7 @@
     return pagegenerators.MySQLPageGenerator(sql)


-def main(*args: str) -> None:
+def main(*args: str) -> None:  # noqa: C901
     """
     Process command line arguments and invoke bot.

@@ -1000,6 +1000,15 @@
                 pywikibot.info(f'The user fixes file could not be found: '
                                f'{fixes.filename}')
             return
+
+        if not isinstance(fix, dict):
+            pywikibot.error(
+                f'fixes[{fix_name!r}] is a {type(fix).__name__}, not a dict')
+            if type(fix) is tuple:
+                pywikibot.info('Maybe a trailing comma in your user_fixes.py?')
+            pywikibot.debug(fix)
+            return
+
         if not fix['replacements']:
             pywikibot.warning(f'No replacements defined for fix {fix_name!r}')
             continue

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/926657
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I48134579d92d7dd5a5a9d329ca81b2e1191403b1
Gerrit-Change-Number: 926657
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <i...@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.w...@aol.com>
Gerrit-Reviewer: Matěj Suchánek <matejsuchane...@gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org

Reply via email to