PMD scans source code in Java and other languages and looks for potential problems.




Java Versions

Supported Languages

Java JavaScript

Official Documentation

YAML Configuration


  • input:

    Patterns to include in execution and reports.

  • ignore:

    Patterns to exclude from execution and reports.

  • auto-fix:


    Note: Inspecode can auto-fix issues in Java source code only. Auto-fixing issues in JavaScript source code is not supported.

  • config-file:

    Alias of -rulesets option.

    If no configuration file is specified, Basic (for Java) and Basic Ecmascript (for JavaScript) will be used by default.

  • machine:

    • cpu:

      Amount of CPU. The default machine has 0.5 CPU with 1960 MiB RAM.

      Inspecode automatically specifies -threads option to PMD according to this value. For example, -threads 1 is specified by default (for 0.5 CPU), -threads 2 is specified for 1.1 CPU.

      In addition, Inspecode configures the maximum heap size of the Java virtual machine (JVM) through HEAPSIZE environment variable according to this value. Inspecode reserves 240 MiB RAM for system, and makes the rest of RAM available to JVM for heap allocation. For example, HEAPSIZE=1680m is exported by default (for 0.5 CPU), HEAPSIZE=5520m is exported for 1.5 CPU.

  • options:

    Below is the list of options that are supported:

       Specifies the classpath for libraries used by the source code. This is
       used by the type resolution. The platform specific path delimiter (":"
       on Linux, ";" on Windows) is used to separate the entries.
       Alternatively, a single 'file:' URL to a text file containing path
       elements on consecutive lines can be specified.
    -dir, -d
       Root directory for sources.
    -encoding, -e
       Specifies the character set encoding of the source code files PMD is
       reading (i.e., UTF-8).
       Default: UTF-8
       Path to a file containing a list of files to analyze.
    -minimumpriority, -min
       Rule priority threshold; rules with lower priority than configured here
       won't be used. Default is '5' which is the lowest priority.
       Default: Low
       Possible Values: [High, Medium High, Medium, Medium Low, Low]
       Disable the ruleset compatibility filter. The filter is active by default
       and tries automatically 'fix' old ruleset files with old rule names
       Default: false
    -rulesets, -R
       Comma separated list of ruleset names to use.
       Specifies the string that marks the a line which PMD should ignore;
       default is NOPMD.
       Default: NOPMD
  • thresholds:

    • num-issues:

      In addition to general severity levels, the following tool specific severity levels can be specified:

      • Change absolutely required (equivalent to general severity level critical)
      • Change highly recommended (equivalent to general severity level error)
      • Change recommended (equivalent to general severity level warning)
      • Change optional, Change highly optional (equivalent to general severity level info)
  • incremental:


    Note: The incremental analysis is disabled if any kinds of configuration files are changed. The files recognized as configuration files are as follows:

    • Classpath files:
      • Files specified to -auxclasspath option
    • File list files:
      • Files specified to -filelist option
    • Ruleset files:
      • Files specified in config-file field
      • Files specified to -rulesets, -R options
      • If none of the above ruleset files are found:
        • **/rulesets/*.xml, **/pmd.xml, **/*ruleset*.xml.
  • experimental:

    No tool specific experimental options are available.

YAML Examples

  • With default options:

        pmd: default
  • With enabling auto-fixing and default options:

        pmd: auto-fix
  • With custom machine:

            cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
  • With custom options:

            -minimumpriority: 1 # must be an integer
  • With a configuration file:

          config-file: ./my-pmd.xml

    The above configuration is equivalent to:

            -rulesets: ./my-pmd.xml

Configuration File Detection

If no configuration (ruleset) files are specified via config-file or options 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 PMD automatically via -rulesets option.

  • pmd.xml
  • *ruleset*.xml
  • rulesets/*.xml

Note: Inspecode ignores specific configuration files while searching. See Configuration > Tool Configuration > Field: config-file for detail.

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:

      config-file: ""

results matching ""

    No results matching ""