Skip to content

Commit 4c378dc

Browse files
Zopsssromani
authored andcommitted
supplemental: added violation messages in JavadocParagraph's input files
1 parent 82bc795 commit 4c378dc

File tree

5 files changed

+106
-58
lines changed

5 files changed

+106
-58
lines changed

config/checkstyle-resources-suppressions.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@
256256
files="[\\/]test[\\/]resources[\\/]com[\\/]puppycrawl[\\/]tools[\\/]checkstyle[\\/]checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly1\.java"/>
257257
<suppress checks="FileLength"
258258
files="[\\/]test[\\/]resources[\\/]com[\\/]puppycrawl[\\/]tools[\\/]checkstyle[\\/]checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodProtectedScopeJavadoc\.java"/>
259+
<suppress checks="FileLength"
260+
files="[\\/]test[\\/]resources[\\/]com[\\/]puppycrawl[\\/]tools[\\/]checkstyle[\\/]checks[\\/]javadoc[\\/]javadocparagraph[\\/]InputJavadocParagraphIncorrect\.java"/>
259261
<suppress checks="FileLength"
260262
files="[\\/]test[\\/]resources[\\/]com[\\/]puppycrawl[\\/]tools[\\/]checkstyle[\\/]checks[\\/]javadoc[\\/]javadoctype[\\/]InputJavadocTypePublicOnly1\.java"/>
261263
<suppress checks="FileLength"

