Add JavadocMissingLeadingAsterisk

commit-id:ec9e08c0
This commit is contained in:
Paul Campbell 2021-08-11 16:39:11 +01:00
parent 4bde3af664
commit 035b45b06c
2 changed files with 57 additions and 0 deletions

View file

@ -1545,3 +1545,10 @@ rules:
enabled: true enabled: true
source: CHECKSTYLE source: CHECKSTYLE
uri: https://checkstyle.sourceforge.io/config_whitespace.html#NoWhitespaceBeforeCaseDefaultColon uri: https://checkstyle.sourceforge.io/config_whitespace.html#NoWhitespaceBeforeCaseDefaultColon
-
name: JavadocMissingLeadingAsterisk
parent: TREEWALKER
level: LAYOUT
enabled: true
source: CHECKSTYLE
uri: https://checkstyle.sourceforge.io/config_javadoc.html#JavadocMissingLeadingAsterisk

View file

@ -0,0 +1,50 @@
Checks if the javadoc has leading asterisks on each line.
The check does not require asterisks on the first line, nor on the last line if
it is blank. All other lines in a Javadoc should start with *, including blank
lines and code blocks.
Valid:
````
/**
* Valid Java-style comment.
*
* <pre>
* int value = 0;
* </pre>
*/
class JavaStyle {} // ok
/** Valid Scala-style comment.
* Some description here.
**/
class ScalaStyle {} // ok
/** **
* Asterisks on first and last lines are optional.
* */
class Asterisks {} // ok
/** No asterisks are required for single-line comments. */
class SingleLine {} // ok
````
Invalid:
````
/** // violation on next blank line, javadoc has lines without leading asterisk.
*/
class BlankLine {}
/** Wrapped
single-line comment */ // violation, javadoc has lines without leading asterisk.
class Wrapped {}
/**
* <pre>
int value; // violation, javadoc has lines without leading asterisk.
* </pre>
*/
class Code {}
````