Quellcode durchsuchen

PMD.MethodNameRules - ignore unit test methods

Ranides Atterwim vor 10 Jahren
Ursprung
Commit
ae9e272e5c
1 geänderte Dateien mit 5 neuen und 3 gelöschten Zeilen
  1. 5 3
      assira.rules/src/main/resources/rulesets/java/assira.custom.xml

+ 5 - 3
assira.rules/src/main/resources/rulesets/java/assira.custom.xml

@@ -165,9 +165,11 @@
         <priority>3</priority>
         <properties><property name="xpath" pluginname="true"><value>
             <![CDATA[
-            //MethodDeclaration/MethodDeclarator[
-                not(matches(@Image,'^(m_|\$)?([a-z][a-zA-Z0-9]*)$'))
-            ]
+            //ClassOrInterfaceBodyDeclaration
+                [not(Annotation/MarkerAnnotation/Name[@Image='Test'])]
+                [not(Annotation/MarkerAnnotation/Name[@Image='InterfaceTest'])]
+            /MethodDeclaration/MethodDeclarator
+                [not(matches(@Image,'^(m_|\$)?([a-z][a-zA-Z0-9]*)$'))]
             ]]>
         </value></property></properties>
     </rule>