[java] CommentRequired: Make headerCommentRequirement ignored by default, make tests more targeted
Refs #1683
This commit is contained in:

committed by
Andreas Dangel

parent
88ff3f0628
commit
6cec74851a
@ -45,7 +45,8 @@ public class CommentRequiredRule extends AbstractCommentRule {
|
||||
= requirementPropertyBuilder("methodWithOverrideCommentRequirement", "Comments on @Override methods")
|
||||
.defaultValue(CommentRequirement.Ignored).build();
|
||||
private static final PropertyDescriptor<CommentRequirement> HEADER_CMT_REQUIREMENT_DESCRIPTOR
|
||||
= requirementPropertyBuilder("headerCommentRequirement", "Header comments").build();
|
||||
= requirementPropertyBuilder("headerCommentRequirement", "Header comments")
|
||||
.defaultValue(CommentRequirement.Ignored).build();
|
||||
private static final PropertyDescriptor<CommentRequirement> CLASS_CMT_REQUIREMENT_DESCRIPTOR
|
||||
= requirementPropertyBuilder("classCommentRequirement", "Class comments").build();
|
||||
private static final PropertyDescriptor<CommentRequirement> FIELD_CMT_REQUIREMENT_DESCRIPTOR
|
||||
|
@ -512,33 +512,31 @@ public class CommentRequired {
|
||||
|
||||
<test-code>
|
||||
<description>#1683 [java] CommentRequired property names are inconsistent</description>
|
||||
<rule-property name="headerCommentRequirement">Required</rule-property>
|
||||
<expected-problems>1</expected-problems>
|
||||
<expected-linenumbers>7</expected-linenumbers>
|
||||
<code><![CDATA[
|
||||
/** license */
|
||||
package test.my_package;
|
||||
/** The class comment */
|
||||
public class CommentRequired implements Serializable {
|
||||
/** My list */
|
||||
List next;
|
||||
private final ObjectStreamField[] serialPersistentFields = {new ObjectStreamField("next", List.class)};
|
||||
public class CommentRequired {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>#1683 [java] CommentRequired property names are inconsistent - package with comment without new lines</description>
|
||||
<expected-problems>2</expected-problems>
|
||||
<rule-property name="headerCommentRequirement">Required</rule-property>
|
||||
<expected-problems>1</expected-problems>
|
||||
<code><![CDATA[
|
||||
/** licence comment */ package test.my_package; /** Test class */ public class Test { public void method1() { /** comment here */ } public void method2() { } }
|
||||
/** licence comment */ package test.my_package; public class Test { /** public method */ public void method() { } }
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>#1683 [java] CommentRequired property names are inconsistent - package without comment and without new lines</description>
|
||||
<expected-problems>3</expected-problems>
|
||||
<rule-property name="headerCommentRequirement">Required</rule-property>
|
||||
<expected-problems>2</expected-problems>
|
||||
<code><![CDATA[
|
||||
package test.my_package; /** Test class */ public class Test { public void method1() { /** comment here */ } public void method2() { } }
|
||||
package test.my_package; public class Test { /** public method */ public void method() { } }
|
||||
]]></code>
|
||||
</test-code>
|
||||
</test-data>
|
||||
|
Reference in New Issue
Block a user