Wikipedia:Linter

Illustration of linter gathering up various MediaWiki code markup
Cleaning up the lint

The Linter extension is a MediaWiki extension that aims to identify "lint": syntax errors in the code of Wikipedia pages. The lint in this case is broken and problematic markup on all wiki pages that cannot be fixed automatically by MediaWiki. The extension produces a list of these errors at Special:LintErrors, which editors and bots can consult to find pages that need attention. High-priority Linter issues require fixing as they may cause pages to display in undesirable fashion. The MediaWiki wiki help page describes 18 specific types of lint errors.

Background

A linter is software that helps an author or editor of a document (such as a wiki page or a programming file) see if there may be errors in the document. The extension does this for wiki pages: it helps identify whether a page displays as the author intended yesterday in some cases (for example, some image options are "linted" for), and helps identify whether a page displays as the author intended today, due to changes in how the MediaWiki system creates HTML from wikitext. Further reasons can be found at mw:Help:Extension:Linter § Why and what to fix.

List of lint errors

From Special:LintErrors. The database ids are defined in the MediaWiki source code.

High priority

  1. Table tag that should be deleted (id 7)
  2. Duplicate IDs (id 25)
  3. Misnested tag with different rendering in HTML5 and HTML4 (id 12)
  4. Miscellaneous issues (id 17)
  5. Multiline table in list (id 16)
  6. Multiple unclosed formatting tags (id 14)
  7. Paragraph wrapping bug workaround (id 9)
  8. Self-closed tags (id 6)
  9. Extension tag with template parameter (id 27)
  10. Old behaviour of link-wrapping font tags (id 13)
  11. Whitespace parsing bug (id 10)
  12. Unclosed quote in heading (id 15)

Medium priority

  1. Bogus file options (id 3)
  2. Fostered content (id 1)
  3. Misnested tags (id 8)
  4. Multi colon escape (id 11)
  5. Links in links (id 18)

Low priority

  1. Empty headings (id 26)
  2. Missing end tag (id 4)
  3. Missing end tag in heading (id 21)
  4. Background color inline style rule exists without a corresponding text color (id 22)
  5. Obsolete HTML tags (id 2)
  6. Stripped tags (id 5)

Tracking only (not listed on Special page)

  1. Large tables (buggy, not an error; for tracking only; not listed on Special page) (id 20)
  2. fostered-transparent (buggy, not usually an error; for tracking only; not listed on Special page) (id 24)
  3. missing-image-alt-text (not always an error; see WP:MOSALT: An image that is purely decorative (provides no information and serves only an aesthetic purpose) requires no alternative text.) (id 23)
  4. pre-expansion (id 28)

How you can help

Editors (mostly WikiGnomes) are going around Wikipedia working to clean up lint errors, which are sorted by severity into one of three priority levels: high, medium, and low, which relate to how badly the error affects page display, or how much the page display changed when MediaWiki parsing changed. You are welcome to join in this effort. Here are some hints:

Reports

Other useful pages

Linter error count progression

Linter error count progression
Date Outstanding linter errors Source
28 August 201824,083,947
17 June 202122,450,097
1 March 202215,349,584
25 March 202213,845,831
1 July 202211,116,651
3 November 20228,890,312
4 February 20237,994,445
13 February 20236,984,595
23 February 20235,998,634
5 March 20234,999,462
26 March 20233,996,924
28 December 20233,496,968
5 November 20242,999,906
26 December 20252,499,866
24 February 20261,999,893

Bots

Bots that are approved to run lint fixing tasks:

Active bots
Bot Operator Tasks Lint fixes status (last 30 days)
User:DreamRimmer bot III User:Max Task 8 is approved to fix errors in MassMessages, including Linter errors. Active (upon request)
User:Legobot User:Legoktm Task 41 Active
User:Qwerfjkl (bot) User:Qwerfjkl Tasks 27, 29, 31 Active
User:TenshiBot User:Tenshi Hinanawi Tasks 4, 5, 6, 12 Active
User:WikiCleanerBot User:NicoV Tasks 7, 10, 17, 22 Active
User:WOSlinkerBot User:WOSlinker Tasks 1, 2, 4, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 Active
Inactive bots or tasks
Bot Operator Tasks
User:Ahechtbot User:Ahecht Tasks 1, 2, 3, 5
User:DannyS712 bot User:DannyS712 Task 54
User:FrescoBot User:Basilicofresco Task 13
User:IznoBot User:Izno Task 1
User:John of Reading Bot User:John of Reading Task 4
User:MalnadachBot User:ಮಲ್ನಾಡಾಚ್ ಕೊಂಕ್ಣೊ Tasks 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12
User:MatrixBot User:Matrix Task 2
User:NihlusBOT User:Nihlus Tasks 2, 5, 10
User:PkbwcgsBot User:Pkbwcgs Tasks 17, 18
User:SheepLinterBot User:Sheep8144402 Tasks 1, 2

Using the "fixed lint errors" tag

Some bots use the tag fixed lint errors which can be used to filter in the edit log or hide in your watchlist. Recent changes.

Bot operators using Pywikibot can apply the tag with page.save(summary='Fixing lint issues', tags=['fixed lint errors'])

For JavaScript, add the following:

// Add change tag
var form = document.getElementById('editform');
if (form && !form.wpChangeTags) {
    var tagInput = document.createElement('input');
    tagInput.type = 'hidden';
    tagInput.name = 'wpChangeTags';
    tagInput.value = 'fixed lint errors';
    form.appendChild(tagInput);
}

Tools

User JavaScript tool: lintHint

User:PerfektesChaos/js/lintHint has instructions for installing and using lintHint, a gadget coded in JavaScript that identifies lint errors in a document in the wiki editor.

You can run lintHint repeatedly in the same edit session to see if you fixed the errors and to relocalize the error pointers. Error pointers are relative to the top of the article, so if you correct errors from the bottom up, you won't need to run lintHint again to relocalize error pointers.

The lintHint tool does not expand relative links when the page is in editing mode. For example, in Portal:Science, {{/Header}} really means {{Portal:Science/Header}}, but lintHint does not do this. To get lintHint to work, you should expand the relative links so future users do not need to reencounter the same errors. You can also use Expand templates, and enter the page name in Context title and copy part or all of the page into Input wikitext. Then click OK and then press lintHint. Expand templates will often help lintHint localize and identify lint errors listed on Page information but that lintHint doesn't find on its own.

After editing, pages are rechecked for lint errors, usually within seconds, but in the past sometimes delayed for hours. If lintHint says you fixed one or more lint errors, you probably did fix them, even if page information and the specific lint errors page aren't updated yet. As noted, however, lintHint can't detect errors in unexpanded relative links.

User CSS tool: lint.css

You can easily employ user CSS to detect a lot of "linty" old HTML 4 code in pages as you read, if you're a WikiGnome who likes to do cleanup. See meta:User:SMcCandlish/lint.css for a sample CSS declaration that makes various deprecated cruft – like <tt>, <font>, <center>, and <strike> – turn pink so it sticks out like a sore thumb. You can customize as you like for your own Special:MyPage/common.css or meta:Special:MyPage/global.css, or follow the instructions at lint.css to @import (transclude) lint.css directly into your own user CSS at this or any other WMF wiki.

This CSS only detects no-longer-valid markup; it has no means of detecting other coding errors.

See here for another example.

MediaWiki pages

Community consensus discussions

See also

Other errors

Help pages