You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[java] CommentSize: False positive with file header comments #6270
The docs say that "non-header comments" are checked.
But the code checks all comments.
If you for example have the typical ASLv2 header comment, all your files will violate the rule with default settings as this is definitely a bit over 6 lines.
I guess this is not really hit by many people, as I probably most do similar to me and either disable the rule or set the max lines to 99999 to just check the max line length. :-)
Additionally from a cursory look, the implementation searches for the first and last non-empty lines and counts from first to last. If I did read that correctly, then the docs also need a correction as the bad example just has one line with that logic and thus would not violate the rule.
Expected outcome:
PMD reports a violation at line 1 but that's wrong. That's a false positive.
changed the title [-][java] `CommentSize` wrongly checks header comments[/-][+][java] CommentSize: False positive with header comments[/+]on Jan 16, 2026
changed the title [-][java] CommentSize: False positive with header comments[/-][+][java] CommentSize: False positive with file header comments[/+]on Aug 20, 2026
Activity
[-][java] `CommentSize` wrongly checks header comments[/-][+][java] CommentSize: False positive with header comments[/+][java] Fix pmd#6270: CommentSize skips file header comments (pmd#6948)
[-][java] CommentSize: False positive with header comments[/-][+][java] CommentSize: False positive with file header comments[/+]