Pattern: Forbidden phrase in Javadoc summary
Issue: -
Checks that Javadoc summary sentence does not contain phrases that are not recommended to use. Summaries that contain only the {@inheritDoc}
tag are skipped.
By default check validate that first sentence is not empty:
<module name="SummaryJavadocCheck"/>
Example of {@inheritDoc}
without summary.
public class Test extends Exception {
//Valid
/**
* {@inheritDoc}
*/
public String ValidFunction(){
return "";
}
//Violation
/**
*
*/
public String InvalidFunction(){
return "";
}
}
To ensure that summary do not contain phrase like "This method returns" , use following config:
<module name="SummaryJavadocCheck">
<property name="forbiddenSummaryFragments" value="^This method returns.*"/>
</module>
To specify period symbol at the end of first Javadoc sentence:
<module name="SummaryJavadocCheck">
<property name="period" value="。"/>
</module>
Example of period property.
public class TestClass {
/**
* This is invalid Javadoc
*/
void invalidJavadocMethod() {
}
/**
* This is valid Javadoc
*/
void validJavadocMethod() {
}
}