Wikipedia:Bots/Requests for approval/KadaneBot 2


 * 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

KadaneBot 2
Operator:

Time filed: 23:18, Tuesday, March 12, 2019 (UTC)

Automatic, Supervised, or Manual: automatic

Programming language(s): Python

Source code available: https://github.com/Kadane-Wikipedia/Rnd_Merge/blob/master/rnd_sub.py

Function overview: Replaces Template:Round and Template:Decimals with Template:Rnd if a parameter change is needed.

Links to relevant discussions (where appropriate): Templates_for_discussion/Log/2018_December_14, Bot_requests

Edit period(s): One time run

Estimated number of pages affected: 21,900 (est) 7300 (est)

Exclusion compliant (Yes/No): No

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

Function details: Bot replaces Template:Round and Template:Decimals with Template:Rnd iff:

The template name is Round or Decimals and The template's 2nd argument is not a decimal number or  The template's doesn't have a second argument


 * 1) Let NAME be the name of the template
 * 2) Let NUMBER represent the number to be rounded (first parameter)
 * 3) Let PLACE represent the number of places to round to (second parameter)


 * If NUMBER is not defined log an invalid template to User:KadaneBot/ErrorLog


 * If NAME is Round and PLACE is undefined and NUMBER has 1 decimal place:
 * Change NAME to Rnd
 * Change PLACE to 1


 * IF NAME is Round and PLACE is undefined and NUMBER has 2 decimal places:
 * Change NAME to Rnd
 * Change PLACE to 2


 * IF NAME is Round and PLACE is undefined and NUMBER has 3 or more decimal places:
 * Change NAME to Rnd
 * Change PLACE to 3

Note: This can result in a change of appearance, but does not result in loss of precision
 * IF NAME is Round and PLACE is undefined and NUMBER is a wiki markup expression:
 * Change NAME to Rnd
 * Change PLACE to 3
 * IF NAME is Round or NAME is Decimals and PLACE is not an integer:
 * Cast Place to an integer and save

Discussion

 * For an analysis of the visible differences between the templates, see User:DannyS712/sandbox2. I will be separately filing a BRFA to fix the cases that do not meet the criteria above. --DannyS712 (talk) 23:20, 12 March 2019 (UTC)
 * Please link to the diffs (or at least a perm link to the contribs; if unsure, ask me how) when done. -- The SandDoctor Talk 20:08, 13 March 2019 (UTC)
 * thanks, but this isn't my bot { --DannyS712 (talk) 20:17, 13 March 2019 (UTC)
 * Saw you in the discussion section and had a brain fart. please see the above. -- The SandDoctor  Talk 20:20, 13 March 2019 (UTC)

