A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/3729 below:

[java] TooManyMethods ignores "real" methods which are named like getters or setters · Issue #3729 · pmd/pmd · GitHub

Affects PMD Version: any

Rule: TooManyMethods

Description:
This false negative is from a source code comment.
Currently the rule ignores methods, that start with "get", "set", or "is" - which are considered simple getter/setter methods. But if these methods do more complex things (despite they are named like setters, e.g. if the setter contains validating logic), then this should maybe count towards the total method count...

Original comment:

                          FIXME: Refine XPath to discard 'get' and 'set' methods with Block no more than 3 lines,
                                something like this:
                                    not (
                                            (
                                                starts-with(@Name,'get')
                                                or
                                                starts-with(@Name,'set')
                                                or
                                                starts-with(@Name,'is')
                                            )
                                            and (
                                                    (
                                                        (../Block/attribute::endLine)
                                                         -
                                                        (../Block/attribute::beginLine)
                                                    ) <= 3
                                            )
                                        )
                                This will avoid discarding 'real' methods...

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4