ggrible/coding-standards

The WordPress coding standards applied to all WP Jazz projects.

Installs: 20

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:phpcodesniffer-standard

dev-main / 1.x-dev 2023-12-19 17:21 UTC

This package is not auto-updated.

Last update: 2024-11-20 19:36:50 UTC


README

The WordPress coding standards applied to all WP Jazz projects.

Provides a set of rulesets and extensions for:

These coding standards are heavily based on, and extend, Human Made Coding Standards.

Installation

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

This package will install supported versions of PHPCS, PHPStan, and Psalm.

See the examples directory for boilerplate configuration files.

Using PHPCS

Our PHPCS ruleset extends the Human Made coding standards for PHP and WordPress.

Run the following command to run the standards checks:

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

Or include the following in your phpcs.xml:

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

The PHPCS ruleset is based upon:

With customisations, exclusions, and additions to match our style.

Using PHPStan

Run the following command to run the static analysis:

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

Make PHPStan find it automatically using phpstan/extension-installer:

composer require --dev phpstan/extension-installer

Or manually include it in your phpstan.neon:

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

See the szepeviktor/phpstan-wordpress package, by Viktor Szépe, for more information on configuring PHPStan.

Using Psalm

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

Use Psalm to enable the plugin:

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

Or manually include it in your psalm.xml:

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

See the humanmade/psalm-plugin-wordpress package, by Human Made, for more information on configuring Psalm.

Using ESLint

We recommend using the Human Made coding standards for JavaScript which uses ESLint.

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

See the @humanmade/eslint-config package README for more information on configuring ESLint.

Using Stylelint

We recommend using the Human Made coding standards for CSS and SCSS which uses Stylelint.

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

See the @humanmade/stylelint package README for more information on configuring Stylelint.