Commit graph

107 commits

Author SHA1 Message Date
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
jenkins-bot 0e78237815 Merge "Fix bunch of PHPCS errors" 2021-04-17 12:19:30 +00:00
zoranzoki21 63e3150ab6 Fix bunch of PHPCS errors
Change-Id: I58b4f8b951d3bb7ce73ce2f14faf6a0f76963345
2021-04-17 13:42:01 +02:00
Kunal Mehta cb9329672a Update Legoktm's email address
Change-Id: Iceef061f4882b83661e5be6a931d85628b566f4c
2021-04-11 19:08:44 -07:00
Reedy c647f7c80e Fix PSR12.Properties.ConstantVisibility.NotFound
Bug: T253169
Change-Id: I9bd5f82ed62bb01b80b13507832935ac7a673804
2020-09-19 17:07:37 +00:00
Reedy 3387c848d0 Convert Linter to abstract schema
Bug: T259374
Change-Id: Ida866d45bc3daca6ed763df2b8c38d2b27c809aa
2020-08-22 23:33:46 +01:00
Bartosz Dziewoński fb58818a42 ApiQueryLintErrors: Allow querying by page title
Adding a new parameter 'lnttitle'.

The SQL queries should work the same as the ones when using the
existing parameter 'lntnamespace'.

Bug: T254930
Change-Id: Ic34617e2f56d1055388ea6e8a93ff641f0342240
2020-06-09 20:38:21 +02:00
Reedy 92f6f89df5 Fix class/function case mismatch
Bug: T253628
Change-Id: Id32777865a0135c39c19d5af2506ebd7e02fb2bb
2020-05-26 18:58:52 +01:00
DannyS712 a2bd1abd93 PHP coding conventions: reorder doxygen tags
See https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#Doxygen_tags

Change-Id: I79a38800b70a2f587d7f4553bb14c4c7f702a27b
2020-03-26 15:51:52 +00:00
DannyS712 0cae9b7d35 Remove use of Title::quickUserCan
Bug: T244927
Change-Id: I179a4faa26b3265d162fcb0d41bd9515fef623e8
2020-02-12 06:57:54 +00: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
libraryupgrader 850a9cd523 build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Change-Id: I6d33f100be437e2ce8856ddecbcac56886a5d98a
2019-12-17 21:29:49 +00:00
Kunal Mehta 562a3881a9 CategoryManager: Fix type annotations
...and provide better ones for phan.

Change-Id: Ic615f8765ebf2941b4fe72020ecacece06998ec6
2019-12-17 21:28:53 +00:00
jenkins-bot 12bd529229 Merge "Allow Parsoid to provide category ID hints" 2019-12-10 22:59:08 +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
C. Scott Ananian 8ff7599550 Don't crash RecordLintJob if the lint info doesn't contain params
We will crash trying to set `templateInfo` if it is present and `params`
is not.

On line 49 of RecordLintJob we're going to use `$errorInfo['params']`,
which will crash if `params` is not present.

Change-Id: I505c676cc0ccd8d54e44e65b04b10c2de03ee37c
2019-12-03 23:19:14 -05:00
Arlo Breault 40f0b3cef9 Implement ParserLogLinterData hook
Bug: T238456
Change-Id: I3e05d1c113b18c83db02c7e500d5834e931afb7f
2019-11-27 13:51:01 -05:00
Daimona Eaytoy 12065c11ca build: Bump mediawiki-phan-config to 0.8.0
Change-Id: Icbe64747c8c219882d419f4767704af96368b11a
2019-10-20 12:16:57 +00:00
DannyS712 3d33f7f1e0 Add invert namespace option to Special:LintErrors
Bug: T172703
Change-Id: I7e33ae6f5f79b7803a22968a7d8c49795e5bffbd
2019-09-04 18:56:48 -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
libraryupgrader ed09243414 build: Updating mediawiki/mediawiki-phan-config to 0.5.0
Change-Id: Ie148b252691261b9023a75504cbe14d51ba9e58c
2019-03-10 19:08:40 -07:00
Umherirrender e47e471799 Move sql file into own folder
Change-Id: I12ed78d755426644011fca7595dd82192825859f
2019-03-08 21:41:35 +01:00
Umherirrender e649f3029b Fix type of LintError->templateInfo
Change-Id: I2be1d59463ec42ab8955235c83516b2f6a1be276
2019-03-08 20:06:48 +01:00
Kunal Mehta fcb9eba542 DWIM in CategoryManager
If `"has-name": false` is set, then CategoryManager should interpret that
as false, and not treat the existence of the key as making it true.

