Skip to main content
  1. All Posts/

wordpress-plugin-analyzer

Tools Open Source PHP WordPress
** THIS IS A WORK IN PROGRESS, NOT READY YET, but feel free to poke **

Place the WordPress folder in your CodeSniffer/Standards folder.

This requires PHP CodeSniffer:
http://pear.php.net/package/PHP_CodeSniffer/

And ant
http://ant.apache.org/bindownload.cgi

And RIPS
http://sourceforge.net/projects/rips-scanner/

# Check out a local copy of wordpress-plugin-anazlyer
cd ~
git clone https://github.com/kurtpayne/wordpress-plugin-analzyer.git

# Install to CodeSniffer
ln -s wordpress-plugin-analyzer/CodeSniffer/WordPress /usr/lib/php/pear/PHP/CodeSniffer/Standards/WordPress

# Run with ant
mkdir -p /tmp/plugin
cp myplugin.zip /tmp/plugin.zip
ant -Dbuild_src=/tmp/plugin -buildfile ant/build.xml -Drips=/path/to/rips/ -Drun_cpd=true -Drun_jslint=true -Drun_docs=true -Drun_phplint=true -Drun_pmd=true -Drun_rips=true -Drun_syntax=true -Drun_readme_validator=true -Drun_pci=true -Drun_csslint=true

# Now look around in /tmp/plugin/logs
cd /tmp/plugin/logs


THANKS:
 * Original WordPress CodeSniffer standards by John
 * http://urbangiraffe.com/articles/wordpress-codesniffer-standard/
 * RIPS - http://www.php-security.org/
 * CodeSniffer - http://pear.php.net/package/PHP_CodeSniffer/redirected
 * Google Closure - http://code.google.com/p/closure-linter/
 * PHP - http://php.net/
 * WordPress - http://wordpress.org/
 * PHP CPD - https://github.com/sebastianbergmann/phpcpd
 * PHP PMD - http://phpmd.org/documentation/index.html
 * PHP CompatInfo - http://pear.php.net/package/PHP_CompatInfo/
 * CSS Lint - http://csslint.net/
 

TODO:

 [X] Submit readme.txt (if found) to http://wordpress.org/extend/plugins/about/validator/

 [X] Validate phpdoc rules (probaby doclbox for performance)
 
 [X] Validate with gjslint
 
 [ ] Web front-end

 [X] Validate with csslint https://github.com/stubbornella/csslint/wiki/Command-line-interface

 [X] Run through RIPS scanner

 [X] Run through phpmd

 [X] Run through php compat info

 [X] Run through php -l
 
 [X] Turn into an ant project
 
 [X] Run through php copy paste detector