Skip to main content

PMD

Supported VersionLanguageWebsite
6.36.0Javahttps://pmd.github.io

PMD is a static analysis tool to detect issues about code style, security, performance, etc. It supports multiple programming languages but Sider supports only Java.

Getting Started#

To start using PMD, enable it in your repository settings.

Default Configuration for PMD#

Sider provides our recommended ruleset for PMD. This configuration is used when you do not have sider.yml in your repository. For more details, please visit Recommended Ruleset.

Configuration#

You can customize the analysis via sider.yml:

linter:  pmd_java:    target: src    rulesets:      - category/java/errorprone.xml      - path/to/custom-ruleset.xml    encoding: Shift_JIS    min_priority: 3
NameTypeDefault
root_dirstring-
dependenciesstring[], map[]-
targetstring.
rulesetsstring, string[](see below)
encodingstring(PMD's default)
min_prioritynumber(PMD's default)

target#

This option allows you to specify a directory to analyze.

alias: dir

rulesets#

This option allows you to specify predefined rulesets or your custom rulesets.

Here are the predefined rulesets:

For example, you can specify both:

linter:  pmd_java:    rulesets:      - category/java/security.xml      - your_pmd_custom_rules.xml

If the option is omitted, Sider uses our recommended ruleset.

You can configure predefined rules and writing your own rules via the XML configuration file. See the official documentation for more details.

encoding#

This option allows you to specify an encoding of your Java source code.

min_priority#

This option allows you to specify a rule priority threshold. Rules with lower priority than the specified value will not be used.