Same with "parser-migration".

Change-Id: I6b8d5b23fb33707b7596d9172da26fd84d652da8
2019-03-02 22:57:42 +00:00
Kunal Mehta e41e8e32a4 Drop excess events at the API layer
Originally we were dropping excess events inside the job queue, but that means
all of the events need to be passed into the job queue...which can cause
problems.

So drop them in the API module. The only other place we construct
RecordLintJob is when an article has been deleted, and those jobs have
no errors since they're all being deleted.

Bug: T202179
Change-Id: I61940280e0dfb99398d9f047d0e66007d91a0241
2018-08-17 20:36:06 -07:00
Subramanya Sastry 2d115ecc5e Fix broken test for enabling parsermigration-edit links
Bug: T183746
Change-Id: I29b09d1cd608cb02065319e9de72ea51fbf1cc9c
2018-04-30 23:00:38 -05:00
Umherirrender 0b86ae2cee Add use for InvalidArgumentException
Change-Id: I67735aa40f45d75e6ed6bd0b205bb718f29ddfb8
2018-04-04 15:51:21 +02:00
jenkins-bot 13dfbf4ee9 Merge "Use normal lint error updating logic for page deletions" 2018-02-19 12:33:29 +00:00
Kunal Mehta db5e5e9003 Use estimateRowCount() instead of actually counting everything
On large wikis with lots of lint errors, counting the entire table can
be problematic from a performance perspective, sometimes taking minutes.

Instead, use Database::estimateRowCount(), which uses EXPLAIN SELECT
COUNT(*) to get an approximate value for the number of rows. We do make
sure that if the category actually has no rows, that it will return 0.

This should be considered a temporary solution, and we should look into
doing something like the SiteStats incremental updates table in the long
run.

Bug: T184280
Change-Id: I2d4dcc615477fd60e41dfed4a3d1a3ad52a9f4af
2018-02-01 13:15:06 -08:00
Reedy ecd8769508 Update IPSet use statement
Bug: T182273
Change-Id: I4f04462d13a37efd10e1e530a9b79e45cfb90309
2018-01-21 04:45:55 +00:00
C. Scott Ananian 2e49c745d7 Move category IDs into the extension.json information
This reduces the number of different files that need to be modified
in order to add a new linter category.

Change-Id: Id095317d6d761c57e2ce632d34ebd962bf85e785
2017-12-08 11:28:21 -05:00
C. Scott Ananian 60562e74fc Move $hasNameCats into the information in extension.json
Change-Id: Id4f01a2929ce43ac9d6c33655eed25bfd2cf37e3
2017-12-08 06:42:43 +00:00
C. Scott Ananian c0ad96898d Add 4 new high priority linter categories
* multiple-unclosed-formatting-tags: this is a subset of the unclosed
  formatting tag lint, but is higher priority because unclosed tags
  like <small> and <big> compound their effects

* unclosed-quotes-in-heading: unclosed wikitext i/b tag with a heading
  ancestor (this causes breakage which leaks out of the table of
  content to affect the rest of the page)

* multiline-html-table-in-list: html table with newline breaks nested
  in a list

* misc-tidy-replacement-issues: this is a catchall category for
  infrequent long-tail issues, used to enable speedy deployment of new
  linter categories during tidy replacement as wikis get RemexHtml
  enabled.  These will have a subtype property to identify the
  specific issue.

