Commit graph

4769 commits

Author SHA1 Message Date
Daimona Eaytoy 909eec6716 Tweak coverage part 2
Follow-up of Ic30883f7d261d974a2be46308d023e2714119e95, with two files
that I forgot to git-add and a repositioning of comments to avoid the
last bracket to be reported as uncovered.

Bug: T201193
Change-Id: I6bf7e5892a0f49f6a138792f0aedf230a70c18a8
2019-04-13 19:26:01 +02:00
Daimona Eaytoy 4bcb64b01a Increase code coverage a bit
This patch mostly adds coverageIgnore comments for intendedly
unreachable code etc. Some of them could be made testable by adding a new
filter function (e.g. array cast), but this patch is meant to be
comment-only (aside from the parser test).
Ignoring coverage for these lines makes some methods reach 100%
coverage, which in turn makes it easier to look at the coverage chart
and identify at a glance which parts of the code *really* need to be
covered.

Bug: T201193
Change-Id: Ic30883f7d261d974a2be46308d023e2714119e95
2019-04-13 18:30:14 +02:00
jenkins-bot caeaac9e7d Merge "Add tests for storing and loading the variables dump" 2019-04-12 14:09:57 +00:00
Daimona Eaytoy c1f5f25304 Add missing action- messages
They're simply the same as the corresponding right- message, but
starting with a lowercase letter.

Bug: T220812
Change-Id: I0dd31cb1cd5d34a2333a3b2341bc060f28c9162e
2019-04-12 14:20:46 +02:00
jenkins-bot ed1c996f65 Merge "Temporarily catch BadMethodCallException when computing _links vars" 2019-04-12 08:27:19 +00:00
Daimona Eaytoy 8293ec176f Add tests for storing and loading the variables dump
These are specific tests for storeVarDump and loadVarDump, both alone
and in the context of running filters.
Also, include disabled variables in the VariableHolder object if they're
saved in the DB.

Bug: T201193
Depends-On: Ia5c477edc8733bb1994cb6d01e1371ed496c8bcb
Change-Id: I5e35d773904a62105767ce6d7d962ab5525c2d12
2019-04-12 08:03:33 +00:00
Translation updater bot 837903d244 Localisation updates from https://translatewiki.net.
Change-Id: Ic1194e795ac1b0701e10383d85367fab3b9bc5bc
2019-04-12 08:31:08 +02:00
jenkins-bot ca6ef32a69 Merge "Use string cast for Postgres compatibility" 2019-04-11 21:50:06 +00:00
jenkins-bot c0da9ff3ac Merge "Clean AbuseFilterParserTests" 2019-04-11 21:46:50 +00:00
Daimona Eaytoy e5ab8483fc Temporarily catch BadMethodCallException when computing _links vars
The root cause is database rows holding a serialized revision object
(awful, right?), and to properly fix it we need a maintenance script,
still WIP (T213006).
This temp fix is to avoid flooding the exception channel.

Bug: T187153
Change-Id: I062934091fbd6213cf9bc10e8ad6864ce6a58254
2019-04-11 09:33:16 +02:00
Translation updater bot e52c5479c2 Localisation updates from https://translatewiki.net.
Change-Id: Iea94515d6ea83712364c564fbbadc71e4efdf0a6
2019-04-10 09:22:39 +02:00
jenkins-bot 903f3db8fe Merge "Beautify old, broken abuse_filter_history rows" 2019-04-10 05:11:38 +00:00
Daimona Eaytoy 25ed009518 Beautify old, broken abuse_filter_history rows
And right when the throttle script seemed complete... Here is another
function! So, this change splits the logic in new functions called
sequentially, and the only actual change is adding the beautifyHistory
function. Its purpose is to search ANY row in abuse_filter_history with
empty/missing parameters and normalize it. More specifically, missing
period and count are inserted as 0, and for missing groups we add
"none", used by a newly introduced message. This way, messages shown on
Special:AbuseFilter/history will be clearer and won't have gaps.

Bug:T209565
Bug:T215787
Change-Id: I38395f4df9d83badfd26cdf584ffba743b6417a9
2019-04-10 04:51:58 +00:00
Brad Jorsch b59f19d675 AbuseFilterTest: Don't use $wgUser when creating pages
Which means we have to pass a user to WikiPage::doEditContent().