After the merge, aren't Template:Round and Template:Rnd going to point the the same place? This bot task therefore seems unnecessary to me. &#123;&#123;3x&#124;p&#125;&#125;ery (talk) 00:13, 14 March 2019 (UTC)
 * - Trial is complete. User:KadaneBot/Task2/TrialEdits contains a summary of all edits and a perm link to the diff as requested. All edits went fine. Decided to change edit summary after 6 edits to be more descriptive. Other than that no hiccups. Kadane (talk) 23:20, 13 March 2019 (UTC)
 * There appears to be a problem with this edit as it is going the wrong way changing round to rnd where as the closing statement on the merge says to merge to round. Keith D (talk) 00:00, 14 March 2019 (UTC)
 * They are all being changed to rnd, which will then be renamed to round, since rnd has by far the most transclusions --DannyS712 (talk) 00:05, 14 March 2019 (UTC)
 * I should have noticed this earlier, but this would change what is displayed, both in terms of format and in terms of precision, which should not be the case. results in 1, while converting it to rnd results in 1.2304. To replace this properly would require  (creating 1.2304), and this is just one example. Until we can sort out the specifics of each case where the replacement changes the display, this task should not be approved. --DannyS712 (talk) 00:16, 14 March 2019 (UTC)
 * And, furthermore, once the task is approved, it should only change the pages that need a change to the parameters. &#123;&#123;3x&#124;p&#125;&#125;ery (talk) 00:20, 14 March 2019 (UTC)
 * - Template:Round and Template:Decimals are being renamed to Template:Rnd because doing it the other way would result in 250k+ edits. This can be changed if you want.
 * Regarding the WP:COSMETICBOT comment, in my opinion this is much like substituting templates so they can be deleted. Exceptions are regularly made for that purpose according to the page you linked. Although I am not opposed to just changing templates that need a parameter change.
 * Regarding this bot being a useless task, I am not sure I am following why you think that.
 * It might be a good idea to ping the requester to answer your questions as well. Kadane (talk) 01:08, 14 March 2019 (UTC)
 * My comment about the bot being useless was based on a misconception of the task as only doing the edits I defined as cosmetic. I have no objection to the edits that actually do change parameters. Substing templates so that they can be deleted isn't cosmetic (the template will be deleted, at which point the pre-subst edit will display a redlinked template). Bypassing template redirects, which is what this task will end up having done after the merge is complete, is. Although I do realize, as a non-BAG-member, that I'm probably speaking as if I have much more authority than I actually do. &#123;&#123;3x&#124;p&#125;&#125;ery (talk) 01:13, 14 March 2019 (UTC)
 * - I appreciate your comments BAG or not. I am a newbie when it comes to Wikipedia, I just happen to know how to program. So a change of algorithm is needed to ensure that only edits with parameter changes are needed. I suppose I would need another trial for that? Kadane (talk) 01:19, 14 March 2019 (UTC)
 * I have started drafting rules for changing the parameters - see below, and feel free to help write the rest --DannyS712 (talk) 01:39, 14 March 2019 (UTC)
 * I wasn't sure if you would mind if I edited that or not. I wrote out a quick requirement on User:KadaneBot/Task2/ReplacementRules. I think that covers all differences. Thoughts? Kadane (talk) 01:43, 14 March 2019 (UTC)
 * Sorry, looking at all of these numbers for the templates is giving me a headache. I won't be on tomorrow, but I'll try to get back to you. I noticed, however, that you only cover Round->Rnd, not Decimal->Rnd. --DannyS712 (talk) 02:16, 14 March 2019 (UTC)

- It doesn't appear that parameter changes are needed from Decimal->Rnd. The only case it would be edited is if there is a decimal number as an argument, it would be truncated to an int. Do you see anything that I am missing? Kadane (talk) 03:19, 15 March 2019 (UTC)
 * I agree --DannyS712 (talk) 22:34, 15 March 2019 (UTC)

BAG assistance needed &#123;&#123;3x&#124;p&#125;&#125;ery (talk) 13:50, 16 March 2019 (UTC)
 * - I have changed the functional details of the bot to reflect the comments here. The bot will only make changes when a parameter change is needed now. Can I please get another trial? Kadane (talk) 23:55, 15 March 2019 (UTC)
 * BAG assistance needed is generally only added to a request after seven days has passed. It is intended for use if urgent attention is needed or if a request is being neglected (wait seven days first). As far as I can tell, neither was the case here (nothing urgent and only 3 days since my last comment here). Just an FYI for the future, that's all -- The SandDoctor  Talk 16:48, 16 March 2019 (UTC)

As with the last trial, please post the results here. -- The SandDoctor Talk 16:48, 16 March 2019 (UTC)
 * - Most of the articles I had in my estimated number were being counted because Round was included in another template. With that being said all replacements are finished and I was unable to complete 50 edits. All diffs are listed at User:KadaneBot/Task2/TrialEdits. I will withdraw this later today Kadane (talk) 20:12, 16 March 2019 (UTC)

Not enough edits to justify bot task. All parameters changed within trial. Kadane (talk) 06:04, 17 March 2019 (UTC)

As indicated per the above. Based on this, closing this request. -- The SandDoctor Talk 06:17, 17 March 2019 (UTC)

Replacement rules
P1 = first parameter, P2 = second


 * Round -> Rnd


 * IF a P2 is provided, AND it is <= 0, no change is needed
 * IF a P2 is provided, AND it is >0
 * IF the P2 <= the number of digits after the decimal point in P1, no change is needed
 * IF the P2 > the number of digits after the decimal point in P1, CHANGE IS NEEDED - P2 should be set to equal the number of digits after the decimal point in P1


 * Decimals -> Rnd


 * IF a second parameter is provided, AND it is <= 0, no change is needed
 * 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.