如何限制javadoc的@parma在checkstyle中有注释
How to restrict the @parma of javadoc to have comments in checkstyle
如何限制javadoc的@parma在checkstyle中有注释
比如
/**
* text
* @param args //Error reported here, must have comment
*/
public static void main(String[] args) {}
使用 NonEmptyAtclauseDescription,https://checkstyle.org/config_javadoc.html#NonEmptyAtclauseDescription
$ cat TestClass.java
public class TestClass {
/**
* text.
* @param args
*/
public static void main(String[] args) {}
}
$ cat TestConfig.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="charset" value="UTF-8"/>
<module name="TreeWalker">
<module name="NonEmptyAtclauseDescription"/>
</module>
</module>
$ java -jar checkstyle-10.1-all.jar -c TestConfig.xml TestClass.java
Starting audit...
[ERROR] TestClass.java:4: At-clause should have a non-empty description. [NonEmptyAtclauseDescription]
Audit done.
Checkstyle ends with 1 errors.
如何限制javadoc的@parma在checkstyle中有注释
比如
/**
* text
* @param args //Error reported here, must have comment
*/
public static void main(String[] args) {}
使用 NonEmptyAtclauseDescription,https://checkstyle.org/config_javadoc.html#NonEmptyAtclauseDescription
$ cat TestClass.java
public class TestClass {
/**
* text.
* @param args
*/
public static void main(String[] args) {}
}
$ cat TestConfig.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="charset" value="UTF-8"/>
<module name="TreeWalker">
<module name="NonEmptyAtclauseDescription"/>
</module>
</module>
$ java -jar checkstyle-10.1-all.jar -c TestConfig.xml TestClass.java
Starting audit...
[ERROR] TestClass.java:4: At-clause should have a non-empty description. [NonEmptyAtclauseDescription]
Audit done.
Checkstyle ends with 1 errors.