The following discussion is an archived debate. Please do not modify it. To request review of this BRFA, please start a new section at WT:BRFA. The result of the discussion was Withdrawn by operator.

Operator: R'n'B (talk · contribs · SUL · edit count · logs · page moves · block log · rights log · ANI search)

Time filed: 18:57, Wednesday May 21, 2014 (UTC)

Automatic, Supervised, or Manual: Automatic

Programming language(s): Python, using Pywikibot framework.

Source code available: Will be on Labs, once finalized.

Function overview: Fix self-referential ((Redirect)) template invocations.

Links to relevant discussions (where appropriate):

Edit period(s): Monthly, or as needed.

Estimated number of pages affected: About two hundred on the first run, due to backlog, and likely in the low tens per month after that.

Exclusion compliant (Yes/No): Yes

Already has a bot flag (Yes/No): Yes

Function details: ((Redirect)) is a hatnote template designed for articles that are the target of a potentially ambiguous redirect. For an example of correct template usage, see Augustus, which contains ((Redirect|Octavius)), producing the text Currently there are a couple of hundred articles (197, at last count) that incorrectly contain use this template with the article's own title as the first parameter, producing the nonsense statement that the article redirects to itself. For an example, see Buccaneer, which contains ((Redirect|Buccaneer)), producing the text

This bot task will look for articles that contain the template ((Redirect)) with the article's own title as the first parameter. These articles will be edited as follows:

  1. If there is only one parameter, and the disambiguation page (e.g., Buccaneer (disambiguation) in the example above) exists, the template will be replaced with ((Other uses)), which will result in the text:
  2. If there are exactly two parameters; e.g., ((Redirect|Buccaneer|other things)), which would produce the text and the disambiguation page exists, the template will be replaced with ((About| |other things)), which will produce the text
  3. If there are either one or two parameters and the disambiguation page does not exist, the template invocation will be deleted from the page. (Note: so far, I've only found two articles, out of 231 candidates, that would need a hatnote removed.)
  4. If there are three or more parameters, for example ((Redirect|Buccaneer|other kinds of pirates|Pirate (disambiguation))) which would produce the text the template invocation will be replaced with ((About| |other kinds of pirates|Pirate (disambiguation))) (with any parameters after the first being copied unchanged), resulting in the text In this case, the bot will not test for the existence of any of the articles linked via the template.

I have done a "dry run" of the script that just output a diff of the edit that the script would make, but did not make any actual edits to articles. The output of the dry run can be viewed at User:RussBot/Test - recursive redirect hatnote task. R'n'B (call me Russ) 17:12, 29 May 2014 (UTC)[reply]

Discussion[edit]

I would just like to weigh in to support this proposed bot task. Hatnotes that suggest a page redirects to itself are a particularly silly error, and one that can be easily fixed by a bot. bd2412 T 14:03, 3 June 2014 (UTC)[reply]

((BAG assistance needed))

I looked at the dry run – well, the first edit, at least. It's to disco, and seems problematic. First, it replaces the hatnote with ((About| |Disco|the modern style of music also called "disco"|Nu-disco)), which looks like a bug:

For Disco, see the modern style of music also called "disco". For Nu-disco, see Disco (disambiguation).

It seems like you meant to replace it with ((About| |the modern style of music also called "disco"|Nu-disco)) based on #4 above, but this apparently didn't work, so you should fix that first. Additionally, I have a problem with the bot changing ((about)) followed by ((redirect)) into two ((about))s on the same page. It should be possible to detect this situation and instead integrate the parameters into one ((about)) template. Since disco has ((About|the music genre|the entertainment venue|discothèque|other uses)) at the top, I would expect the bot to replace it with ((About|the music genre|the entertainment venue|discothèque|the modern style of music also called "disco"|Nu-disco|other uses)), which looks like:

This article is about the music genre. For the entertainment venue, see discothèque. For the modern style of music also called "disco", see Nu-disco. For other uses, see Disco (disambiguation).

While your solution is still an improvement over the original, I would expect the bot to go a step further in this case since the logic involved isn't too difficult. — Earwig talk 23:28, 10 June 2014 (UTC)[reply]

Withdrawn by operator. R'n'B (call me Russ) 13:28, 12 June 2014 (UTC)[reply]

The above discussion is preserved as an archive of the debate. Please do not modify it. To request review of this BRFA, please start a new section at WT:BRFA.