2018-11-26 12:39:32 +00:00
|
|
|
# phpmd
|
|
|
|
|
2024-02-14 20:25:13 +00:00
|
|
|
> PHP mess detector: check for common potential problems.
|
2019-05-29 14:53:49 +01:00
|
|
|
> More information: <https://github.com/phpmd/phpmd>.
|
2018-11-26 12:39:32 +00:00
|
|
|
|
|
|
|
- Display a list of available rulesets and formats:
|
|
|
|
|
|
|
|
`phpmd`
|
|
|
|
|
|
|
|
- Scan a file or directory for problems using comma-separated rulesets:
|
|
|
|
|
2024-01-31 03:55:19 +00:00
|
|
|
`phpmd {{path/to/file_or_directory}} {{xml|text|html}} {{ruleset1,ruleset2,...}}`
|
2018-11-26 12:39:32 +00:00
|
|
|
|
|
|
|
- Specify the minimum priority threshold for rules:
|
|
|
|
|
2024-01-31 03:55:19 +00:00
|
|
|
`phpmd {{path/to/file_or_directory}} {{xml|text|html}} {{ruleset1,ruleset2,...}} --minimumpriority {{priority}}`
|
2018-11-26 12:39:32 +00:00
|
|
|
|
|
|
|
- Include only the specified extensions in analysis:
|
|
|
|
|
2024-01-31 03:55:19 +00:00
|
|
|
`phpmd {{path/to/file_or_directory}} {{xml|text|html}} {{ruleset1,ruleset2,...}} --suffixes {{extensions}}`
|
2018-11-26 12:39:32 +00:00
|
|
|
|
|
|
|
- Exclude the specified comma-separated directories:
|
|
|
|
|
2024-01-31 03:55:19 +00:00
|
|
|
`phpmd {{path/to/file_or_directory1,path/to/file_or_directory2,...}} {{xml|text|html}} {{ruleset1,ruleset2,...}} --exclude {{directory_patterns}}`
|
2018-11-26 12:39:32 +00:00
|
|
|
|
2022-12-04 07:53:34 +00:00
|
|
|
- Output the results to a file instead of `stdout`:
|
2018-11-26 12:39:32 +00:00
|
|
|
|
2024-01-31 03:55:19 +00:00
|
|
|
`phpmd {{path/to/file_or_directory}} {{xml|text|html}} {{ruleset1,ruleset2,...}} --reportfile {{path/to/report_file}}`
|
2018-11-26 12:39:32 +00:00
|
|
|
|
2018-12-12 10:38:09 +00:00
|
|
|
- Ignore the use of warning-suppressive PHPDoc comments:
|
2018-11-26 12:39:32 +00:00
|
|
|
|
2024-01-31 03:55:19 +00:00
|
|
|
`phpmd {{path/to/file_or_directory}} {{xml|text|html}} {{ruleset1,ruleset2,...}} --strict`
|