[doc] add minimum language version, add property for tests

This commit is contained in:
Andreas Dangel
2017-08-12 11:55:40 +02:00
parent f1630932f2
commit a4416a78e2
3 changed files with 23 additions and 1 deletions

View File

@ -286,6 +286,12 @@ public class RuleDocGenerator {
lines.add("**Priority:** " + rule.getPriority() + " (" + rule.getPriority().getPriority() + ")");
lines.add("");
if (rule.getMinimumLanguageVersion() != null) {
lines.add("**Minimum Language Version:** "
+ rule.getLanguage().getName() + " " + rule.getMinimumLanguageVersion().getVersion());
lines.add("");
}
lines.add(StringUtils.stripToEmpty(rule.getDescription()));
lines.add("");

View File

@ -51,6 +51,12 @@ public class JumbledIncrementerRule1 {
}
```
**This rule has the following properties:**
|Name|Default Value|Description|
|----|-------------|-----------|
|sampleAdditionalProperty|the value|This is a additional property for tests|
## MovedRule
<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f;">Deprecated</span>
@ -92,6 +98,8 @@ public class JumbledIncrementerRule1 {
**Priority:** Medium (3)
**Minimum Language Version:** Java 1.5
Override both public boolean Object.equals(Object other), and public int Object.hashCode(), or override neither. Even if you are inheriting a hashCode() from a parent class, consider implementing hashCode and explicitly delegating to your superclass.
**This rule is defined by the following Java class:** [net.sourceforge.pmd.lang.java.rule.basic.OverrideBothEqualsAndHashcodeRule](https://github.com/pmd/pmd/blob/master/net/sourceforge/pmd/lang/java/rule/basic/OverrideBothEqualsAndHashcodeRule.java)
@ -155,3 +163,9 @@ public class JumbledIncrementerRule1 {
}
}
```
**This rule has the following properties:**
|Name|Default Value|Description|
|----|-------------|-----------|
|sampleAdditionalProperty|the value|This is a additional property for tests|

View File

@ -13,7 +13,8 @@ Sample ruleset to test rule doc generation.
since="0.4"
message="Ensure you override both equals() and hashCode()"
class="net.sourceforge.pmd.lang.java.rule.basic.OverrideBothEqualsAndHashcodeRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_sample.html#overridebothequalsandhashcode">
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_sample.html#overridebothequalsandhashcode"
minimumLanguageVersion="1.5">
<description>
Override both public boolean Object.equals(Object other), and public int Object.hashCode(), or override neither. Even if you are inheriting a hashCode() from a parent class, consider implementing hashCode and explicitly delegating to your superclass.
</description>
@ -67,6 +68,7 @@ Avoid jumbled loop incrementers - its usually a mistake, and is confusing even i
]]>
</value>
</property>
<property name="sampleAdditionalProperty" type="String" description="This is a additional property for tests" value="the value" />
</properties>
<example>
<![CDATA[