wpdesk/wp-code-sniffer

Library for WP Desk Coding Standards in plugins.

Maintainers

Package info

github.com/WP-Desk/wp-code-sniffer

Homepage

Type:phpcodesniffer-standard

pkg:composer/wpdesk/wp-code-sniffer

Transparency log

Statistics

Installs: 60 095

Dependents: 19

Suggesters: 0

Stars: 0

1.3.2 2025-02-03 08:17 UTC

README

PHPCS ruleset for WP Desk WordPress plugins.

It builds on WordPress Coding Standards and PHPCompatibilityWP, with additional WP Desk conventions and WooCommerce-aware configuration.

Installation

composer require --dev wpdesk/wp-code-sniffer

Usage

Copy the provided example files into your project:

cp vendor/wpdesk/wp-code-sniffer/phpcs.xml.dist phpcs.xml.dist
cp vendor/wpdesk/wp-code-sniffer/.editorconfig .editorconfig

Adjust the values in phpcs.xml.dist:

  • text_domain
  • minimum_wp_version
  • testVersion

Then run:

vendor/bin/phpcs

The example configuration scans src and templates by default.

Ruleset

The included standard is:

<rule ref="WPDeskPlugin"/>

It includes WordPress rules, PHP compatibility checks, short array syntax, selected WooCommerce capabilities/functions, and excludes common generated or dependency directories.

PhpStorm

Configure PHP_CodeSniffer in:

Settings → Languages & Frameworks → PHP → Quality Tools

Then enable:

Settings → Inspections → Quality Tools → PHP_CodeSniffer

Use your project phpcs.xml.dist as the custom coding standard.