Skip to content

doc-paragraph

Javastyleno fixdefault: offjava/google

Reports Javadoc paragraphs that do not use <p> in the usual way: a <p> must stand right before the first word of its paragraph (no space after it) and after an empty line, an empty line between paragraphs must be followed by <p>, and the comment must not start with <p>. Text inside <pre>, <ul> and the like, and after the first block tag, is not checked.

Javadoc ignores empty lines, so paragraphs not marked with <p> run together in the generated page. A <p> that is misplaced adds an empty paragraph or starts a paragraph in the wrong place.

To fix, put <p> directly before the first word of each paragraph after the first.

Reported
...
*
* <p>Fine paragraph.
*
* <p> Space after.
*
* Missing tag.
* <p>Not after an empty line.
*
* <ul>
* <li>item
...
* after the tags
*/
class A {
/** <p>First thing. */
void f() {}
}
java:
lint:
rules:
doc-paragraph: warn # off (default), warn, error

Enabled by the presets: java/google.

Suppress one line with sudsy-disable-next-line doc-paragraph 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 JavadocParagraph partial <p> and empty-line placement; not allowNewlineParagraph.