Commit graph

27 commits

Author SHA1 Message Date
Arlo Breault 2fa7a30f14 Remove hardcoded list of categories with no parameters
Change-Id: Ic8b9ced613c873cada0a9909ed0d3799160504a1
2021-12-15 17:27:36 -05:00
zoranzoki21 63e3150ab6 Fix bunch of PHPCS errors
Change-Id: I58b4f8b951d3bb7ce73ce2f14faf6a0f76963345
2021-04-17 13:42:01 +02:00
Reedy c647f7c80e Fix PSR12.Properties.ConstantVisibility.NotFound
Bug: T253169
Change-Id: I9bd5f82ed62bb01b80b13507832935ac7a673804
2020-09-19 17:07:37 +00: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
Kunal Mehta 562a3881a9 CategoryManager: Fix type annotations
...and provide better ones for phan.

Change-Id: Ic615f8765ebf2941b4fe72020ecacece06998ec6
2019-12-17 21:28:53 +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
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
Umherirrender 0b86ae2cee Add use for InvalidArgumentException
Change-Id: I67735aa40f45d75e6ed6bd0b205bb718f29ddfb8
2018-04-04 15:51:21 +02: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
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
Subramanya Sastry d13bb1aa6c Add html5-misnesting high-priority category
Change-Id: I840c4dfc14308dffd02dd8a89ab4dcac13f6141a
2017-09-26 12:31:43 -05:00
Arlo Breault 875e0f84a0 Add multi-colon-escape linter medium-priority category
Change-Id: I9f21f3128b78e7b2459c18a9121605dffd5a1bc4
2017-09-18 14:04:04 -04:00
Subramanya Sastry 11f4a97ba6 Provide parsermigration-edit edit link option for categories
* Since the high priority categories are being used to effect
  Tidy migration, we need editors to be able to compare their fixes
  and ensure that the pages look identical after the fix.

* This patch adds a new property for linter categories and displays
  the requested edit link in the pager.

* This patch enables the property for high priority categories.

Change-Id: Ia9b23d79da686f0a6c0203e2dba58a876a4a3d4a
2017-08-22 10:07:39 +00:00
Subramanya Sastry ce8b7c873c Add tidy-whitespace-bug linter high-priority category
Change-Id: I9c068c2c45b4cf9bb5612f41dfa63a606a7a679a
2017-08-10 12:20:09 -04:00
Subramanya Sastry 0f3c66418a Organize lint categories by priority
Displaying categories by priority provides editors with better
guidance about what to spend time on. The Linter help page provides
more information about why the specific priorities have been chosen.

Change-Id: If6f28570189e24a67b4380f666f4cd64a2296989
2017-04-28 10:42:47 -05:00
Subramanya Sastry a866fa7c76 Add pwrap-bug-workaround linter category
Change-Id: If1ec022e5bb741f4dc825428b5a689c2f0b0c445
2017-04-19 15:19:13 -05:00
Subramanya Sastry 0d230e722f Add misnested-tag linter category
Change-Id: I3508c68272940d21be6a5c9b78ee34c845debc74
2017-04-10 17:28:36 -05:00
Subramanya Sastry 619ddc8677 Add deletable-table-tag linter category
Change-Id: I48000170a74363872edbce8f78780bccf160600c
2017-04-06 12:47:51 -05:00
Kunal Mehta f3778856f2 Add severity for error categories
Categories can now have a severity level of "error" or "warning"
designated, which places them in a different heading on
Special:LintErrors.

Bug: T152822
Change-Id: I1276b9502d90765e88dcb8ea78569dee910c5d88
2016-12-14 17:07:40 -08:00
Kunal Mehta b41e74ce8b Hardcode category ids
Instead of having a complex auto-increment category manager that had
additional caching, just hardcode the (currently 6) ids for each
category, which allows us to simplify a lot of code.

If Parsoid sends a lint error in a category that we don't know about, it
is silently dropped.

Bug: T151287
Change-Id: Ice6edf1b7985390aa0c1c410d357bc565bb69108
2016-11-22 18:31:17 -08:00
Kunal Mehta ec6f4722aa Store linter_cat names in a separate table
linter_cat is now an int ID that points to a row in the new
lint_categories table.

The mapping between category names and ids is all handled in PHP, and
cached in APC.

Note that you will need to drop the `linter` table manually and re-run
update.php for this to take effect.

Change-Id: I369d9b4d8d08289b4a20d1cd29a2e327bad28ef8
2016-11-03 14:51:10 -07:00