Page MenuHomePhabricator

Use bots/nobots to prevent just cosmetic changes
Closed, ResolvedPublic

Description

Article Limpopo is apparently an exception to CosmeticChangesToolkit.standardizePageFooter's definition of a category main article.
There should be a way to prevent the bot applying cosmetic changes on a page, but still allow editing it.

Proposal: Reuse {{bots}}/{{nobots}} for this. Where {{Bots|denyscript=cosmetic_changes}} would be matched, cosmetic changes would be skipped.

Solution: After https://gerrit.wikimedia.org/r/c/pywikibot/core/+/697138 is merged, add module argument to BasePage._check_bot_may_edit. It would default to pywikibot.calledModuleName(). Then, cache self._check_bot_may_edit('cosmetic_changes') separately.

Event Timeline

cosmetic_changes will skip the page:

C:\pwb\GIT\core>pwb -lang:cs cosmetic_changes -page:Limpopo -simulate
WARNING: C:\pwb\GIT\core\pywikibot\bot.py:784: UserWarning: Site objects have been created before arguments were handled
  warn('Site objects have been created before arguments were handled',

Retrieving 1 pages from wikipedia:cs.


>>> Limpopo <<<
@@ -49 +49 @@
- [[Kategorie:Limpopo]]
+ [[Kategorie:Limpopo| ]]

Edit summary: robot: kosmetické úpravy
Do you want to accept these changes? ([y]es, [N]o, [a]ll, [q]uit): y
ERROR: Skipping Limpopo because of a save related error: Edit to page [[Limpopo]] failed:
Editing restricted by {{bots}}, {{nobots}} or site's equivalent of {{in use}} template

1 pages read
0 pages written
0 pages skipped
Execution time: 4 seconds
Read operation time: 4.0 seconds
Script terminated successfully.

C:\pwb\GIT\core>

Do you mean the cosmetic changes hook should also be skipped then?

Do you mean the cosmetic changes hook should also be skipped then?

Exactly.

Change 697178 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [IMPR] check bot/nobots templates for cosmetic_changes

https://gerrit.wikimedia.org/r/697178

Xqt triaged this task as Medium priority.May 31 2021, 9:15 AM

Change 697178 merged by jenkins-bot:

[pywikibot/core@master] [IMPR] check bot/nobots templates for cosmetic_changes

https://gerrit.wikimedia.org/r/697178

Xqt claimed this task.