Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show warning if method description is missing

In our code base, i see a lot of methods like there:

/**
     * @param tagID
     * @param startDate
     * @param endDate
     * @param estimated
     * @return
     * @throws ServerException
     */
    List<String> generateMaster(int tagID, Date date)
            throws ServerException, BusinessException;

Though there is a javadoc present, the description of method is missing. Hence the javadoc is plainly useless. In checkstyle, what do i do so that it gives a warning for above cases.

<property name="allowMissingJavadoc" value="false"/>

This only checks if at all there is a javadoc present or not. It marks the above method as present as the javadoc is present. But the method declaration is actually missing.

PS: Tagging eclipse and intellij. I am happy with any solution which tells me the number of methods containing above like javadocs

like image 686
Jatin Avatar asked Mar 03 '15 11:03

Jatin


2 Answers

It may be too late for this post - but anyone else looking to find answer, add description to each element e.g.

/**
 * @param tagID - ID of the tag
 * @param startDate - Starting Date
 * @param endDate - End date
 * @param estimated <-- this is not the param - should be removed or fix doc
 * @return <-- missing return param and description
 * @throws ServerException -- throws server exception
 */
like image 64
rHd Avatar answered Sep 23 '22 10:09

rHd


We use this for javadocs in checkstyle:

<module name="JavadocStyle">
    <property name="severity" value="warning"/
    <property name="checkEmptyJavadoc" value="true"/>
</module>

As you see checkEmptyJavadoc should help you.

like image 31
pepuch Avatar answered Sep 24 '22 10:09

pepuch