Follows up Ifbcd9adf3.

Change-Id: I1bd0288cc132627d75b4001219522ec5e952eda7
2019-04-09 12:25:34 -04:00
Translation updater bot ca3a4df4d6 Localisation updates from https://translatewiki.net.
Change-Id: I2630010f88cc3858514ee76af693e9c1e0a1e025
2019-04-09 09:03:04 +02:00
Translation updater bot 96c30f55f0 Localisation updates from https://translatewiki.net.
Change-Id: I6440eb0b364300df138141773de891eb7fe25607
2019-04-08 08:38:02 +02:00
jenkins-bot cc670f0a07 Merge "Clean the AbuseFilterTest class" 2019-04-06 14:47:52 +00:00
jenkins-bot efe32b7c93 Merge "Add doc for every class member" 2019-04-06 14:37:19 +00:00
jenkins-bot d53c84da36 Merge "Restore check for dividebyzero" 2019-04-06 12:35:23 +00:00
jenkins-bot e03488b66a Merge "Overhaul tag selector" 2019-04-06 12:35:20 +00:00
jenkins-bot cf5df265b0 Merge "Allow filtering AbuseLog for filter group" 2019-04-06 12:24:10 +00:00
jenkins-bot 8ac0dda62d Merge "Don't publish LogEntries without ID" 2019-04-06 12:24:07 +00:00
Daimona Eaytoy a777b681e2 Don't publish LogEntries without ID
Mimic what publish() does, for the part that we need.

Bug: T219951
Bug: T218940
Change-Id: I16dd7071837a6965934d08b770f455f45cd02a6b
2019-04-06 09:46:09 +02:00
Translation updater bot c09b26e555 Localisation updates from https://translatewiki.net.
Change-Id: Iecb47cca140e414ed14c327e6fedd343ca57eccc
2019-04-05 22:26:59 +02:00
Brad Jorsch 5ace1121b0 Actually create user in AbuseFilterConsequencesTest
If the User passed to $logEntry->setPerformer() represents a creatable
username, then it has to actually exist so the actor row can be created.

Bug: T188327
Change-Id: Iab2fc9593a020ffacd219d644103d685028e3336
2019-04-05 12:35:25 -04:00
Translation updater bot 43febbbea4 Localisation updates from https://translatewiki.net.
Change-Id: Ica8dc3ee7a51a74c4f8119c2b761b98b5730e6bc
2019-04-04 14:51:43 +02:00
James D. Forrester afd07adabc build: Upgrade eslint-config-wikimedia from 0.10.1 to 0.11.0
Change-Id: I11bd3ce18c986e6b767daef5f87f6ed325090ffc
2019-04-03 15:44:45 -07:00
Translation updater bot 84e43dff56 Localisation updates from https://translatewiki.net.
Change-Id: I4f1d4a1587a4ce8c6a028a924bbe2271343254bc
2019-04-01 22:40:44 +02:00
jenkins-bot ee5ce302ea Merge "Fix confused statement about disabled variable" 2019-04-01 08:43:11 +00:00
Translation updater bot 9f176fcd6d Localisation updates from https://translatewiki.net.
Change-Id: Ic100f653bb76330ef9f11ac6f7031c5d0e1cceac
2019-03-31 22:15:57 +02:00
jenkins-bot 8e07b7f2c2 Merge "Reduce the amount of returns" 2019-03-31 16:40:00 +00:00
jenkins-bot 0301c27c56 Merge "Restore highlighting of all keywords, functions, etc." 2019-03-31 15:51:57 +00:00
jenkins-bot 9a195c9758 Merge "Replace deprecated wfWaitForSlaves" 2019-03-31 15:51:55 +00:00
Daimona Eaytoy 7fb3ea9002 Reduce the amount of returns
Having a single return statement inside a function isn't always the
best, but having 5 is probably worse. This patch changes three long
if-return/if-return/... to a single if/elseif + return.

Change-Id: I5f4603627c61cf1b93859fe6bcd952eac8e82359
2019-03-30 09:52:56 +00:00
Daimona Eaytoy b4346678c6 Replace deprecated wfWaitForSlaves
Deprecated since 1.27.

