Wikipedia:Bots/Requests for approval/RussBot 6


 * 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 Symbol oppose vote.svg Withdrawn by operator.

RussBot 6
Operator:

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, 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, 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, which will result in the text:
 * 2) If there are exactly two parameters; e.g.,, which would produce the text  and the disambiguation page exists, the template will be replaced with , 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  which would produce the text  the template invocation will be replaced with  (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)

Discussion
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) BAG assistance needed
 * for can be used instead of about with an empty first parameter. /~huesatlum/ 17:57, 9 June 2014 (UTC)
 * That is true, for case [2] above, but it doesn't work for case [4] if there are more than two parameters after the page title. It seemed simpler to stick with About for both cases, rather than have to worry about divergences in the syntax. --R'n'B (call me Russ) 21:44, 9 June 2014 (UTC)
 * After I wrote up the description above, another editor "helpfully" edited the article Buccaneer so that the erroneous hatnote is no longer present. Well, it is helpful for the encyclopedia, just not for comprehension of this request. :-) R'n'B (call me Russ) 21:48, 9 June 2014 (UTC)

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, 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 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 abouts on the same page. It should be possible to detect this situation and instead integrate the parameters into one about template. Since disco has at the top, I would expect the bot to replace it with, 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) R'n'B (call me Russ) 13:28, 12 June 2014 (UTC)
 * Thanks for the comments. I was able to fix the first bug, which was fairly trivial. But your second comment raises issues that aren't trivial at all. A surprising number of articles have more than one Redirect hatnote, and some may also have more than one About hatnote, not to mention hatnotes of other varieties. This is kind of taking me down the rabbit hole.... I'm going to have to rethink the whole script design to deal with some of these issues, so, for now --
 * 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.