Skip to content

doc-summary

Javastyleno fixdefault: offjava/google

Reports a Javadoc comment that does not start with a summary: the first sentence must end with a period followed by a blank or the end of the text, and must not start with a fragment that matches the forbidden_fragments option. A comment that is {@inheritDoc} or {@return ...} needs no summary.

The first sentence is what the generated index and the IDE hover show, so a comment that does not start with a complete sentence gives a poor summary or one cut at the wrong place.

To fix, begin the comment with a sentence that ends with a period.

Reported
/** Good summary. Then more */
class A {
/** No period */
void a() {}
/** lowercase start. */
void b() {}
/**
...
/** Version 1.5 is fine. */
void e() {}
/**
* @param x only a tag
*/
void f() {}
/** A {@code Foo} is a thing. */
void g() {}
/** Ends with a question? */
void h() {}
}
java:
lint:
rules:
doc-summary:
level: warn # off (default), warn, error
options:
forbidden_fragments: ""
Option Type Default Description
forbidden_fragments string "" Regular expression a summary must not match at its start; empty: no check.

Enabled by the presets: java/google.

Suppress one line with sudsy-disable-next-line doc-summary in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
checkstyle SummaryJavadoc partial Period and forbidden fragments; the summary is read from the lines of the comment, not from parsed HTML.