Skip to content

JavadocParagraph: allowNewlineParagraph should allow '\n' after P tag and content start from new line #15690

@romani

Description

@romani

https://checkstyle.org/checks/javadoc/javadocparagraph.html

allowNewlineParagraph Control whether the

tag should be placed immediately before the first word.
default = true

but it actually not works. See examples in web site.

Check does not allow new line by default. Implementation is not exact to allow new-lines only.

proposal:
Do not change name of property, and default value.
Consider it as huge defect and make it work where allowNewlineParagraph=true does not violate:

 * <p>
 * New line after tag.
$ cat config.xml 
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
          "https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
  <module name="TreeWalker">
    <module name="JavadocParagraph"/>
  </module>
</module>

$ cat Test.java 
/**
 * Summary is without P tag.
 *
 * <p>Tag immediately before the text.
 * <p>No blank line before the tag.
 *
 * <p>
 * New line after tag.
 *
 * <p> Whitespace after tag.
 *
 */
// unexpected violation 6 lines above 'tag should be placed immediately before the first word'
public class Test {
}

$ java -jar checkstyle-10.18.1-all.jar -c config.xml  Test.java 
Starting audit...
[ERROR] /var/tmp/Test.java:5: <p> tag should be preceded with an empty line. [JavadocParagraph]
[ERROR] /var/tmp/Test.java:7: <p> tag should be placed immediately before the first word,
     with no space after. [JavadocParagraph]
[ERROR] /var/tmp/Test.java:10: <p> tag should be placed immediately before the first word,
    with no space after. [JavadocParagraph]
Audit done.
Checkstyle ends with 3 errors.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions