扩展:Linter
发行状态: 稳定版 |
|
|---|---|
| 实现 | 特殊页面 |
| 描述 | |
| 作者 | Kunal Mehta (Legoktm留言) |
| 兼容性政策 | 快照跟随MediaWiki发布。 master分支不向后兼容。 |
| 数据库更改 | 是 |
|
|
| 许可证 | GNU General Public License 2.0 or later |
| 下載 | README |
| 帮助 | Help:Extension:Linter/zh |
| 前往translatewiki.net翻譯Linter扩展 | |
| 問題 | 开启的任务 · 报告错误 |
Linter扩展可以用一个外部服务追踪lint错误。 目前的主要用途是追踪由Parsoid发现的错误并报告给编者。 想要修复错误的用户可以查看帮助:扩展:Linter的帮助。
安裝
- 下载文件,并解压
Linter文件夹到extensions/目录中。
开发者和代码贡献人员应改从Git安装此扩展,输入:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Linter
- 請新增下列代码到您的LocalSettings.php文件的底部:
wfLoadExtension( 'Linter' );
- 請运行更新脚本,它将自动创建此扩展所必须的数据库表。 Add the suggested configuration:
完成 – 請导航至您的wiki上的Special:Version,以验证此扩展已成功安装。
配置
Add the following to your LocalSettings.php file, editing as necessary:
// Load Parsoid
wfLoadExtension(
'Parsoid',
"$IP/vendor/wikimedia/parsoid/extension.json"
);
$wgParsoidSettings = [
'useSelser' => true,
'linting' => true
];
$wgVisualEditorParsoidAutoConfig = false; // to make linting work
$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
]
];
Upgrading to MediaWiki 1.43.x
Updating the extension's database table for MediaWiki 1.43 may need special attention.[1]
The update.php script runs two time-consuming migration scripts that update the Linter database table at approximately 500 rows per second.
Running update.php directly is recommended.
For large Linter tables where extended maintenance time is not feasible:
- Upgrading from 1.40+
- Set
$wgLinterWriteNamespaceColumnStage = true - Set
$wgLinterWriteTagAndTemplateColumnsStage = true - Run
$ path/to/mediawiki/maintenance/run.php migrateNamespace - Run
$ path/to/mediawiki/maintenance/run.php migrateTagTemplate - Proceed with MediaWiki and extensions update to 1.43
- Upgrading from 1.39 or earlier
- Update to MediaWiki 1.42 first
- Then follow steps above for 1.40+ upgrade
API
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, 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
- 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 分类
Linter分类的列表在网站信息属性。
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 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
nameparameter, 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
| 此扩展用于一个或多个维基媒体项目。 这可能意味着扩展足够稳定、运作足够良好,可以用在这样的高流量的网站上。 请在维基媒体的CommonSettings.php和InitialiseSettings.php配置文件中查找此扩展的名称以查看哪些网站安装了该扩展。 特定wiki上的已安装的扩展的完整列表位于Special:Version页面。 |
| 此扩展在以下wiki农场/托管网站和/或软件包中提供: |
- Stable extensions/zh
- Special page extensions/zh
- Pages using deprecated NoteTA template
- APIQuerySiteInfoGeneralInfo extensions/zh
- BeforePageDisplay extensions/zh
- InfoAction extensions/zh
- LoadExtensionSchemaUpdates extensions/zh
- PageDeletionDataUpdates extensions/zh
- ParserLogLinterData extensions/zh
- RevisionDataUpdates extensions/zh
- WgQueryPages extensions/zh
- GPL licensed extensions/zh
- Extensions in Wikimedia version control/zh
- All extensions/zh
- Extensions bundled with MediaWiki 1.40/zh
- Extensions used on Wikimedia/zh
- Extensions included in Canasta/zh
- Extensions available as Debian packages/zh
- Extensions included in Miraheze/zh
- Extensions included in MyWikis/zh
- Extensions included in Telepedia/zh
- Extensions included in Weird Gloop/zh
- Extensions included in wiki.gg/zh
