Skip to content

Latest commit

 

History

History
88 lines (61 loc) · 1.57 KB

SummaryJavadoc.md

File metadata and controls

88 lines (61 loc) · 1.57 KB

Pattern: Forbidden phrase in Javadoc summary

Issue: -

Description

Checks that Javadoc summary sentence does not contain phrases that are not recommended to use. Summaries that contain only the {@inheritDoc} tag are skipped.

Examples

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() {
    }
}

Further Reading