Change-Id: Ic2c965132f7a09679574489865bdc81df9e43845
2017-12-08 06:39:16 +00:00
Haikal Izzuddin 94fa73ac1b Replace deprecated usage of ApiBase::dieUsage()
Linter calls the deprecated ApiBase::dieUsage() function in
ApiRecordLint.php, replacing it with dieWithError().

Bug: T181758
Change-Id: I0cbf784f591b86b206b032fccbc0e32564a3e9e8
2017-12-03 15:26:39 -08:00
jenkins-bot ad6af1133b Merge "Rename typo "linker-" keys to proper "linter-"" 2017-11-25 16:41:25 +00:00
jenkins-bot 44aa608aae Merge "Show edit and history links even if page is protected" 2017-11-25 13:56:52 +00:00
xyx_is a262956017 API: Allow querying linterrors by pageid
The pageid parameter limits lint errors to specific pages. Users can get
detailed lint error information of a certain page.

Bug: T181303
Change-Id: I164449254649caff29fcffa3bc7c923c20b8e837
2017-11-24 21:03:05 -08:00
Kunal Mehta 35cfda325b Rename typo "linker-" keys to proper "linter-"
I must have made a typo and prefixed the keys with "linker-" instead of
"linter-".

Change-Id: I041aa3341aaa2efa51d20c848cb19efb648209ac
2017-11-24 20:38:25 -08:00
Kunal Mehta e0ac4c6e6b Show edit and history links even if page is protected
If the user does not have permission to edit the page, still show a
"view source" and history link so they are able to figure out what the
error is.

Bug: T177289
Change-Id: I049d27d37073e452dc0c11128dab5204d110d81f
2017-11-24 20:35:15 -08:00
Kunal Mehta 2c08143ed0 Improve logging for non-existent categories in the database
Suggested by Chad in the review for 3a8d3b9e0.

Bug: T179423
Change-Id: I9286ae33bdb3b0b50aa6f1619402caa5486682e3
2017-11-22 23:05:04 -08:00
jenkins-bot c78e1c8d75 Merge "Handle non-existent categories in the database better" 2017-11-23 00:53:45 +00:00
jenkins-bot 674efd33e6 Merge "Add test case to verify all the i18n messages for a category exists" 2017-10-31 20:09:34 +00:00
Kunal Mehta 3a8d3b9e03 Handle non-existent categories in the database better
If a newer version of MediaWiki gets rolled back, it's possible for
there to be lint entries in the database that don't exist according to
CategoryManager.

Instead of showing an error to the user, just silently hide those rows.

All callers to CategoryManager::getCategoryId() already check the
category exists. The callers for CategoryManager::getCategoryName() will
catch the MissingCategoryException, and log it if necessary. Notably
LinterError::makeLintError() will return false on invalid rows, and all
callers have been updated to handle that.

Bug: T179423
Change-Id: Ia5f56f18a51fa871511b02410222a6079efbfff6
2017-10-31 10:42:07 -07:00
Subramanya Sastry 95f4038db8 Add tidy-font-bug linter high-priority category
* <font> tags with color attribute that wrap links and images
  will have different behavior and hence rendering compared to Tidy.

Change-Id: I7a551ef9b7e8f57d7a43c823832f0e3add6b1367
2017-10-23 17:08:57 -05: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 a1421792e9 Use normal lint error updating logic for page deletions
Page deletions were bypassing the logic in RecordLintJob that
ensured the right category totals cache was cleared and the
statsd updates. Fix that by just using RecordLintJob directly.

Bug: T170313
Change-Id: I06b821b65f65609ddac8ed4e7c662336082d8266
2017-10-05 21:03:30 -07:00
Kunal Mehta 5416525735 Parse linter-category-{name}-desc messages
Bug: T177429
Change-Id: I3f36b27fee877122d3df3c68b3aa9515412f6869
2017-10-04 20:17:22 -07:00
Subramanya Sastry d13bb1aa6c Add html5-misnesting high-priority category
Change-Id: I840c4dfc14308dffd02dd8a89ab4dcac13f6141a
2017-09-26 12:31:43 -05:00