Extension:Linter
Linter Release status: stable |
|
---|---|
Implementation | Special page |
Description | Expose and track lint errors |
Author(s) | Kunal Mehta (Legoktmtalk) |
MediaWiki | >= 1.43 |
Database changes | Yes |
Tables | linter |
License | GNU General Public License 2.0 or later |
Download | README |
Help | Help:Extension:Linter |
|
|
Quarterly downloads | 61 (Ranked 74th) |
Public wikis using | 884 (Ranked 294th) |
Translate the Linter extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
The Linter extension tracks lint errors from an external service. Currently the main use case is to track the errors identified by Parsoid and expose them to editors. Help for users wanting to fix errors is available at Help:Extension:Linter .
Installation
[edit]- Download and move the extracted
Linter
folder to yourextensions/
directory.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Linter - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'Linter' );
- Run the update script which will automatically create the necessary database tables that this extension needs.
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Configuration parameters
[edit]Be warned that this config is not sufficient to get lints run or linter errors reported as of February 2024. There may be missing documentation. These settings might work
In the $wgParsoidSettings section of your LocalSettings.php file, set
$wgParsoidSettings = [
'linting' => true
];
API
[edit]list=linterrors (lnt)
- This module requires read rights.
- Source: Linter
- License: GPL-2.0-or-later
Get a list of lint errors
- lntcategories
Categories of lint errors
- Values (separate with | or alternative): bogus-image-options, deletable-table-tag, duplicate-ids, fostered, fostered-transparent, html5-misnesting, large-tables, misc-tidy-replacement-issues, misnested-tag, missing-end-tag, missing-end-tag-in-heading, multi-colon-escape, multiline-html-table-in-list, multiple-unclosed-formatting-tags, night-mode-unaware-background-color, obsolete-tag, pwrap-bug-workaround, self-closed-tag, stripped-tag, tidy-font-bug, tidy-whitespace-bug, unclosed-quotes-in-heading, wikilink-in-extlink
- Default: deletable-table-tag|duplicate-ids|html5-misnesting|misc-tidy-replacement-issues|multiline-html-table-in-list|multiple-unclosed-formatting-tags|pwrap-bug-workaround|self-closed-tag|tidy-font-bug|tidy-whitespace-bug|unclosed-quotes-in-heading|bogus-image-options|fostered|misnested-tag|multi-colon-escape|wikilink-in-extlink|missing-end-tag|missing-end-tag-in-heading|night-mode-unaware-background-color|obsolete-tag|stripped-tag
- lntlimit
Number of results to query
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- lntnamespace
Only include lint errors from the specified namespaces
- Values (separate with | or alternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 486, 487, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- To specify all values, use *.
- lntpageid
Only include lint errors from the specified page IDs
- Type: list of integers
- Separate values with | or alternative.
- Maximum number of values is 50 (500 for clients that are allowed higher limits).
- lnttitle
Only include lint errors from the specified page title
- lntfrom
Lint ID to start querying from
- Type: integer
- Get all lint errors of the obsolete-tag category
- api.php?action=query&list=linterrors&lntcategories=obsolete-tag [open in sandbox]
meta=linterstats (lntrst)
- This module requires read rights.
- Source: Linter
- License: GPL-2.0-or-later
Get number of lint errors in each category
- Get number of lint errors in each category
- api.php?action=query&meta=linterstats [open in sandbox]
Linter categories
[edit]A list of linter categories is available in site info properties.
Bootstrap or reprocess all pages
[edit]Instead of running refreshLinks.php , it's possible to populate lint errors by querying parsoid directly. See phab:T161556#3184216 for an example script.
Special pages
[edit]The extension provides the Special:LintErrors page.
Configuring available lints
[edit]The Special:LintErrors page displays available lints with associated priority that have been defined in the configuration variable wgLinterCategories.
Each linter category has the following fields:
- dbid: the unique id associated with the lint category used in the database.
- enabled: whether the lint rule is enabled. If lints are disabled they will not be accessible from the special page.
- priority: either none, low, medium or high. Lints that are none will not be listed on Special:LintErrors but will be accessible through the web via the associated subpage.
- no-params: no parameters are associated with the lint category.
- has-name: indicates that the lints are expected to contain a
name
parameter, so the special page displays the column in the UI.
For new lints, it is recommended that by default they are defined as priority none and that they are promoted after testing and some discussion with the linting community. No formal process exists for promoting lint priorities at time of writing.
This extension is being used on one or more Wikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia's CommonSettings.php and InitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki's Special:Version page. |
This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |
- Extensions bundled with MediaWiki 1.40
- Stable extensions
- Special page extensions
- GPL licensed extensions
- Extensions in Wikimedia version control
- APIQuerySiteInfoGeneralInfo extensions
- BeforePageDisplay extensions
- InfoAction extensions
- LoadExtensionSchemaUpdates extensions
- ParserLogLinterData extensions
- RevisionDataUpdates extensions
- WikiPageDeletionUpdates extensions
- All extensions
- Extensions used on Wikimedia
- Extensions included in Canasta
- Extensions included in Miraheze
- Extensions included in WikiForge