Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First sentence of Javadoc is not checked past default period character when using custom period #14751

Open
patchwork01 opened this issue Apr 2, 2024 · 1 comment · May be fixed by #14690
Open
Labels

Comments

@patchwork01
Copy link
Contributor

patchwork01 commented Apr 2, 2024

I have read check documentation: https://checkstyle.org/checks/javadoc/summaryjavadoc.html
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words

/var/tmp $ javac TestCheckstyleJavadocSummary.java

/var/tmp $ cat config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
        "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
        "https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
    <module name="TreeWalker">
        <module name="SummaryJavadoc">
            <property name="period" value="_"/>
            <property name="forbiddenSummaryFragments" value="forbidden-fragment"/>
        </module>
    </module>
</module>

/var/tmp $ cat TestCheckstyleJavadocSummary.java
public class TestCheckstyleJavadocSummary {

    /**
     * Summary sentence that happens to have a default period. in it, then forbidden-fragment, but the custom period is used_
     */
    void foo1() {
    }
}

/var/tmp $ RUN_LOCALE="-Duser.language=en -Duser.country=US"

/var/tmp $ java $RUN_LOCALE -jar checkstyle-10.14.2-all.jar -c config.xml TestCheckstyleJavadocSummary.java
Starting audit...
Audit done.

This should fail as the summary sentence contains "forbidden-fragment". It only fails if "forbidden-fragment" occurs before the default period character ".".


This bug was found while addressing the following issue:

While fixing that, I also fixed this.

@romani
Copy link
Member

romani commented Apr 5, 2024

willl be fixed in scope of fix for #14689

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants