PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.
Patterns to include in reports.
Note: The input patterns are not applied when running PHPMD since PHPMD considers dependency between files and filtering the input files affects how PHPMD detects issues. Therefore, the files excluded by the patterns are always processed and you may even see logs related to the excluded files in the job console. However, Inspecode eventually ignores any issues detected on the excluded files when generating job reports.
If you need to let PHPMD ignore particular files, consider specifying
Patterns to exclude from reports.
Note: Just like
input:, the ignore patterns are not applied when running PHPMD.
A ruleset filename or a comma-separated string of ruleset filenames.
cleancode,codesize,controversial,design,naming,unusedcode will be used by default.
Amount of CPU. The default machine has
0.25 CPU with
960 MiB RAM.
Inspecode automatically specifies
-d memory_limit=<limit> to PHP in order to configure the maximum amount of memory that PHPMD is allowed to allocate according to this value.
240 MiB RAM for system, and makes the rest of RAM available to PHPMD for memory allocation.
-d memory_limit=720M is specified by default (for
-d memory_limit=5520M is specified for
Below is the list of options that are supported:
--minimumpriority: rule priority threshold; rules with lower priority than this will not be used --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 --strict: also report those nodes with a @SuppressWarnings annotation
In addition to general severity levels, the following tool specific severity levels can be specified:
Change absolutely required(equivalent to general severity level
Change highly recommended(equivalent to general severity level
Change recommended(equivalent to general severity level
Change highly optional(equivalent to general severity level
Note: The incremental analysis cannot be supported for PHPMD. This is because PHPMD analyzes source code with considering dependency between files and the results on unchanged files can be affected by changed files.
With default options:
inspecode: phpmd: default
With custom machine:
inspecode: phpmd: machine: cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
With custom options:
inspecode: phpmd: options: --suffixes: php,phtml
With a configuration (ruleset) file:
inspecode: phpmd: config-file: ./my-ruleset.xml
If no configuration (ruleset) files are specified via
config-file field, Inspecode walks the file tree in lexical order in your repository to find configuration files matching the following patterns and specifies the files placed in the same directory as the first found one to PHPMD automatically.
Note: Inspecode ignores specific configuration files while searching. See Configuration > Tool Configuration > Field:
If the configuration file detected by Inspecode is not the one you want to use or you do not want to use any configuration files, you can disable Inspecode from detecting configuration files by explicitly setting an empty string to
config-file field like below:
inspecode: phpmd: config-file: ""