jakariawpxpo / wpguard
RuboCop/Brakeman-style checker for WordPress plugins: WordPress.org guideline candidates, PHPCS (WPCS) and Plugin Check in one report.
Requires
- php: >=7.4
Requires (Dev)
None
Suggests
- ext-zip: Needed to scan a release .zip
- squizlabs/php_codesniffer: Needed for the PHPCS step
- wp-coding-standards/wpcs: WordPress Coding Standards for the PHPCS step
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-10-21 21:06:50 UTC
README
RuboCop/Brakeman-style checker for WordPress plugins, written in PHP. It combines:
- wpguard rules: WordPress.org plugin guideline candidates (remote assets, tracking, trialware gates, public REST routes, unescaped output, readme and header problems, package files, and more). Run
wpguard --rulesfor the list. - PHPCS + WordPress Coding Standards if
phpcsis installed, using the plugin'sphpcs.xml[.dist]when present. - Plugin Check (
--pcp), as rawwp plugin checkoutput.
Every finding prints file:line:col and the code line with one line of context. Findings are review candidates, not verdicts.
wpguard # scan current directory
wpguard path/to/plugin
wpguard plugin.zip # scan a release ZIP
wpguard --strict # PHPCS with --ignore-annotations
wpguard --format=json # for CI
wpguard --fail-on=medium # CI exit code
Suppress a reviewed line with // wpguard-ignore: WG-RULE-ID (same line or line above), or use .wpguard.json:
{"ignore_rules":["WG-IFRAME"],"ignore_paths":["tests/"]}
Install
git clone https://github.com/jakariawpxpo/wpguard.git
ln -s "$PWD/wpguard/bin/wpguard" ~/.local/bin/wpguard
Or with Composer, once published to Packagist: composer global require jakariawpxpo/wpguard.
Needs PHP 7.4+ (the zip extension for ZIP input). Not an official WordPress.org tool; a clean run is not an approval.
Limits: line-based regex rules, so multi-line constructs are missed and some hits are false positives. Trialware, service-substance and readme-versus-code parity still need human review.