Commit graph

31 commits

Author SHA1 Message Date
Reedy 89d3f6152b Minor cleanup
Change-Id: I0b8abdbeaece73fe8759ee220b9a3aefce240e68
2022-09-07 02:48:18 +01:00
sbailey b358b20dca Second phase of T175177: Adds template and tag to RecordLintJob
Bug: T175177
Change-Id: I59be7cabb80ace98da3c7f6f36a0d3d4f6b17d23
2022-08-22 12:47:01 -07:00
Arlo Breault 8f043ce7e0 Disable flaky tests
These tests seem to be making false assumptions about the estimate
EXPLAIN returns.

Change-Id: I8ae90b2173aba5286727b9b85bdb67fbdfee1baf
2022-08-04 12:11:38 -04:00
sbailey 79e825a466 Provide search by title prefix for any category of lint error
Bug: T185685
Change-Id: Ib667fcf5b2b1e752fde297b32b8bbe37dceabc5a
2022-06-16 13:27:14 -07:00
sbailey 6925519cb5 Delete lint errors when blank page saved while changing content type
* Add "mw-blank" as another tag value that erases all lint errors
   for a page as a blank page cannot have any lint errors.

Bug: T280193
Change-Id: Iaad8ce75950588b2676de5dfb5f5221d64231f0e
2022-02-28 15:03:16 -08:00
sbailey 0e56c22277 Delete lint error records when content model changes from wikitext
* Determines if new content type is not wikitext and if so
   deletes all existing lint error records for that pageID.

Bug: T298343
Change-Id: I20fac9a0c901f3e7a5cc898566a4487fbe70798f
2022-02-25 13:22:10 -08:00
Subramanya Sastry 70ffca650e Drop 'inline-media-caption' lint requests
Bug: T297443
Bug: T299302
Change-Id: Id158f1fef8be06ddac733c71b7c1e26a58270955
2022-01-17 12:55:51 -06:00
Alexander Vorwerk 9a1ce6e392 Avoid using WikiPage::factory()
WikiPage::factory() is deprecated since 1.36 and should be replaced
with WikiPageFactory::newFromTitle().

Bug: T297688
Change-Id: I63bf3ba1c2ad6f8b59d369d91777af0418746a6b
2021-12-16 23:00:32 +00:00
Arlo Breault 2fa7a30f14 Remove hardcoded list of categories with no parameters
Change-Id: Ic8b9ced613c873cada0a9909ed0d3799160504a1
2021-12-15 17:27:36 -05:00
Alexander Vorwerk 2b3ca01871 MediaWikiTestCase -> MediaWikiIntegrationTestCase
MediaWikiTestCase has been renamed to MediaWikiIntegrationTestCase in 1.34.

Bug: T293043
Change-Id: I2e76733232bad0201a4e1e97617f5f7c1cf97235
2021-10-12 21:52:50 +02:00
sbailey cc2e08546b Fix broken RecordLintJobTest
* Adapted other core phpunit test user, title and page creation
   code to avoid creating a MOCK title such that the job runner
   finds the page(title) in the database and runs the job without
   hackery of populating the title in the constructor of
   RecordLinkJob. When the getForPage() runs, it finds the
   page and its lint errors through the standard code paths.

Bug: T225337
Change-Id: Ibb57523ee2f066c7bd0465c14f0dcb2bab51286b
2021-08-11 15:39:49 -07:00
Kunal Mehta 4f4b700fbd Fix off-by-one error around MAX_ACCURATE_COUNT
Currently we select 20 rows, and return the accurate count if it's less
than that, so up to 19 rows. Since we want to return an accurate count
if it's 20 rows or less, select one more row, 21, so we can differentiate
between only having 20 result rows or hitting the limit. This is the same
technique used in MediaWiki's Pager system.

Change-Id: I50fa96238eb4c7178414ee92c53799fd69520926
2021-08-06 13:05:29 -07:00
libraryupgrader 577a074b69 build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

Change-Id: Ib1e2319da19d8c5589d1d41d3c0fe8f882792721
2021-05-05 06:09:03 +00:00
jenkins-bot 46aa330369 Merge "Make Linter category counts more accurate when counts are low" 2021-04-27 18:00:36 +00:00
sbailey 201b47e01d Make Linter category counts more accurate when counts are low
* The code now produces an accurate count if the number of
   errors for a category is below the threshold set by a
   public constant MAX_ACCURATE_COUNT (currently 20).
   The database record count limit was originally set to 1,
   to determine accurately, if there were actually 0 errors
   in a category as the estimate code would never report 0.
   If not 0, it would use the estimated count which does not
   produce an accurate count for any other number of errors.
   For low error counts this is annoying to editors and
   unnecessary. The additional CPU/disk activity to accurately
   check for low error counts is not significantly more than
   checking for 0 or 1, as checking for 0 likely requires
   a complete table scan which is probably expensive compared
   to a low count that early outs when it hits to record limit.

 * An improvement to consider is recording the accurate count in
   a separate tiny table, and maintaining an accurate count there
   which is used in preference to doing the select with row limit
   based on say a 30 second TTL, to prevent a stampede of requests
   from doing extraneous database operations.

 * Added unit test coverage for accurately counting low error
   conditions that are lower than the threshold and also verify
   that the estimate is inaccurate beyond the error count
   threshold.

