PHPMD(1)
π PHPMD π
okay bestie, welcome to the PHPMD manual page β it's the command line interface for PHPMD, and yes we are gonna get through the whole thing together, no skimming, no skipping. grab a boba, we're doing this. π§β¨
πΈ NAME πΈ
PHPMD β it's literally the PHPMD command line interface, that's the whole vibe π
β¨ DESCRIPTION β¨
so. here's the tea. π« you have three mandatory arguments and you cannot skip a single one of them, they're the main characters:
- a php source code filename or directory. and she's flexible!! it can be a comma-separated string, a glob pattern, or literally just
-to scan stdin π - a report format
- a ruleset filename, or a comma-separated string of ruleset filenames
put together it looks like this, iconic behavior:
phpmd /path/to/source format ruleset
π the formats you can pick from
ansi, baseline, checkstyle, github, gitlab, html, json, sarif, text, xml
π¦ the rulesets you can pick from
cleancode, codesize, controversial, design, naming, unusedcode
π OPTIONS π
these are the optional arguments, and the thing about them is they go after the mandatory ones. mandatory first, optional after, that's the order, periodt.
--verbose,-v,-vv,-vvvβ show debug information. the more v's, the more you're gonna see, iykyk π--minimum-priorityβ rule priority threshold; any rules with a lower priority than this will not be used--report-fileβ send report output to a file; default is STDOUT--error-fileβ send errors (other than reported violations) output to a file; default is STDERR--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/*.phpor*src/foo/*--strictβ also report those nodes with a@SuppressWarningsannotation. no hiding bestie π--ignore-errors-on-exitβ will exit with a zero code, even on error--ignore-violations-on-exitβ will exit with a zero code, even if any violations are found--cacheβ will enable the result cache--cache-fileβ instead of the default.phpmd.result-cache.phpit will use this file as the result cache file path--cache-strategyβ sets the caching strategy to determine if a file is still fresh. eithercontentto base it on the file contents, ortimestampto base it on the file modified timestamp--generate-baselineβ will generate aphpmd.baseline.xmlnext to the first ruleset file location--update-baselineβ will remove any non-existing violations from thephpmd.baseline.xml--baseline-fileβ a custom location of the baseline file--colorβ enable color in output π (yes it's giving aesthetic, we love that for us)--extra-line-in-excerptβ specify how many extra lines are added to a code snippet inhtmlformat--β explicit argument separator: anything after--will be read as an argument even if it starts with-or matches the name of an option. it's the "no seriously, this one's a value not a flag" escape hatch π₯
real talk though: that last one? chef's kiss. anything after--gets treated as a plain argument, even if it starts with-or even if it's literally spelled like one of the options above. so if your filename is out here looking like a flag, this is how you tell phpmd to chill and just read it as-is. π
that's the whole page bestie, you ate that π
this page was brought to you by PHPMD 2.15.0, dated December 2023 β mwah, love u, go lint something ππβ¨
π¦ where this page comes from
- ubuntu noble: phpmd 2.15.0-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms