Skip to content

Spot useless javadocs #4

Open
Open
@manoelcampos

Description

@manoelcampos

Sometimes, developers write useless javadocs such as the example below

/**
 * Some Foo Method.
 * @param id the id
 * @return 
*/
int someFooMethod(int id){ return 0; }

The plugin should spot this kind of "documentation" and present them into the report.
A common pattern to detect such useless javadocs are:

  • the method documentation includes only the name of the method, accordingly separating words by space
  • param documentation just includes the name or type of the param, preceded by an article (the, a, an): the id, an id, an int
  • method or param documentation includes just one word.
  • after removing connectors (the, a, and, of, to, for, etc) and spaces from the documentation, the text remaining is equal to the element name, for instance:
/**
 * Compute the statistics.
*/
double computeStatistics(){ return 0; }

However, it may be difficult to detect verbs in the 3rd person of the singular, such as "Computes" instead of "Compute".

Regular expressions should be defined to detect such issues. A set of regex should be defined by default, but the plugin should enable developers to specify their own regex and if they want to use both the given regular expressions and the standard ones, or just the given ones.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions