scrutinizer-ci / phpmd

PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly frontend application for the raw metrics stream measured by PHP Depend.
http://phpmd.org
Other
0 stars 2 forks source link

================== Command line usage

Type phpmd [filename|directory] [report format] [ruleset file], i.e: ::

mapi@arwen ~ $ phpmd PHP/Depend/DbusUI/ xml rulesets/codesize.xml <?xml version="1.0" encoding="UTF-8" ?>

This class has too many methods, consider refactoring it.

You can pass a file name or a directory name containing PHP source code to PHPMD.

The PHPMD PEAR or Phar distribution includes the rule set files inside its archive, even if the "rulesets/codesize.xml" parameter above looks like a filesystem reference.

Command line options

Using multiple rule sets


PHPMD uses so called rule sets that configure/define a set of rules which will 
be applied against the source under test. The default distribution of PHPMD is
already shipped with a few default sets, that can be used out-of-box. You can
call PHPMD's cli tool with a set's name to apply this configuration: ::

  ~ $ phpmd /path/to/source text codesize

But what if you would like to apply more than one rule set against your source?
You can also pass a list of rule set names, separated by comma to PHPMD's cli
tool: ::

  ~ $ phpmd /path/to/source text codesize,unusedcode,naming

You can also mix custom `rule set files`__ with build-in rule sets: ::

  ~ $ phpmd /path/to/source text codesize,/my/rules.xml

__ /documentation/creating-a-ruleset.html

That's it. With this behavior you can specify you own combination of rule sets
that will check the source code.

Using multiple source files and folders

PHPMD also allowes you to specify multiple source directories in case you want to create one output for certain parts of your code ::

~ $ phpmd /path/to/code,index.php,/another/place/with/code text codesize

Exit codes

PHPMD's command line tool currently defines three different exit codes.

Renderers

At the moment PHPMD comes with the following three renderers: