Расширение:Linter

This page is a translated version of the page Extension:Linter and the translation is 56% complete.
Outdated translations are marked like this.
Это расширение поставляется с MediaWiki 1.40 и выше. Таким образом, вам не нужно загружать его снова. Тем не менее, вы всё равно должны следовать другим инструкциям.
Справка по расширениям MediaWiki
Linter
Статус релиза: стабильно
Реализация Служебная страница
Описание Обнаружение и отслеживание ошибок исходного кода.
Автор(ы) Kunal Mehta (Legoktmобсуждение)
MediaWiki >= 1.42
Изменения в БД Да
Таблицы linter
Лицензия GNU General Public License 2.0 или позднее
Скачать
README
Помощь Help:Extension:Linter/ru
  • $wgLinterCategories
  • $wgLinterParseOnDerivedDataUpdate
  • $wgLinterStatsdSampleFactor
Ежеквартальные загрузки 65 (Ranked 81st)
Использование общедоступными вики 884 (Ranked 294th)
Переведите расширение Linter, если оно доступно на translatewiki.net
Проблемы Открытые задачи · Сообщить об ошибке

Расширение Linter отслеживает ошибки lint с использованием внешней службы. В настоящее время основным применением служит отслеживание ошибок, обнаруживаемых Parsoid, и сообщение о них пользователям. Справка для пользователей, желающих исправлять ошибки, доступна на странице Help:Extension:Linter .

Установка

Для работы расширения требуется установить $1; в конфигурации Parsoid необходимо включить проверку ошибок lint.
  • Скачайте и распакуйте файл(ы) в папку с названием Linter в вашей папке extensions/.
    Вместо этого разработчикам и соавторам кода следует установить расширение из Git, используя:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Linter
  • Добавьте следующий код в конце вашего файла LocalSettings.php :
    wfLoadExtension( 'Linter' );
    
  • Выполните скрипт обновления, который автоматически создаст необходимые таблицы, используемые расширением.
  •   Готово – Перейдите на страницу Special:Version на своей вики, чтобы удостовериться в том, что расширение успешно установлено.

Параметры конфигурации

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

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, fostered, 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|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
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]


Категории линтера

Список категорий доступен в информации о сайте.

Bootstrap or reprocess all pages

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

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 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.