[doc] CommentRequired - doc changed behavior

This commit is contained in:
Andreas Dangel
2023-04-27 20:37:54 +02:00
parent daf574a888
commit 157cac9218
3 changed files with 41 additions and 0 deletions

View File

@ -278,6 +278,12 @@ Contributors: [Lucas Soncini](https://github.com/lsoncini) (@lsoncini),
* {% rule java/documentation/CommentContent %}: The properties `caseSensitive` and `disallowedTerms` are removed. The
new property `fobiddenRegex` can be used now to define the disallowed terms with a single regular
expression.
* {% rule java/documentation/CommentRequired %}:
* Overridden methods are now detected even without the `@Override`
annotation. This is relevant for the property `methodWithOverrideCommentRequirement`.
See also [pull request #3757](https://github.com/pmd/pmd/pull/3757).
* Elements in annotation types are now detected as well. This might lead to an increased number of violations
for missing public method comments.
* {% rule java/documentation/CommentSize %}: When determining the line-length of a comment, the leading comment
prefix markers (e.g. `*` or `//`) are ignored and don't add up to the line-length.
See also [pull request #4369](https://github.com/pmd/pmd/pull/4369).

View File

@ -613,6 +613,12 @@ Related issue: [[core] Explicitly name all language versions (#4120)](https://gi
* {% rule java/documentation/CommentContent %}: The properties `caseSensitive` and `disallowedTerms` are removed. The
new property `fobiddenRegex` can be used now to define the disallowed terms with a single regular
expression.
* {% rule java/documentation/CommentRequired %}:
* Overridden methods are now detected even without the `@Override`
annotation. This is relevant for the property `methodWithOverrideCommentRequirement`.
See also [pull request #3757](https://github.com/pmd/pmd/pull/3757).
* Elements in annotation types are now detected as well. This might lead to an increased number of violations
for missing public method comments.
* {% rule java/documentation/CommentSize %}: When determining the line-length of a comment, the leading comment
prefix markers (e.g. `*` or `//`) are ignored and don't add up to the line-length.
See also [pull request #4369](https://github.com/pmd/pmd/pull/4369).

View File

@ -532,4 +532,33 @@ public class CommentRequirement {}
public class CommentRequirement {}
]]></code>
</test-code>
<test-code>
<description>Method overridden without @Override (#3123)</description>
<rule-property name="methodWithOverrideCommentRequirement">Required</rule-property>
<expected-problems>1</expected-problems>
<expected-linenumbers>4</expected-linenumbers>
<code><![CDATA[
/** Comment */
public class CommentRequirement {
//no @Override annotation
public String toString() { // comment required
return "";
}
}
]]></code>
</test-code>
<test-code>
<description>Methods inside annotations (#3123)</description>
<expected-problems>2</expected-problems>
<expected-linenumbers>3,4</expected-linenumbers>
<code><![CDATA[
/** Comment */
@interface MyAnnotation1 {
String name(); // comment required
int version(); // comment required
}
]]></code>
</test-code>
</test-data>