src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheckTest.java

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -58,42 +58,42 @@ public void testCorrect() throws Exception {
5858
@Test
5959
public void testIncorrect() throws Exception {
6060
final String[] expected = {
61-
"13: " + getCheckMessage(MSG_MISPLACED_TAG),
62-
"13: " + getCheckMessage(MSG_LINE_BEFORE),
63-
"14: " + getCheckMessage(MSG_MISPLACED_TAG),
64-
"14: " + getCheckMessage(MSG_LINE_BEFORE),
65-
"20: " + getCheckMessage(MSG_MISPLACED_TAG),
66-
"20: " + getCheckMessage(MSG_LINE_BEFORE),
67-
"22: " + getCheckMessage(MSG_MISPLACED_TAG),
68-
"30: " + getCheckMessage(MSG_LINE_BEFORE),
69-
"32: " + getCheckMessage(MSG_MISPLACED_TAG),
70-
"39: " + getCheckMessage(MSG_MISPLACED_TAG),
61+
"16: " + getCheckMessage(MSG_MISPLACED_TAG),
62+
"16: " + getCheckMessage(MSG_LINE_BEFORE),
63+
"17: " + getCheckMessage(MSG_MISPLACED_TAG),
64+
"17: " + getCheckMessage(MSG_LINE_BEFORE),
65+
"29: " + getCheckMessage(MSG_MISPLACED_TAG),
66+
"29: " + getCheckMessage(MSG_LINE_BEFORE),
67+
"31: " + getCheckMessage(MSG_MISPLACED_TAG),
7168
"39: " + getCheckMessage(MSG_LINE_BEFORE),
72-
"39: " + getCheckMessage(MSG_REDUNDANT_PARAGRAPH),
73-
"40: " + getCheckMessage(MSG_MISPLACED_TAG),
74-
"40: " + getCheckMessage(MSG_LINE_BEFORE),
7569
"41: " + getCheckMessage(MSG_MISPLACED_TAG),
76-
"41: " + getCheckMessage(MSG_LINE_BEFORE),
77-
"42: " + getCheckMessage(MSG_MISPLACED_TAG),
78-
"42: " + getCheckMessage(MSG_LINE_BEFORE),
79-
"46: " + getCheckMessage(MSG_MISPLACED_TAG),
80-
"46: " + getCheckMessage(MSG_LINE_BEFORE),
81-
"52: " + getCheckMessage(MSG_MISPLACED_TAG),
82-
"52: " + getCheckMessage(MSG_REDUNDANT_PARAGRAPH),
8370
"55: " + getCheckMessage(MSG_MISPLACED_TAG),
71+
"55: " + getCheckMessage(MSG_LINE_BEFORE),
72+
"55: " + getCheckMessage(MSG_REDUNDANT_PARAGRAPH),
73+
"56: " + getCheckMessage(MSG_MISPLACED_TAG),
74+
"56: " + getCheckMessage(MSG_LINE_BEFORE),
8475
"57: " + getCheckMessage(MSG_MISPLACED_TAG),
8576
"57: " + getCheckMessage(MSG_LINE_BEFORE),
8677
"58: " + getCheckMessage(MSG_MISPLACED_TAG),
8778
"58: " + getCheckMessage(MSG_LINE_BEFORE),
88-
"69: " + getCheckMessage(MSG_REDUNDANT_PARAGRAPH),
89-
"70: " + getCheckMessage(MSG_TAG_AFTER),
90-
"79: " + getCheckMessage(MSG_MISPLACED_TAG),
91-
"79: " + getCheckMessage(MSG_LINE_BEFORE),
92-
"81: " + getCheckMessage(MSG_MISPLACED_TAG),
93-
"84: " + getCheckMessage(MSG_MISPLACED_TAG),
94-
"84: " + getCheckMessage(MSG_LINE_BEFORE),
95-
"91: " + getCheckMessage(MSG_TAG_AFTER),
96-
"92: " + getCheckMessage(MSG_TAG_AFTER),
79+
"71: " + getCheckMessage(MSG_MISPLACED_TAG),
80+
"71: " + getCheckMessage(MSG_LINE_BEFORE),
81+
"80: " + getCheckMessage(MSG_MISPLACED_TAG),
82+
"80: " + getCheckMessage(MSG_REDUNDANT_PARAGRAPH),
83+
"83: " + getCheckMessage(MSG_MISPLACED_TAG),
84+
"85: " + getCheckMessage(MSG_MISPLACED_TAG),
85+
"85: " + getCheckMessage(MSG_LINE_BEFORE),
86+
"86: " + getCheckMessage(MSG_MISPLACED_TAG),
87+
"86: " + getCheckMessage(MSG_LINE_BEFORE),
88+
"103: " + getCheckMessage(MSG_REDUNDANT_PARAGRAPH),
89+
"104: " + getCheckMessage(MSG_TAG_AFTER),
90+
"116: " + getCheckMessage(MSG_MISPLACED_TAG),
91+
"116: " + getCheckMessage(MSG_LINE_BEFORE),
92+
"118: " + getCheckMessage(MSG_MISPLACED_TAG),
93+
"121: " + getCheckMessage(MSG_MISPLACED_TAG),
94+
"121: " + getCheckMessage(MSG_LINE_BEFORE),
95+
"131: " + getCheckMessage(MSG_TAG_AFTER),
96+
"132: " + getCheckMessage(MSG_TAG_AFTER),
9797
};
9898
verifyWithInlineConfigParser(
9999
getPath("InputJavadocParagraphIncorrect.java"), expected);
@@ -106,21 +106,21 @@ public void testAllowNewlineParagraph() throws Exception {
106106
"14: " + getCheckMessage(MSG_LINE_BEFORE),
107107
"19: " + getCheckMessage(MSG_LINE_BEFORE),
108108
"28: " + getCheckMessage(MSG_LINE_BEFORE),
109-
"37: " + getCheckMessage(MSG_LINE_BEFORE),
110-
"37: " + getCheckMessage(MSG_REDUNDANT_PARAGRAPH),
111-
"38: " + getCheckMessage(MSG_LINE_BEFORE),
112-
"39: " + getCheckMessage(MSG_LINE_BEFORE),
113109
"40: " + getCheckMessage(MSG_LINE_BEFORE),
114-
"45: " + getCheckMessage(MSG_LINE_BEFORE),
115-
"53: " + getCheckMessage(MSG_REDUNDANT_PARAGRAPH),
116-
"58: " + getCheckMessage(MSG_LINE_BEFORE),
117-
"59: " + getCheckMessage(MSG_LINE_BEFORE),
118-
"70: " + getCheckMessage(MSG_REDUNDANT_PARAGRAPH),
119-
"71: " + getCheckMessage(MSG_TAG_AFTER),
120-
"80: " + getCheckMessage(MSG_LINE_BEFORE),
121-
"85: " + getCheckMessage(MSG_LINE_BEFORE),
122-
"93: " + getCheckMessage(MSG_TAG_AFTER),
123-
"94: " + getCheckMessage(MSG_TAG_AFTER),
110+
"40: " + getCheckMessage(MSG_REDUNDANT_PARAGRAPH),
111+
"41: " + getCheckMessage(MSG_LINE_BEFORE),
112+
"42: " + getCheckMessage(MSG_LINE_BEFORE),
113+
"43: " + getCheckMessage(MSG_LINE_BEFORE),
114+
"48: " + getCheckMessage(MSG_LINE_BEFORE),
115+
"56: " + getCheckMessage(MSG_REDUNDANT_PARAGRAPH),
116+
"61: " + getCheckMessage(MSG_LINE_BEFORE),
117+
"62: " + getCheckMessage(MSG_LINE_BEFORE),
118+
"73: " + getCheckMessage(MSG_REDUNDANT_PARAGRAPH),
119+
"74: " + getCheckMessage(MSG_TAG_AFTER),
120+
"83: " + getCheckMessage(MSG_LINE_BEFORE),
121+
"88: " + getCheckMessage(MSG_LINE_BEFORE),
122+
"96: " + getCheckMessage(MSG_TAG_AFTER),
123+
"97: " + getCheckMessage(MSG_TAG_AFTER),
124124
};
125125
verifyWithInlineConfigParser(
126126
getPath("InputJavadocParagraphIncorrect2.java"), expected);

src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphCheck1.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ class Check {
2828
* Checks whether file contains code. Files which are considered to have no code:
2929
* </p>
3030
* <p>
31-
*/ // 2 violations above
31+
*/
32+
// 2 violations 2 lines above:
33+
// '\<p\> tag should be placed immediately before the first word'
34+
// '\<p\> tag should be preceded with an empty line.'
3235
void inheritDocWithThrows() {}
3336
}

src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect.java

Lines changed: 53 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,25 @@
88

99
package com.puppycrawl.tools.checkstyle.checks.javadoc.javadocparagraph;
1010

11+
// 2 violations 5 lines below:
12+
// 'tag should be placed immediately before the first word'
13+
// 'tag should be preceded with an empty line.'
1114
/**
12-
* Some Javadoc. // 2 violations below
15+
* Some Javadoc.
1316
* <p>
14-
* /^ WARN/ Some Javadoc.<p> // 2 violations
17+
* /^ WARN/ Some Javadoc.<p>
1518
*
1619
*/
20+
// 2 violations 3 lines above:
21+
// 'tag should be placed immediately before the first word'
22+
// 'tag should be preceded with an empty line.'
1723
class InputJavadocParagraphIncorrect {
1824

25+
// 2 violations 4 lines below:
26+
// 'tag should be placed immediately before the first word'
27+
// 'tag should be preceded with an empty line.'
1928
/**
20-
* Some Javadoc.<P> // 2 violations
29+
* Some Javadoc.<P>
2130
*
2231
* <p> Some Javadoc. // violation 'tag should be placed immediately before the first word'
2332
*
@@ -36,29 +45,54 @@ class InputJavadocParagraphIncorrect {
3645
*/
3746
boolean emulated() {return false;}
3847

39-
/**<p>Some Javadoc.<p> // 3 violations
40-
* <p> // 2 violations
41-
* <p><p> // 2 violations
42-
* <p>/^WARN/ Some Javadoc.<p>*/ // 2 violations
48+
// 3 violations 7 lines below:
49+
// 'tag should be placed immediately before the first word'
50+
// 'tag should be preceded with an empty line.'
51+
// 'Redundant <p> tag.'
52+
// 2 violations 4 lines below:
53+
// 'tag should be placed immediately before the first word'
54+
// 'tag should be preceded with an empty line.'
55+
/**<p>Some Javadoc.<p>
56+
* <p>
57+
* <p><p>
58+
* <p>/^WARN/ Some Javadoc.<p>*/
59+
// 2 violations 2 lines above:
60+
// 'tag should be placed immediately before the first word'
61+
// 'tag should be preceded with an empty line.'
62+
// 2 violations 4 lines above:
63+
// 'tag should be placed immediately before the first word'
64+
// 'tag should be preceded with an empty line.'
4365
class InnerInputJavadocParagraphIncorrect {
4466

67+
// 2 violations 4 lines below:
68+
// 'tag should be placed immediately before the first word'
69+
// 'tag should be preceded with an empty line.'
4570
/**
46-
* Some Javadoc./WARN/<p> // 2 violations
71+
* Some Javadoc./WARN/<p>
4772
*
4873
* @since 8.0
4974
*/
5075
public static final byte NUL = 0;
5176

77+
// 2 violations 3 lines below:
78+
// 'tag should be placed immediately before the first word'
79+
// 'Redundant \<p\> tag.'
5280
/**<p>
53-
* /^WARN/ Some Javadoc. // 2 violations above
81+
* /^WARN/ Some Javadoc.
5482
*
5583
* <P> // violation 'tag should be placed immediately before the first word'
5684
* /^WARN/
57-
* <p> // 2 violations
58-
* /^WARN/ Some Javadoc.<p> // 2 violations
85+
* <p>
86+
* /^WARN/ Some Javadoc.<p>
5987
* @see <a href="http://www.gwtproject.org/doc/latest/DevGuideOrganizingProjects.html#DevGuideModules">
6088
* Documentation about GWT emulated source</a>
6189
*/
90+
// 2 violations 5 lines above:
91+
// 'tag should be placed immediately before the first word'
92+
// 'tag should be preceded with an empty line.'
93+
// 2 violations 7 lines above:
94+
// 'tag should be placed immediately before the first word'
95+
// 'tag should be preceded with an empty line.'
6296
boolean emulated() {return false;}
6397
}
6498

@@ -75,14 +109,20 @@ class InnerInputJavadocParagraphIncorrect {
75109
// violation 5 lines above 'Empty line should be followed by <p> tag on the next line.'
76110
public static final byte NUL = 0;
77111

112+
// 2 violations 4 lines below:
113+
// 'tag should be placed immediately before the first word'
114+
// 'tag should be preceded with an empty line.'
78115
/**
79-
* /WARN/ Some Javadoc.<p> // 2 violations
116+
* /WARN/ Some Javadoc.<p>
80117
*
81118
* <p> Some Javadoc. // violation 'tag should be placed immediately before the first word'
82119
*
83120
* @see <a href="http://www.gwtproject.org/doc/latest/DevGuideOrganizingProjects.html#DevGuideModules">
84-
* Documentation about <p> GWT emulated source</a> // 2 violations
121+
* Documentation about <p> GWT emulated source</a>
85122
*/
123+
// 2 violations 2 lines above:
124+
// 'tag should be placed immediately before the first word'
125+
// 'tag should be preceded with an empty line.'
86126
boolean emulated() {return false;}
87127

88128
// violation 3 lines below 'Empty line should be followed by <p> tag on the next line.'

src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadocparagraph/InputJavadocParagraphIncorrect2.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ class InputJavadocParagraphIncorrect2 {
3434
*/
3535
boolean emulated() {return false;}
3636

37-
/**<p>Some Javadoc.<p> // 2 violations
37+
// 2 violations 3 lines below:
38+
// 'tag should be preceded with an empty line.'
39+
// 'Redundant \<p\> tag.'
40+
/**<p>Some Javadoc.<p>
3841
* <p> // violation '<p> tag should be preceded with an empty line.'
3942
* <p><p> // violation '<p> tag should be preceded with an empty line.'
4043
* <p>/^WARN/ Some Javadoc.<p>*/

0 commit comments

Comments
 (0)