From fda753813b2b5a5a53bc2f056c5a2a6c82552023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Wed, 8 Jun 2016 19:59:58 -0300 Subject: [PATCH 1/2] Don't report bad method names on @Override --- .../src/main/resources/rulesets/java/naming.xml | 1 + .../java/rule/naming/xml/BooleanGetMethodName.xml | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/pmd-java/src/main/resources/rulesets/java/naming.xml b/pmd-java/src/main/resources/rulesets/java/naming.xml index 0cf323ebcb..f0c09c6a80 100644 --- a/pmd-java/src/main/resources/rulesets/java/naming.xml +++ b/pmd-java/src/main/resources/rulesets/java/naming.xml @@ -509,6 +509,7 @@ MethodDeclarator[count(FormalParameters/FormalParameter) = 0 or $checkParameteri [starts-with(@Image, 'get')] and ResultType/Type/PrimitiveType[@Image = 'boolean'] +and not(../Annotation//Name[@Image = 'Override']) ] ]]> diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/BooleanGetMethodName.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/BooleanGetMethodName.xml index c3f7e47b05..a342649356 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/BooleanGetMethodName.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/naming/xml/BooleanGetMethodName.xml @@ -35,6 +35,20 @@ public class Foo { + 0 + + + + 1 From be1751a0bfdd454bcd134e343040355cfa10f83e Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sun, 12 Jun 2016 19:06:14 +0200 Subject: [PATCH 2/2] Update changelog --- src/site/markdown/overview/changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index c2d74a0239..898e0e6bcf 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -83,6 +83,7 @@ you'll need a java8 runtime environment. * [#94](https://github.com/pmd/pmd/pull/94): Added property, fixed code climate renderer output and deleted unused rulessets (Apex) * [#95](https://github.com/pmd/pmd/pull/95): Apex - New apex rule AvoidDmlStatementsInLoops * [#96](https://github.com/pmd/pmd/pull/96): Clean up Code Climate renderer +* [#97](https://github.com/pmd/pmd/pull/97): BooleanGetMethodName: Don't report bad method names on @Override **Bugfixes:**