Assira Quality Policy - custom rules
3
$maxmethods
and not (
@Final='true'
and
ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration/ConstructorDeclaration[@Private='true'][@ParameterCount='0']
and
count(ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration/ConstructorDeclaration)=1
)
]
]]>
3
$maxmethods
]
]]>
Detects when a field, formal or local variable is declared with a long name.
3
$minimum
and (@Static='false' or @Final='false')
]
]]>
Checks all field names against regular expression
3
Checks all methods names against regular expression
3
A class that has private constructors and does not have any static methods, fields or type declarations cannot be used.
3
0
and
count(./ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration/ConstructorDeclaration) = count(./ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration/ConstructorDeclaration[@Private='true'])
)
and count(.//MethodDeclaration[@Static='true'])=0
and count(.//FieldDeclaration[@Private='false'][@Static='true'])=0
and count(.//ClassOrInterfaceDeclaration[@Interface='true'])=0
and count(.//AnnotationTypeDeclaration)=0
and count(.//ClassOrInterfaceDeclaration[@Static='true' and @Private='false'])=0
]
]]>
Long parameter lists can indicate that a new object should be created to wrap the numerous parameters. Basically, try to group the parameters together.
3
$maximum] ]
[ not(Annotation/MarkerAnnotation/Name[@Image='Override']) ]
]]>
Avoid using java.lang.ThreadGroup; although it is intended to be used in a threaded environment it contains methods that are not thread safe.
3
3
3
$maxfields
]
]]>
Avoid passing parameters to methods or constructors without actually referencing them in the method body.
3