🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# C.73 PHPMDTask This task runs [phpmd](http://phpmd.org), a Project Mess Detector (PMD) for PHP Code. You need an installed version of this software to use this task. **NB:** if you have installed the PHPMD Phar file, make sure you set the `pharLocation` attribute! Table C.97:聽Attributes NameTypeDescriptionDefaultRequired`file``String`Path to source file or pathn/aOnly when there are *no* nested `fileset` elements`rulesets``String`Sets the rulesets used for analyzing the source codecodesize, unusedcodeNo`minimumPriority``Integer`The minimum priority for rules to load.5No`allowedFileExtensions``String`Comma-separated list of valid file extensions (without dot) for analyzed files.phpNo`ignorePatterns``String`Comma-separated list of directory patterns to ignore.`.git`, `.svn`, `CVS`, `.bzr`, `.hg`No`format``String`The format for the report when no nested formatter is used.textNo`pharlocation``String`Location of the PHPMD Phar file.n/aNo`cachefile``String`If set, enables writing of last-modified times to `cachefile`, to speed up processing of files that rarely changenoneNo C.73.1 Example `<phpmd file="path/to/source.php"/>`Checking syntax of one particular source file. Sending Text-Report to STDOUT. ``` <phpmd file="path/to/source"> <formatter type="html" outfile="reports/pmd.html"/> </phpmd> ``` Checking syntax of source files in the given path. ``` <phpmd> <fileset dir="${builddir}"> <include name="apps/**/*.php" /> <include name="lib/de/**/*.php" /> </fileset> <formatter type="xml" outfile="reports/pmd.xml"/> </phpmd> ``` Checking syntax of source files in the fileset pathes. C.73.2 Supported Nested Tags - `fileset` This nested tag is required when the `file` attribute is not set. - `formatter` The results of the analysis can be printed in different formats. Output will always be sent to STDOUT, unless you set the `usefile` attribute to `true` and set an filename in the `outfile` attribute. Table C.98:聽Attributes NameTypeDescriptionDefaultRequired`type``String`The output format. Accepts the same values as the `format` attribute (`xml`, `html`, `text`).n/aYes`usefile``Boolean`Boolean that determines whether output should be sent to a file.`true`No`outfile``String`Path to write output file to.n/aYes