Guard::PHPMD

This guard will run PHP Mess Detector for you automatically when files are modified.

Install

Make sure you have guard and phpmd installed.

Install the gem with:

gem install guard-phpmd

Or add it to your Gemfile:

gem 'guard-phpmd'

And then add a basic setup to your Guardfile:

guard init phpmd

Options

  • :path # default => "."

Set the working directory (useful when using relative paths used in the rules file)

  • :rules # default => "pmd-rules.xml"

Path to the rules file.

  • :executable # default => "phpmd"

Specify the path to the phpmd executable. Useful when installing phpmd with Composer.

Example

guard 'phpmd', :executable => 'path/to/PHPMD', :rules => 'path/to/pmd-rules.xml' do
    watch(%r{.*\.php$})
end