Skip to content

[java] TooManyMethods - improve getter/setter detection (#3729)#3994

Merged
adangel merged 6 commits into
pmd:masterfrom
341816041:handling_issue_3729
Jul 7, 2022
Merged

[java] TooManyMethods - improve getter/setter detection (#3729)#3994
adangel merged 6 commits into
pmd:masterfrom
341816041:handling_issue_3729

Conversation

@341816041

@341816041 341816041 commented May 29, 2022

Copy link
Copy Markdown
Contributor

Describe the PR

Add a condition for judging a method as a getter setter

Related issues

Ready?

  • [1] Added unit tests for fixed bug/feature
  • [0] Passing all unit tests
  • [0] Complete build ./mvnw clean verify passes (checked automatically by github actions)(it goes wrong at disk test)
  • [0] Added (in-code) documentation (if needed)

@ghost

ghost commented Jun 1, 2022

Copy link
Copy Markdown
1 Message
📖 Compared to master:
This changeset changes 0 violations,
introduces 329 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 2 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 2 errors and 0 configuration errors.
Full report

Generated by 🚫 Danger

@adangel adangel changed the title handle issue 3729 [java] TooManyMethods - improve getter/setter detection (#3729) Jun 2, 2022

@adangel adangel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR!

Can you have a look at your fix? I don't think it actually fixes the problem... We don't detect too many methods even for your test case, where we have 22 methods...

@adangel adangel added this to the 6.48.0 milestone Jun 23, 2022
@adangel adangel self-assigned this Jul 7, 2022
@adangel adangel merged commit c83987f into pmd:master Jul 7, 2022
@C-Otto

C-Otto commented Jul 31, 2022

Copy link
Copy Markdown

I just noticed that the documentation in https://pmd.github.io/latest/pmd_rules_plsql_design.html still includes the exclusion of get/set/is methods. Could you please update it, too?

@adangel

adangel commented Aug 2, 2022

Copy link
Copy Markdown
Member

@C-Otto The file you mention is about PLSQL - the java version is updated: https://pmd.github.io/latest/pmd_rules_java_design.html#toomanymethods

still includes the exclusion of get/set/is methods

That's the whole point - exclude getter/setter/methods from the TooManyMethods rule, but keep e.g. getters, that do more (that's the count(Block/BlockStatement) <= 1 condition).

Please create a new issue, if you think, something is wrong. Thanks.

@C-Otto

C-Otto commented Aug 2, 2022

Copy link
Copy Markdown

Everything is fine, sorry for the confusion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[java] TooManyMethods ignores "real" methods which are named like getters or setters

3 participants