jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[IMPR] Move page checks to skip_page

Change-Id: I2c57975066089165e6bd827d99c77ab6c769189e
---
M scripts/noreferences.py
1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/scripts/noreferences.py b/scripts/noreferences.py
index c2f3544..fec70ba 100755
--- a/scripts/noreferences.py
+++ b/scripts/noreferences.py
@@ -707,6 +707,21 @@
ident=ident, text=self.referencesText)
return oldText[:index].rstrip() + ref_section + oldText[index:]

+ def skip_page(self, page):
+ """Check whether the page could be processed."""
+ if page.isDisambig():
+ pywikibot.output('Page {} is a disambig; skipping.'
+ .format(page.title(as_link=True)))
+ return True
+
+ if self.site.sitename == 'wikipedia:en' and page.isIpEdit():
+ pywikibot.warning(
+ 'Page {} is edited by IP. Possible vandalized'
+ .format(page.title(as_link=True)))
+ return True
+
+ return super().skip_page(page)
+
def treat_page(self) -> None:
"""Run the bot."""
page = self.current_page
@@ -717,17 +732,6 @@
.format(page.title(as_link=True)))
return

- if page.isDisambig():
- pywikibot.output('Page {0} is a disambig; skipping.'
- .format(page.title(as_link=True)))
- return
-
- if self.site.sitename == 'wikipedia:en' and page.isIpEdit():
- pywikibot.warning(
- 'Page {0} is edited by IP. Possible vandalized'
- .format(page.title(as_link=True)))
- return
-
if self.lacksReferences(text):
newText = self.addReferences(text)
try:

To view, visit change 636426. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I2c57975066089165e6bd827d99c77ab6c769189e
Gerrit-Change-Number: 636426
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged