checkstyle / checkstyle/checkstyle

Cannot exclude public scope with JavadocMethod module

Open
#6,671 9 comments 0 reactions 0 assignees View on GitHub
approved
Dominant language
Java
Stars
9.6k
Forks
4.2k
Avg merge
22h 23m
Merged PRs (30d)
232

Description

checkstyle.xml
```










```
CheckstyleTest.java
```
package test;

public class CheckstyleTest {

public void publicMethod() {
System.out.println("public method");
}

protected void protectedMethod() {
System.out.println("protected method");
}

void packageMethod() {
System.out.println("package method");
}

private void privateMethod() {
System.out.println("private method");
}
}
```

Console
```
java -jar checkstyle-8.19-all.jar CheckstyleTest.java -c=checkstyle.xml

Starting audit...
Audit done.
```

---------------

Expected output:
```
Starting audit...
[WARN] TestProject\test\CheckstyleTest.java:9:9: Missing a Javadoc comment. [JavadocMethod]
[WARN] TestProject\test\CheckstyleTest.java:13:9: Missing a Javadoc comment. [JavadocMethod]
[WARN] TestProject\test\CheckstyleTest.java:17:9: Missing a Javadoc comment. [JavadocMethod]
Audit done.
```

--------------

Checkstyle seems to ignore the complete check if scope is set to public. Is this a bug?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the configuration from checkstyle.xml against CheckstyleTest.java with the documented Checkstyle command. Trace how JavadocMethod handles excludeScope=public, then add a regression test covering public, protected, package, and private methods; done means the non-public methods produce the expected warnings while public methods remain excluded.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.