-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Detected at the report:
https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/f4d37cb_2025053704/reports/diff/index.html
unfortunately, In my previous PR the config in the PR description was missing some important checks, so the report generated shows no difference but this was misleading.
After I checked a report in another PR (that was behind my commit on master). I saw the real diff due to my changes and analyzed the report all was good except for this case and the like
Example:
D:\CS\test
cat config.xml
<?xml version="1.0"?>
<!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="JavadocVariable"/>
</module>
</module>
D:\CS\test
cat src/Test.java
class Test {
/**
* Javadoc
*/
/* package */ int x;
int y;
}
D:\CS\test
java -jar checkstyle-10.22.0-SNAPSHOT-all.jar -c config.xml src/Test.java
Starting audit...
Audit done.
The issue because we skipped the line /* package */ int x;
because it has a block comment. so int y
becomes associated with the Javadoc above int x
.
The fix should be simple. A simple condition to see if the block comment is in a single line and not alone in the line
then we should not skip it.