Change-Id: I16787520dd4939e6d1579261ac35a4a1f6288b70
2019-03-29 11:01:37 +01:00
Daimona Eaytoy c73d5b5bde Restore highlighting of all keywords, functions, etc.
Short explanation on phab. Ace stops at the first regex match, so we
must use a function to specify the token type.

Bug: T219593
Change-Id: If7e6e98de81ce7e1be334732518425c8115e4aea
2019-03-29 10:44:02 +01:00
Daimona Eaytoy 5b4ea18045 Don't escape abusefilter-edit-status
This was sort of missed in Ia5c477edc8733bb1994cb6d01e1371ed496c8bcb.

Bug: T157235
Change-Id: Id952119a89df05a20c964eea8d4fe332c67f9086
2019-03-29 09:54:30 +01:00
Translation updater bot 7f5b3dd23e Localisation updates from https://translatewiki.net.
Change-Id: I6c2b9359c28005b4b2bb4d10acdfce0dff95a06c
2019-03-27 22:28:00 +01:00
jenkins-bot ebc6e06bc5 Merge "Use setDescription() instead of accessing guts directly" 2019-03-26 08:51:04 +00:00
Translation updater bot cc9d0537f4 Localisation updates from https://translatewiki.net.
Change-Id: I714eef537b4e98c7866638c12492a312f4a8c858
2019-03-26 08:44:04 +01:00
Max Semenik 9afac9d6ff Use setDescription() instead of accessing guts directly
Change-Id: I369b88419afc6550922caf625059ad9570428cac
2019-03-25 19:51:20 -07:00
Daimona Eaytoy 0ff581e246 Clean AbuseFilterParserTests
Mostly delete result files and assume the result is always true. The few
exceptions were either moved to standalone test, or inverted.

Change-Id: I6c06e596587750c4ebaabafbd277bc75eeb436a5
2019-03-23 12:59:03 +01:00
Daimona Eaytoy 4ab12305f1 Use string cast for Postgres compatibility
We JOIN integer and text, so Postgres would always fail on these. As
mentioned in the task description, this is only a temporary solution
(although a clean and durable one), while the long-term one is
I7460a2d63f60c2933b36f8383a8abdbba8649e12.

Bug: T42757
Change-Id: Ifddd0bca1e8eaa7c70511fb0d0588457b4fd0669
2019-03-23 12:44:02 +01:00
Daimona Eaytoy 72c2be7a18 Remove $wgAbuseFilterRuntimeProfiling
The reasoning is similar to the one of the parent patch (Ia5c477edc8733bb1994cb6d01e1371ed496c8bcb). Plus, it records runtime metrics on action different than edits, as there's no reason not to do it.
No performance issues in production.

Bug: T191039
Depends-On: Ia5c477edc8733bb1994cb6d01e1371ed496c8bcb
Change-Id: Ib1112e2fefd0631550d386ba87e5f87db84c3036
2019-03-23 11:31:18 +00:00
Daimona Eaytoy 89520e2353 Remove $wgAbuseFilterProfiling
This variable was introduced to selectively enable profiling because
stats recording was bad for performance. Nowadays, stats are recorded in
a deferredupdate and don't harm performance anymore. Thus, this variable
can be removed and profiling be enabled by default.

Bug: T191039
Depends-On: Ib5fdeb75c1324f672b4ded39681f006fde34b4d1
Change-Id: Ia5c477edc8733bb1994cb6d01e1371ed496c8bcb
2019-03-23 11:31:11 +00:00
jenkins-bot 7a6468fa29 Merge "Add a function to the parser to retrieve the next token" 2019-03-23 11:10:44 +00:00
Daimona Eaytoy f375835ff2 Merge "Localisation updates from https://translatewiki.net." 2019-03-23 11:10:19 +00:00
jenkins-bot 24aef03785 Merge "Log throttled actions" 2019-03-23 11:08:06 +00:00
Daimona Eaytoy 27545422b4 Add a function to the parser to retrieve the next token
It provides some sort of look ahead capability, avoiding to move and
then roll back.

Change-Id: I6293cbd355572c9de3a8591dd8286b14a239ffb2
2019-03-23 11:55:08 +01:00
Daimona Eaytoy c095069918 Log throttled actions
So that we have some numbers and debugging info.

Change-Id: I490504bfac09d537be5bca36ef52992b6aa4f0cb
2019-03-23 11:52:48 +01:00