Wikipedia:Bots/Requests for approval/HairBot
- 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: Hairrr (talk · contribs · SUL · edit count · logs · page moves · block log · rights log · ANI search)
Time filed: 01:34, Saturday October 27, 2012 (UTC)
Automatic, Supervised, or Manual: Automatic
Programming language(s): Python
Source code available: Yes
Function overview: Removes the dead end tag on pages if it doesn't apply
Links to relevant discussions (where appropriate):
Edit period(s): Every 3 days
Estimated number of pages affected: 200-300 pages over a month, can grow over time
Exclusion compliant (Yes/No): Yes
Already has a bot flag (Yes/No): No
Function details: Bot goes through all pages categorized as a dead end page. If it has more than 1 or more links on the page to another mainspace article, it'll remove the tag. It'll remove the template(s) in the following conditions:
- If
{{Dead end}}
or{{Dead end|date=Month Year}}
found on the page and if it applies. - If
{{Multiple issues|dead end=Month Year|issue=Month Year}}
is found on the page and if it applies. Also, as it'd leave issue in multiple issues and nothing else, it'd transform issue back into it's original template (turning{{Multiple issues|issue=Month Year}}
into{{issue|date=Month Year}}
) only if necessary.
Discussion
[edit]Both {{multiple issues}}
and {{dead links}}
have redirects your regex doesn't account for. Additionally, instead of using [Mm]ultiple issues
, you can just use the re.IGNORECASE
flag. Legoktm (talk) 07:01, 27 October 2012 (UTC)[reply]
- If you ignore case, you also match non-existant templates with weird capitalization. Not a problem here per se, but it can happen (can't find that list of different templates whose titles only differ in capitalization). — HELLKNOWZ ▎TALK 21:41, 27 October 2012 (UTC)[reply]
- I have several comments.
- Line 1: The PEP 8 recommends one import statement for each module imported.
- Line 7: An empty container will return False in a boolean context. if pages: is the preferred way of checking if a list is not empty.
- Line 10: 2013 will arrive in a little over two months. When that happens, the script will break (getpages() will return None, which cannot be iterated over in line 29).
- Line 18: Don't compare boolean values to True or False using ==.
- Lines 19-21: Is there any reason you're using regex over a real template parser?
- →Σσς. (Sigma) 07:20, 27 October 2012 (UTC)[reply]
- Line 1, Line 7 and Line 18: As it seems this is only a recommendation and the preferred way, it has never come across to me to do this. I'll fix that in the code now.
- Line 10: To my understanding, this won't break/return None. By default, 2012 is the year (as that is what the current dead end pages are). As it goes through each month and reaches december, the year increases by 1, if that year is greater than the current year, it returns all the pages in returnlist. Is there an issue that I'm not aware of?
- Line 19-21: I've never used mwparserfromhell, though you have told about it to me before! I'd rather use something that I am more familiar with, rather than a new tool.
- HairTalk 21:27, 27 October 2012 (UTC)[reply]
"If it has more than 1 or more links on the page to another mainspace article, it'll remove the tag." How do you detect this? (Sorry I don't look through code, but we document the process and actual implementation is up to you, as long as it works ok.) What about links from navboxes, templates, infoboxes, etc.? — HELLKNOWZ ▎TALK
- This is an API action (example on Foobar article), it's an easy way to find links. HairTalk 00:38, 29 October 2012 (UTC)[reply]
- So the bot does not account for false positives? If I was to place something like
{{mergeto|Foobar}}
, it would think there's a link. — HELLKNOWZ ▎TALK 08:29, 29 October 2012 (UTC)[reply]
- So the bot does not account for false positives? If I was to place something like
{{Multiple issues}} is not used as you describe it anymore, we now use full templates inside it. Though old syntax is still around (for now). — HELLKNOWZ ▎TALK 21:41, 27 October 2012 (UTC)[reply]
- I'm aware of this and have accounted for this in the regex, thanks for pointing that out though. HairTalk 00:38, 29 October 2012 (UTC)[reply]
There is also the {{underlinked}} template, which should be used for articles, once there are a few links, but clearly not enough. The bot wouldn't be able to detect this, and I'm wondering if this would be a requirement. Similar example would be a bot task that removes {{unreferenced}} and adds {{refimprove}} (we have a couple of those). — HELLKNOWZ ▎TALK 08:29, 29 October 2012 (UTC)[reply]
- I can easily add this into HairBot (and will do that now). I'm glad you pointed this out to me as I didn't think of involving this into HairBot. HairTalk 01:35, 6 November 2012 (UTC)[reply]
- It is now added into the script. HairTalk 01:32, 9 November 2012 (UTC)[reply]
Approved for trial (50 edits). Please provide a link to the relevant contributions and/or diffs when the trial is complete. MBisanz talk 23:44, 9 November 2012 (UTC)[reply]
- I'm still interested how the bot avoids false positives. — HELLKNOWZ ▎TALK 08:42, 10 November 2012 (UTC)[reply]
Trial complete. - Before the trial began, I decided to switch to mwparserfromhell after seeing the potential it has. Because of this integration the trial started off a bit rough, but at the end everything went perfectly well. Example edits: [1] [2]. HairTalk 22:58, 11 November 2012 (UTC)[reply]
- Please make the summary more descriptive and link to this BRFA or some explanation of what the bot is doing. — HELLKNOWZ ▎TALK 08:40, 12 November 2012 (UTC)[reply]
These pages have no direct prose links: [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] (and other eclipse ones) [27] [28] [29] [30] [31] [32] [33] [34]
Some have no links at all, some have links in navboxes and other templates, that aren't generally considered proper inline linking for {{dead end}} purposes (you could clarify this; although, in the end, prose still has no links).
These are borderline: [35] [36] [37] [38] — HELLKNOWZ ▎TALK 08:40, 12 November 2012 (UTC)[reply]
Withdrawn by operator. - There are obviously some issues that aren't accounted for in the script. I'd rather spend my time working on a script rather useful instead of a script that continues to fail. HairTalk 01:59, 13 November 2012 (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.