Bug: T194872
Change-Id: I4f74cfe3bf9601baa0dc8fa6464a68030ac2bc4b
2021-04-27 10:38:24 -07:00
Kunal Mehta cb9329672a Update Legoktm's email address
Change-Id: Iceef061f4882b83661e5be6a931d85628b566f4c
2021-04-11 19:08:44 -07:00
DannyS712 830f879e22 Convert LintErrorTest to pure unit tests
No integration needed.

Requires bumping minimum version of mediawiki to when
MediaWikiUnitTestCase was introduced in 1.34.

Change-Id: Ibc0a1028cc61a7bdc149081aeaa1109de18ee119
2021-03-27 02:28:25 +00:00
Bartosz Dziewoński 11421eab59 Update for deprecations in PHPUnit
"Using assertContains() with string haystacks is
deprecated and will not be supported in PHPUnit 9.
Refactor your test to use assertStringContainsString()
or assertStringContainsStringIgnoringCase() instead."

Change-Id: I88df8a91660eb332a0ec87070eff31cfcf8c4955
2020-07-09 17:00:41 +02:00
libraryupgrader 210cada8e6 build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate

Additional changes:
* Also sorted "composer fix" command to run phpcbf last.

Change-Id: Icdd0d0e60dd543921a5757162548ae149c3316ea
2020-01-10 10:06:28 +00:00
C. Scott Ananian 551a1fb398 Allow Parsoid to provide category ID hints
This eases deployment dependencies by allowing Parsoid to supply an
appropriate database category ID so that new lint categories can be
appropriately stored during the interval between adding a new lint
category to Parsoid and deploying an Extension:Linter patch to
describe it.

Change-Id: Ib7b2342168fa53ca2abac7d5f54fe313be341eb7
2019-12-03 23:26:34 -05:00
Max Semenik c87c38eb20 tests: getMock() is deprecated
Bug: T192167
Change-Id: I0513626d69ee7fbfac40f3d648865e7bb9e23421
2019-10-21 22:15:34 -07:00
Kunal Mehta 5bea96cb43 Mark RecordLintJobTest as Broken
Change-Id: I3fa2cd4049a3d4ba3065b56343e63ab0b093ee94
2019-06-07 12:27:38 -04:00
Gueleu a6935d5230 Remove Column 'Nested wikilinks in external links that need to be fixed'
The column is not being used

Change-Id: I5fdc827994475eddd550170579bca5cfcd0a08fb
2019-03-27 08:46:33 -07:00
Kunal Mehta 06cb0d2930 Unbreak CategoryMessagesTest
This test previously wasn't running because the foreach() in the data
provider was totally wrong.

Also the -details variant for fostered isn't supposed to exist, so
hardcode in an exception.

Finally, add the @coversNothing annotation since this test is just
verifying the contents of en.json, not any PHP code.

Change-Id: I7ffffcc3a910aefb082f7ff59265d3be8bc46347
2018-02-05 21:55:57 -08:00
Kunal Mehta 6e4ae8aced Add test case to verify all the i18n messages for a category exists
Change-Id: If079206dd1f1c7c4a1b92f0ee05452bcc28b2323
2017-10-16 17:28:02 -07:00
Kunal Mehta f2a516582d build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.FunctionComment.Missing.Protected
* MediaWiki.FunctionComment.Missing.Public

Change-Id: I96e32df48d13040893bfd1be6d90d0db4f7c7d0a
2017-06-20 00:10:41 -07:00
Kunal Mehta eebd04aa00 Add caching to looking up totals
The query itself is too expensive to be run on large Wikimedia wikis. So
put it behind WAN cache and touch the check keys for each category
whenever those have errors added or deleted from them.

If this happens to get out of sync, it will get fully refreshed
regularly when the totals are sent to statsd.

WANObjectCache's 'lockTSE' feature will help avoid cache stampedes that
made this query expensive in the past.

Change-Id: I3774103a29fa0f29d36283950f136259fa71bffe
2017-05-29 07:33:41 -07:00
Kunal Mehta 08b4c26b7d Add unit tests for LintError
Change-Id: I62ac7c2d652afb7a46e912ad6178ebeb3cff3ff2
2016-12-02 16:27:48 -08:00
Kunal Mehta fa56bafacf Add basic integration tests for RecordLintJob
Change-Id: I6852d41f481282750b690b2e8122dcb224b4a107
2016-12-02 08:11:16 -08:00
Kunal Mehta 3a03781a70 Add basic integration tests for Special:LintErrors
Change-Id: I2d527ae6f4f615e73ea5dafa21ba678c1de835f7
2016-12-02 07:55:26 -08:00
Kunal Mehta 14b53d6281 Add integration tests for Database class
These tests insert variations of fake lint errors into the database, and
then read out of the database to check they round-trip properly.

And while we're at it, improve the setForPage() return value.

These tests can be run with something like:
 php tests/phpunit/phpunit.php extensions/Linter/tests/phpunit/

Change-Id: Ifdba8a8a104d218a822f909bc5d7b3512aca499d
2016-11-30 21:17:51 -08:00