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
//ClassOrInterfaceDeclaration/ClassOrInterfaceBody
[
count(./ClassOrInterfaceBodyDeclaration/MethodDeclaration[
not (
starts-with(@Name,'get')
or
starts-with(@Name,'set')
or
starts-with(@Name,'is')
)
]) > $maxmethods
]
The rule currently excludes getters, setters and is methods.
Methods such as 'are', 'test' and having annotations like @test signifying a unit test could be added so that test classes don't trigger this rule.
//ClassOrInterfaceDeclaration/ClassOrInterfaceBody
[
count(./ClassOrInterfaceBodyDeclaration/MethodDeclaration[
not (
starts-with(@Name,'get')
or
starts-with(@Name,'set')
or
starts-with(@Name,'is')
)
]) > $maxmethods
]
The rule currently excludes getters, setters and is methods.
Methods such as 'are', 'test' and having annotations like @test signifying a unit test could be added so that test classes don't trigger this rule.
Another option is to use Nested classes like JUnit5 provides.
Affects PMD Version:
3.9+
Rule:
TooManyMethods
Description:
This rule can trigger when a JUnit test is thorough, featuring multiple tests. As a workaround, I am disabling this rule in my rulesets.xml:
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
Gradle
The text was updated successfully, but these errors were encountered: