News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Manuel Pichler's Blog:
Howto create custom rule sets for PHPMD
April 09, 2010 @ 13:19:25

If you've been using the PHP Mess Detector (PHPMD) to help clean up problem areas in your applications, but have needed more than just the basic rules that it comes with, you're in luck. Manuel Pichler has put together a new post for his blog about creating custom rules sets for the tool.

PHPMD can be seen as an one level down/low level equivalent to PHP_CodeSniffer. It is a simple command line tool that can be used to check your application's source code for possible bugs, suboptimal or overcomplicated code. The current release of PHPMD ships with three default rule sets.

The first deals with code size, the second checks for unused variables and the like and the third looks at naming conventions. He shows how to take one of the structures from one of these three and create a new rule. For his example it's a measurement of cyclomatic complexity. He also shows you how to exclude certain rules that might come in another set so you don't have to completely redefine to use pre-existing rules.

The latest release of PHPMD can be pulled from pear.phpmd.org or from its github repository.

1 comment voice your opinion now!
phpmd custom rule set tutorial


blog comments powered by Disqus

Similar Posts

Court Ewing's Blog: Organize Your Project like a Pro with PHP Namespaces

SitePoint PHP Blog: Introduction to Gearman - Multitasking in PHP

ProDevTips Blog: Fluent Arrays and Strings in PHP - Adding JSON and more

BillS' IIS Blog: How to install FastCGI and PHP on IIS7 Beta 3 (Video)

Lorna Mitchell: Beanstalk, Pheanstalk and Priorities


Community Events

Don't see your event here?
Let us know!


api composer symfony2 example performance conference series interview introduction laravel framework application community part2 podcast php7 opinion language release configure

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework