Commit graph

131 commits

Author SHA1 Message Date
sbailey 7309cc139c Linter allows specification of a page prefix to refine selection
* UI and functionality working, SQL injection risk is handled using
   the database wrapper function buildLike()

Bug: T185685
Change-Id: I1f630a83f01a1c93f29643e4fc8baf55391b758d
2022-03-10 08:48:19 -08:00
Subramanya Sastry b08fd17186 Hooks.php: Check for non-array $tags
Bug: T302918
Change-Id: I96fdbbc443025d9461dc168e58164004a0f8d7ed
2022-03-02 15:40:05 -06: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
Arlo Breault 285838961b Account for all lintable contentmodels after contentmodel change
Change-Id: I54495ec01d4fc3b29f1c924f86be3bcd2ed94977
2022-02-25 17:46:56 -05: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
Ammarpad daa6275a20 SpecialLintErrors: Make code more resilient to bad input
Use WebRequest::getText, which discards array values since
the `pagename` param requires string value.

Bug: T301360
Change-Id: Ifc23a7020e410603ac86b71d7aee2d28f06b9ab2
2022-02-15 18:49:40 -05:00
Alexander Vorwerk 8c7fa34662 Fix typo in patch file
Bug: T175177
Follow-Up: Iac22d99109bb1253f450a64254f50677e3cdefeb
Change-Id: I0c1ad29b67a732faa06add8faff4f70988b8613b
2022-02-07 20:47:53 +00:00
sbailey 56567da56f First phase of T175177 database alter table adds two fields
* Adds template and tag name fields to enable better search
   capability to the Linter extension

Bug: T175177
Change-Id: Iac22d99109bb1253f450a64254f50677e3cdefeb
2022-02-03 14:57:17 -08:00
sbailey 4544a9c7cc Add namespace column and new index to Linter table - part 1
* This patch contains the code needed to update the database with
   the addition Linter table column linter_namespace <int/null>
   and add an index with category and namespace for faster
   selection of linter records.

Bug: T299612
Change-Id: I05da381b9a74294b44d4aef968614277d601a176
2022-01-28 20:19:38 +00:00
jenkins-bot bd45eeda91 Merge "Replace deprecated JobQueueGroup::singleton()" 2022-01-23 21:39:36 +00:00
Umherirrender 354012f419 Replace deprecated JobQueueGroup::singleton()
Change-Id: Ib19314b8a8a4265daf67e31d50f1c61aec2edb8e
2022-01-21 17:22:20 +00: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
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