Skip to content

[java] Improve CommentSize#4369

Merged
jsotuyod merged 1 commit intopmd:pmd/7.0.xfrom
oowekyala:pmd7.fix-commentsize
Jan 27, 2023
Merged

[java] Improve CommentSize#4369
jsotuyod merged 1 commit intopmd:pmd/7.0.xfrom
oowekyala:pmd7.fix-commentsize

Conversation

@oowekyala
Copy link
Copy Markdown
Member

@oowekyala oowekyala commented Jan 27, 2023

Rule: CommentSize

Describe the PR

  • CommentSize didn't report long lines on the right lines but always on the first line of the comment.
  • When counting the characters of long lines, the indentation (white space) is ignored as well as the comment markers at the beginning of the lines (e.g. *, //).

Related issues

  • Fixes #

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

@jsotuyod jsotuyod added this to the 7.0.0 milestone Jan 27, 2023
@oowekyala oowekyala force-pushed the pmd7.fix-commentsize branch from f4b351b to ba18f3b Compare January 27, 2023 15:45
@ghost
Copy link
Copy Markdown

ghost commented Jan 27, 2023

2 Messages
📖 Compared to pmd/7.0.x:
This changeset changes 6 violations,
introduces 52834 new violations, 1 new errors and 0 new configuration errors,
removes 44 violations, 1438 errors and 0 configuration errors.
Full report
📖 Compared to master:
This changeset changes 50621 violations,
introduces 34682 new violations, 9 new errors and 0 new configuration errors,
removes 141951 violations, 4 errors and 7 configuration errors.
Full report

Generated by 🚫 Danger

@jsotuyod
Copy link
Copy Markdown
Member

Great finding!

Now that this is fixed however, it seems like a poor rule, specially regarding the "number of lines part"… at the very least I think Javadocs should be treated differently. I don't think there is any scenario were having "too much" javadoc is ever an issue, on the contrary, people usually complain for the lack of it…

I suggest we add a new property maxJavadocLines, with a more sensible default (ie: -1 to have no limit?)

@jsotuyod jsotuyod merged commit 0e19c2a into pmd:pmd/7.0.x Jan 27, 2023
@jsotuyod jsotuyod added the a:bug PMD crashes or fails to analyse a file. label Jan 27, 2023
@oowekyala oowekyala deleted the pmd7.fix-commentsize branch January 28, 2023 21:50
adangel added a commit to adangel/pmd that referenced this pull request Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a:bug PMD crashes or fails to analyse a file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants