Skip to content

Documentation Comments Style Guide - Method descriptions begin with a verb phrase, Class/interface/field descriptions can omit the subject and simply state the object #19910

@gianmarcoschifone

Description

@gianmarcoschifone

Parent issue: #19807

Coverage table

Chapter link

Content

Image

Image

Text

Method descriptions begin with a verb phrase.

A method implements an operation, so it usually starts with a verb phrase:

Gets the label of this button. (preferred)

This method gets the label of this button.

Class/interface/field descriptions can omit the subject and simply state the object.

These API often describe things rather than actions or behaviors:

A button label. (preferred)

This field is a button label. (avoid)

Guidelines

These two chapters are covered by SummaryJavadocCheck.
The check has a forbiddenSummaryFragments property, which can be used exactly for these cases, as shown in our example.
Proposal:

Documentation Comments Rule Checkstyle Checks Used Sample files
Method descriptions begin with a verb phrase ✅SummaryJavadoc
Class/interface/field descriptions can omit the subject and simply state the object ✅SummaryJavadoc
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions