PHPMD 0.2.3 released with @SuppressWarnings support and new rule set.

We are proud to announce the 0.2.3 release of the PHP Mess Detector, a tool that takes source code and performs various tests to calculate various quality aspects from it. The measured values are a good starting point for future improvements. This release contains some new features, for example support for the @SuppressWarnings annotation, that allows you to exclude single methods or complete classes from PHPMD's analyzing process. This annotation can be used to suppress a single rule, a group of rules or PHPMD at all.

/**
 * Suppress all PHPMD warnings for this class.
 *
 * @SuppressWarnings(PHPMD)
 */
class PHPMD_SuppressAll 
{
}

class  PHPMD_SuppressOnMethod
{
    /**
     * Do not warn about the unused parameter $bar.
     *
     * @SuppressWarnings(PHPMD.UnusedFormatParameter)
     */
    public function foo($bar)
    {
    }
}

Beside several bugfixes this release comes with a new set of rules that check the naming of methods, variables etc. against common coding conventions and best practices.

  • Fixed #6: PHP Tokenizer required but no error when installing.
  • Fixed #7: UnusedLocalVariable ruleset incorrectly flags variables as unused when used inside double quoted string. Fixed in svn revision #187.
  • Implemented #9: Add support for "Suppress warnings" annotations. Implemented in svn revision #200.
  • Implemented #10: Support for exclude element in rule-set files added. Implemented in svn revision #189.
  • Implemented #13: Implement naming rules, e.g. short variables, parameter etc.
  • Fixed #14: ExcessivePublicCount rule should utilize PHP_Depend's cis metric. Fixed in svn revision #203.
  • Fixed #15: ExcessivePublicCount rule is never used. Fixed in svn revision #202.

You can get the latest PHPMD version from its PEAR channel: pear.phpmd.org

mapi@arwen ~ $ pear channel-discover pear.pdepend.org
mapi@arwen ~ $ pear channel-discover pear.phpmd.org
mapi@arwen ~ $ pear install --alldeps phpmd/PHP_PMD-alpha

Or from our github repository:

mapi@arwen ~ $ git clone git://github.com/manuelpichler/phpmd.git