Jump to content

Extension:Linter

From mediawiki.org
This page is a translated version of the page Extension:Linter and the translation is 100% complete.
Příručka k rozšířením MediaWiki
Linter
Stav rozšíření: stabilní
Implementace Speciální stránka
Popis Odhaluje a sleduje chyby lintů
Autoři Kunal Mehta (Legoktmdiskuse)
Zásady kompatibility Vydání snímků současně s MediaWiki. Hlavní vývojová větev není zpětně kompatibilní.
Změny v databázi Ano
  • $wgLinterCategories
  • $wgLinterParseOnDerivedDataUpdate
  • $wgLinterStatsdSampleFactor
Licence GNU General Public License 2.0 nebo novější
Stáhnout
README
Nápověda Help:Extension:Linter/cs
Přeložte rozšíření Linter, používá-li lokalizaci z translatewiki.net
Problémy Otevřené úkoly · Nahlásit chybu

Rozšíření Linter sleduje chyby lint z externí služby. V současné době je hlavním případem použití sledování chyb identifikovaných funkcí Parsoid a jejich zpřístupnění editorům. Pomoc pro uživatele, kteří chtějí opravit chyby, je k dispozici na Nápověda:Rozšíření:Linter .

Instalace

Toto rozšíření vyžaduje povolení lintingu v konfiguraci Parsoidu.
Toto rozšíření je součástí MediaWiki 1.40 a vyšší. Zbývající konfigurační pokyny je stále nutné dodržovat.
  • Stáhněte soubor/y a vložte je do adresáře pojmenovaného Linter ve vaší složce extensions/.
    Vývojáři a přispěvatelé kódu by si místo toho měli nainstalovat rozšíření from Git pomocí:
    cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Linter
    
  • Na konec vašeho souboru LocalSettings.php přidejte následující kód:
    wfLoadExtension( 'Linter' );
    
  • Spusťte aktualizační skript, který automaticky provede všechny nezbytné databázové změny, jaké rozšíření vyžaduje. Přidejte navrhovanou konfiguraci:
  • Yes Dokončeno – Přejděte na stránku Special:Version vaší wiki a zkontrolujte, zda bylo rozšíření úspěšně nainstalováno.

Konfigurace

Přidejte do souboru LocalSettings.php následující kód a v případě potřeby jej upravte:

// Načíst Parsoid
wfLoadExtension(
    'Parsoid',
	"$IP/vendor/wikimedia/parsoid/extension.json"
);

$wgParsoidSettings = [
    'useSelser' => true,
    'linting' => true
];

$wgVisualEditorParsoidAutoConfig = false; // aby fungovalo odstraňování lintigování

$wgVirtualRestConfig = [
	'paths' => [],
	'modules' => [
		'parsoid' => [
			'url' => 'https://www.mysite.wiki/w/rest.php',
			'domain' => 'www.mysite.wiki',
			'forwardCookies' => true,
			'restbaseCompat' => false,
			'timeout' => 30
		],
	],
	'global' => [
		'timeout' => 360,
		'forwardCookies' => false,
		'HTTPProxy' => null
	]
];

Aktualizace na MediaWiki 1.43.x

Updating the extension's database table for MediaWiki 1.43 may need special attention.[1]

Skript update.php spouští dva časově náročné migrační skripty, které aktualizují databázovou tabulku Linteru rychlostí přibližně 500 řádků za sekundu. Doporučuje se spustit přímo update.php.

Pro velké tabulky Linter, kde není proveditelná delší doba údržby:

Aktualizace z verze 1.40+
  1. Podívejte se na stránku $wgLinterWriteNamespaceColumnStage = true
  2. Podívejte se na stránku $wgLinterWriteTagAndTemplateColumnsStage = true
  3. Spusťte $ path/to/mediawiki/maintenance/run.php migrateNamespace
  4. Spusťte $ path/to/mediawiki/maintenance/run.php migrateTagTemplate
  5. Pokračujte s aktualizací MediaWiki a rozšíření na verzi 1.43
Aktualizace z verze 1.39 nebo starší
  1. Nejprve aktualizujte na MediaWiki 1.42
  2. Pak postupujte podle výše uvedených kroků pro aktualizaci na verzi 1.40+.


API

list=linterrors (lnt)

(main | query | linterrors)

Get a list of lint errors

Specific parameters:
Other general parameters are available.
lntcategories

Categories of lint errors

Values (separate with | or alternative): bogus-image-options, deletable-table-tag, duplicate-ids, empty-heading, 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, template-arg-in-extension-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|template-arg-in-extension-tag|tidy-font-bug|tidy-whitespace-bug|unclosed-quotes-in-heading|bogus-image-options|fostered|misnested-tag|multi-colon-escape|wikilink-in-extlink|empty-heading|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, 710, 711, 828, 829, 1198, 1199, 1728, 1729, 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
Example:
Get all lint errors of the obsolete-tag category
api.php?action=query&list=linterrors&lntcategories=obsolete-tag [open in sandbox]

meta=linterstats (lntrst)

(main | query | linterstats)

Get number of lint errors in each category


Example:
Get number of lint errors in each category
api.php?action=query&meta=linterstats [open in sandbox]


Kategorie Linteru

Seznam kategorií linteru je k dispozici ve vlastnostech informací o webu.

Bootstrap nebo přepracování všech stránek

Místo spuštění refreshLinks.php je možné naplnit chyby lint přímým dotazem na parsoid. Příklad skriptu naleznete v phab:T161556#3184216.

Speciální stránky

The extension provides the Special:LintErrors page.

Configuring available lints

The Special:LintErrors page displays available lints with associated priority that have been defined in the configuration parameter $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.

References