Extension:Linter

From MediaWiki.org
Jump to: navigation, search

Other languages:
English • ‎日本語
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
Linter

Release status:Extension status stable

Linter logo v2.svg
ImplementationTemplate:Extension#type Special page
DescriptionTemplate:Extension#description Expose and track lint errors
Author(s)Template:Extension#username Kunal Mehta (Legoktmtalk)
Database changesTemplate:Extension#needs-updatephp Yes
TablesTemplate:Extension#table1 linter
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
README

Translate the Linter extension if it is available at translatewiki.net

Check usage and version matrix.

IssuesPhabricator

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:LinterHelp:Extension:Linter.

Installation[edit]

This extension requires Parsoid to be installed and linting enabled in Parsoid's configuration.
  • Download and place the file(s) in a directory called Linter in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'Linter' );
    
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.24 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension() If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of wfLoadExtension( 'Linter' );, you need to use:

require_once "$IP/extensions/Linter/Linter.php";


Configuration parameters[edit]

In your Parsoid config.yaml, set:

        linting: true
        linter:
            sendAPI: true

API[edit]

list=linterrors (lnt)

(main | query | linterrors)
  • This module requires read rights.
  • Source: Linter
  • License: GPL-2.0+

Get a list of lint errors

Parameters:
lntcategories

Categories of lint errors

Values (separate with | or alternative): deletable-table-tag, html5-misnesting, pwrap-bug-workaround, self-closed-tag, tidy-whitespace-bug, bogus-image-options, fostered, misnested-tag, multi-colon-escape, missing-end-tag, obsolete-tag, stripped-tag
Default: deletable-table-tag|html5-misnesting|pwrap-bug-workaround|self-closed-tag|tidy-whitespace-bug|bogus-image-options|fostered|misnested-tag|multi-colon-escape|missing-end-tag|obsolete-tag|stripped-tag
lntlimit

Number of results to query

No more than 500 (5,000 for bots) allowed.
Type: integer or max
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, 828, 829, 1198, 1199, 2300, 2301, 2302, 2303, 2600, 5500, 5501
To specify all values, use *.
lntfrom

Lint ID to start querying from

Type: integer
Example:
Get all lint errors of the obsolete-tag category
api.php?action=query&list=linterrors&lntcategories=obsolete-tag [open in sandbox]

Linter categories[edit]

A list of linter categories is available in site info properties.

See also[edit]