wp-jazz/coding-standards

适用于所有WP Jazz项目的WordPress编码标准。

安装次数: 600

依赖关系: 1

建议者: 0

安全性: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

类型:phpcodesniffer-standard

dev-main / 1.x-dev 2023-03-15 23:09 UTC

This package is auto-updated.

Last update: 2024-09-16 02:40:33 UTC


README

适用于所有WP Jazz项目的WordPress编码标准。

提供一组规则集和扩展,用于

这些编码标准基于并扩展了Human Made编码标准

安装

composer require --dev wp-jazz/coding-standards

此包将安装支持的PHPCS、PHPStan和Psalm版本。

有关样板配置文件的更多信息,请参阅示例目录。

使用PHPCS

我们的PHPCS规则集扩展了PHP和WordPress的Human Made编码标准。

运行以下命令以运行标准检查

./vendor/bin/phpcs --standard=vendor/wp-jazz/coding-standards .

或者在您的phpcs.xml中包含以下内容

<!-- Use WP Jazz Coding Standards -->
<rule ref="Jazz" />

PHPCS规则集基于

并添加自定义、排除和添加以匹配我们的风格。

使用PHPStan

运行以下命令以运行静态分析

./vendor/bin/phpstan analyze -c vendor/szepeviktor/phpstan-wordpress/extension.neon .

使用phpstan/extension-installer自动找到PHPStan

composer require --dev phpstan/extension-installer

或者手动将其包含在您的phpstan.neon

includes:
  - vendor/szepeviktor/phpstan-wordpress/extension.neon

有关配置PHPStan的更多信息,请参阅Viktor Szépe的szepeviktor/phpstan-wordpress包。

使用Psalm

./vendor/bin/psalm -c vendor/wp-jazz/coding-standards/psalm.xml.dist .

使用Psalm启用插件

./vendor/bin/psalm-plugin enable humanmade/psalm-plugin-wordpress

或者手动将其包含在您的psalm.xml

<plugins>
  <pluginClass class="PsalmWordPress\Plugin" />
</plugins>

有关配置Psalm的更多信息,请参阅Human Made的humanmade/psalm-plugin-wordpress包。

使用ESLint

我们推荐使用Human Made的JavaScript编码标准,该标准使用ESLint

npx install-peerdeps --dev @humanmade/eslint-config@latest

有关配置ESLint的更多信息,请参阅@humanmade/eslint-config包的README。

使用Stylelint

我们推荐使用Human Made的CSS和SCSS编码标准,该标准使用Stylelint

npm install --save-dev stylelint @humanmade/stylelint-config

有关配置Stylelint的更多信息,请参阅@humanmade/stylelint包的README。