diff --git a/README.md b/README.md index d9c30d9..8b2c3e4 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,7 @@ Rule|Level|Source|Enabled|Suppressible [InterfaceTypeParameterName](#interfacetypeparametername)|naming|checkstyle|Yes| [JavadocMethod](#javadocmethod)|javadoc|checkstyle|| [JavadocMissingLeadingAsterisk](#javadocmissingleadingasterisk)|layout|checkstyle|Yes| +[JavadocMissingWhitespaceAfterAsterisk](#javadocmissingwhitespaceafterasterisk)|layout|checkstyle|Yes| [JavadocPackage](#javadocpackage)|javadoc|checkstyle|Yes| [JavadocParagraph](#javadocparagraph)|javadoc|checkstyle|Yes| [JavadocStyle](#javadocstyle)|javadoc|checkstyle|Yes| @@ -1183,6 +1184,40 @@ class Wrapped {} */ class Code {} ```` +#### [JavadocMissingWhitespaceAfterAsterisk](https://checkstyle.sourceforge.io/config_javadoc.html#JavadocMissingWhitespaceAfterAsterisk) + +Checks that there is at least one whitespace after the leading asterisk. +Although spaces after asterisks are optional in the Javadoc comments, their +absence makes the documentation difficult to read. It is the de facto standard +to put at least one whitespace after the leading asterisk. + +Valid: +````java +/** This is valid single-line Javadoc. */ +class TestClass { + /** + * This is valid Javadoc. + */ + void validJavaDocMethod() { + } + /** This is valid single-line Javadoc. */ + void validSingleLineJavaDocMethod() { + } +} +```` + +Invalid: +````java +class TestClass { + /** + *This is invalid Javadoc. + */ + int invalidJavaDoc; + /**This is invalid single-line Javadoc. */ + void invalidSingleLineJavaDocMethod() { + } +} +```` #### [JavadocPackage](http://checkstyle.sourceforge.net/config_javadoc.html#JavadocPackage) Checks that each package has a `package-info.java` file. diff --git a/builder/src/main/resources/application.yml b/builder/src/main/resources/application.yml index 00c961a..b225b0b 100644 --- a/builder/src/main/resources/application.yml +++ b/builder/src/main/resources/application.yml @@ -1566,4 +1566,10 @@ rules: enabled: true source: CHECKSTYLE uri: https://checkstyle.sourceforge.io/config_misc.html#NoCodeInFile - + - + name: JavadocMissingWhitespaceAfterAsterisk + parent: TREEWALKER + level: LAYOUT + enabled: true + source: CHECKSTYLE + uri: https://checkstyle.sourceforge.io/config_javadoc.html#JavadocMissingWhitespaceAfterAsterisk diff --git a/builder/src/main/resources/rules/JavadocMissingWhitespaceAfterAsterisk.md b/builder/src/main/resources/rules/JavadocMissingWhitespaceAfterAsterisk.md new file mode 100644 index 0000000..8f880da --- /dev/null +++ b/builder/src/main/resources/rules/JavadocMissingWhitespaceAfterAsterisk.md @@ -0,0 +1,33 @@ + +Checks that there is at least one whitespace after the leading asterisk. +Although spaces after asterisks are optional in the Javadoc comments, their +absence makes the documentation difficult to read. It is the de facto standard +to put at least one whitespace after the leading asterisk. + +Valid: +````java +/** This is valid single-line Javadoc. */ +class TestClass { + /** + * This is valid Javadoc. + */ + void validJavaDocMethod() { + } + /** This is valid single-line Javadoc. */ + void validSingleLineJavaDocMethod() { + } +} +```` + +Invalid: +````java +class TestClass { + /** + *This is invalid Javadoc. + */ + int invalidJavaDoc; + /**This is invalid single-line Javadoc. */ + void invalidSingleLineJavaDocMethod() { + } +} +```` \ No newline at end of file diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-1-layout.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-1-layout.xml index ffd6422..09a1c27 100644 --- a/ruleset/src/main/resources/net/kemitix/checkstyle-1-layout.xml +++ b/ruleset/src/main/resources/net/kemitix/checkstyle-1-layout.xml @@ -55,6 +55,7 @@ + diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-2-naming.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-2-naming.xml index a0df65b..82c363e 100644 --- a/ruleset/src/main/resources/net/kemitix/checkstyle-2-naming.xml +++ b/ruleset/src/main/resources/net/kemitix/checkstyle-2-naming.xml @@ -82,6 +82,7 @@ + diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-3-javadoc.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-3-javadoc.xml index 2e81a37..8e6a90d 100644 --- a/ruleset/src/main/resources/net/kemitix/checkstyle-3-javadoc.xml +++ b/ruleset/src/main/resources/net/kemitix/checkstyle-3-javadoc.xml @@ -101,6 +101,7 @@ + diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-4-tweaks.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-4-tweaks.xml index 3941494..ffa8529 100644 --- a/ruleset/src/main/resources/net/kemitix/checkstyle-4-tweaks.xml +++ b/ruleset/src/main/resources/net/kemitix/checkstyle-4-tweaks.xml @@ -144,6 +144,7 @@ + diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-5-complexity.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-5-complexity.xml index f4e55ff..d5f5904 100644 --- a/ruleset/src/main/resources/net/kemitix/checkstyle-5-complexity.xml +++ b/ruleset/src/main/resources/net/kemitix/checkstyle-5-complexity.xml @@ -191,6 +191,7 @@ +