LinuxCommandLibrary

phpmd

phpmd

TLDR

Display a list of available rulesets and formats

$ phpmd
copy


Scan a file or directory for problems using comma-separated rulesets
$ phpmd [path/to/file_or_directory] [xml|text|html] [rulesets]
copy


Specify the minimum priority threshold for rules
$ phpmd [path/to/file_or_directory] [xml|text|html] [rulesets] --minimumpriority [priority]
copy


Include only the specified extensions in analysis
$ phpmd [path/to/file_or_directory] [xml|text|html] [rulesets] --suffixes [extensions]
copy


Exclude the specified comma-separated directories
$ phpmd [path/to/file_or_directory] [xml|text|html] [rulesets] --exclude [directory_patterns]
copy


Output the results to a file instead of stdout
$ phpmd [path/to/file_or_directory] [xml|text|html] [rulesets] --reportfile [path/to/report_file]
copy


Ignore the use of warning-suppressive PHPDoc comments
$ phpmd [path/to/file_or_directory] [xml|text|html] [rulesets] --strict
copy

DESCRIPTION

Mandatory arguments: 1) A php source code filename or directory. Can be a comma-separated string 2) A report format 3) A ruleset filename or a comma-separated string of rulesetfilenames

Example: phpmd /path/to/source format ruleset

Available formats: ansi, html, json, text, xml. Available rulesets: cleancode, codesize, controversial, design, naming, unusedcode.

Optional arguments that may be put after the mandatory arguments: --minimumpriority: rule priority threshold; rules with lower priority than this will not be used --reportfile: send report output to a file; default to STDOUT --suffixes: comma-separated string of valid source code filename extensions, e.g. php,phtml --exclude: comma-separated string of patterns that are used to ignore directories. Use asterisks to exclude by pattern. For example *src/foo/*.php or *src/foo/* --strict: also report those nodes with a @SuppressWarnings annotation --ignore-violations-on-exit: will exit with a zero code, even if any violations are found

Copied to clipboard