Commit graph

119 commits

Author SHA1 Message Date
Matěj Suchánek 1335b79a0b Pass HTML element attributes as an array
Html::openElement checks for this and logs a warning.
Html::closeElement does not, and this makes it return
</span class="error">.

Change-Id: I31c2809d2fd5421606fa877021d1636ac0eb4d26
2022-01-15 14:18:56 +01:00
Arlo Breault 8a797fd625 s/linter-pager-title/linter-pager-title-header/
Change-Id: I51e4ffa89954b0b6bf798562668dc4a95c00d9da
2022-01-11 23:24:52 +00:00
Arlo Breault ace2d5c17d s/linter-pager-template/linter-pager-template-header/
Change-Id: I658b258fe46bdeefbfc0b1d348e4ac4d9c423205
2022-01-11 12:41:56 -05:00
Arlo Breault 850ec4fa70 Add i18n for pager category
Follow up to I70fde2676ded6a112f7f2b07f94f6f4b616f0e39

Change-Id: I38647833938fb27793827649bc5c785dc3fd63ea
2022-01-11 12:21:19 -05:00
Arlo Breault fc8c39baa5 Fix lint error updating
The article id of the title is set to 0 when the page is deleted so,
although the lint job from the hook runs, it doesn't remove anything.

Reverts most of I06b821b65f65609ddac8ed4e7c662336082d8266

Bug: T298782
Bug: T170313
Change-Id: I2610b9b16d4032b0e18b3537cc9ed51bfdaff299
2022-01-10 16:24:00 -05:00
Arlo Breault 2218e87c05 Move outputting headers back to the top
Change-Id: I175d69c990de032686033ef909eec0b1865e795f
2022-01-10 15:21:20 -05:00
Arlo Breault f821fa7f47 Add a title for single page view
Follow up to I70fde2676ded6a112f7f2b07f94f6f4b616f0e39

Bug: T151362
Change-Id: I21b8b9085f13480075e0b572f38ec9a05a398f01
2022-01-10 15:16:04 -05:00
sbailey 31bc33b578 All lint errors for a single page was missing error detail label
Bug: T151362
Change-Id: I4eabb53cd133ee46e986a0d81a7002a286dfc0c4
2022-01-10 13:07:31 -06:00
sbailey 88aab3cd1e Linter: Display lint errors for a single page
* Added error message when namespace and/or pagename is not
  found or malformed which now displays a bold red message.

Bug: T151362
Change-Id: I70fde2676ded6a112f7f2b07f94f6f4b616f0e39
2022-01-07 12:45:55 -08:00
Alexander Vorwerk af53fbc23a Replace usages of deprecated wfWikiID()
The global function wfWikiID() is deprecated since 1.35 and it's usages
should be replaced with WikiMap::getCurrentWikiId().

Bug: T298059
Change-Id: I695c20bff266f869f740baf7f3e335b357546fb4
2021-12-21 01:54:47 +00:00
Arlo Breault 2fa7a30f14 Remove hardcoded list of categories with no parameters
Change-Id: Ic8b9ced613c873cada0a9909ed0d3799160504a1
2021-12-15 17:27:36 -05: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
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