PMD
Supported Version | Language | Website |
---|---|---|
6.32.0 | Java | https://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.
Configuration
You can customize the analysis via sider.yml
:
linter:
pmd_java:
dir: src
rulesets:
- category/java/errorprone.xml
- path/to/custom-ruleset.xml
encoding: Shift_JIS
min_priority: 3
Name | Type | Default |
---|---|---|
root_dir | string | - |
jvm_deps | string[][] | [] |
dir | string | . |
rulesets | string , string[] | (see below) |
encoding | string | (PMD's default) |
min_priority | number | (PMD's default) |
dir
This option allows you to specify a directory to analyze.
rulesets
This option allows you to specify predefined rulesets or your custom rulesets.
Here are the predefined rulesets:
category/java/bestpractices.xml
category/java/codestyle.xml
category/java/design.xml
category/java/documentation.xml
category/java/errorprone.xml
category/java/multithreading.xml
category/java/performance.xml
category/java/security.xml
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 the default configuration.
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.