[doc] Mention rule categories
This commit is contained in:
@ -1,18 +1,43 @@
|
|||||||
---
|
---
|
||||||
title: Understanding Rulesets
|
title: Understanding Rulesets
|
||||||
permalink: pmd_userdocs_understanding_rulesets.html
|
permalink: pmd_userdocs_understanding_rulesets.html
|
||||||
summary: Rulesets are collections of rules
|
summary: Rules belong to categories and rulesets are custom collections of rules
|
||||||
last_updated: September 2017
|
last_updated: November 2017
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Rule Categories
|
||||||
|
|
||||||
|
Since PMD 6.0.0, all provided built-in rules are sorted into one of eight categories:
|
||||||
|
|
||||||
|
1. **Best Practices**: These are rules which enforce generally accepted best practices.
|
||||||
|
2. **Code Style**: These rules enforce a specific coding style.
|
||||||
|
3. **Design**: Rules that help you discover design issues.
|
||||||
|
4. **Documentation**: These rules are related to code documentation.
|
||||||
|
5. **Error Prone**: Rules to detect constructs that are either broken, extremely confusing or prone to runtime errors.
|
||||||
|
6. **Multithreading**: These are rules that flag issues when dealing with multiple threads of execution.
|
||||||
|
7. **Performance**: Rules that flag suboptimal code.
|
||||||
|
8. **Security**: Rules that flag potential security flaws.
|
||||||
|
|
||||||
|
These categories help you to find rules and figure out the relevance and impact for your project.
|
||||||
|
|
||||||
|
You can find the available rules under "Rule Reference" in the menu. Each languages has its own rule
|
||||||
|
index, e.g. [Java Rules](pmd_rules_java.html) or [JavaScript Rules](pmd_rules_ecmascript.html).
|
||||||
|
|
||||||
|
{% include note.html content="Not all supported languages provide rules in all categories yet. " %}
|
||||||
|
|
||||||
|
|
||||||
|
## Rulesets
|
||||||
|
|
||||||
There are two major use cases:
|
There are two major use cases:
|
||||||
|
|
||||||
1. When defining a new rule, the rule needs to be defined in a ruleset. PMD's built-in rules
|
1. When defining a new rule, the rule needs to be defined in a ruleset. PMD's built-in rules
|
||||||
are defined in special rulesets from which the rule reference documentation is generated,
|
are defined in special rulesets which form the eight categories mentioned above.
|
||||||
|
From these rulesets the rule reference documentation is generated,
|
||||||
see [Java Rules](pmd_rules_java.html) for an example.
|
see [Java Rules](pmd_rules_java.html) for an example.
|
||||||
|
|
||||||
Similar rules are grouped together into the same category, like [Java Best Practices](pmd_rules_java_bestpractices.html)
|
Similar rules are grouped together into the same category, like [Java Best Practices](pmd_rules_java_bestpractices.html)
|
||||||
which contains rules which enforce generally accepted best practices.
|
which contains rules which enforce generally accepted best practices. Each category uses its own
|
||||||
|
ruleset file.
|
||||||
|
|
||||||
2. When executing PMD, you need to tell, which rules should be executed. You could directly point to the
|
2. When executing PMD, you need to tell, which rules should be executed. You could directly point to the
|
||||||
built-in rulesets, but then you might be overwhelmed by the found violations. As described
|
built-in rulesets, but then you might be overwhelmed by the found violations. As described
|
||||||
|
Reference in New Issue
Block a user