Commit baef321b authored by Roxane Kang Maréchal's avatar Roxane Kang Maréchal
Browse files

Removed some if/else conditionals

parent 8568f984
......@@ -45,7 +45,7 @@ helper def: allMeasures(project : java!Model): Set(smm!Measure) =
--
thisModule.shortMethodName(),
thisModule.tooManyStaticImports(),
thisModule.AvoidDollarSigns(),
thisModule.avoidDollarSigns(),
thisModule.shortClassName(),
thisModule.extendsObject(),
thisModule.unnecessaryReturn(),
......
......@@ -56,32 +56,40 @@ helper def: matchesCommentRequiredProperty(
-- Check correspondance with modifier vibility
.and(
if (tuple.modifier.isEmpty()) then true
else
if (tuple.modifier = elem.modifier.visibility.name) then true else false endif
endif)
tuple.modifier.isEmpty() or tuple.modifier = elem.modifier.visibility.name)
-- Check correspondance with annotation
.and(
if (tuple.annotation.isEmpty()) then true
else
if (thisModule.getAnnotationTypeDeclarationsFromBodyDeclaration(elem)
->exists(annotation | annotation.name = tuple.annotation)
) then true else false endif
endif)
tuple.annotation.isEmpty() or
thisModule.getAnnotationTypeDeclarationsFromBodyDeclaration(elem)
->exists(annotation | annotation.name = tuple.annotation))
-- Check correspondance with prefixes
.and(
if (tuple.prefixes.isEmpty()) then true
else
if (tuple.prefixes->exists(p |
tuple.prefixes.isEmpty() or
tuple.prefixes->exists(p |
-- If elem is of type FieldDeclaration, name field is null so we have to use fragments
if (elem.oclIsTypeOf(java!FieldDeclaration))
then elem.fragments.first().name.startsWith(p)
else elem.name.startsWith(p)
endif
-- This creates problem : Operation not found: OclUndefined.startsWith(java.lang.String)
-- (elem.oclIsTypeOf(java!FieldDeclaration) and (elem.fragments.first().name.startsWith(p)))
-- or elem.name.startsWith(p)
)
)
--if (tuple.prefixes.isEmpty()) then true
--else
-- if (tuple.prefixes->exists(p |
-- If elem is of type FieldDeclaration, name field is null so we have to use fragments
if (elem.oclIsTypeOf(java!FieldDeclaration))
then elem.fragments.first().name.startsWith(p)
else elem.name.startsWith(p)
endif)
) then true else false endif
endif)
-- if (elem.oclIsTypeOf(java!FieldDeclaration))
-- then elem.fragments.first().name.startsWith(p)
-- else elem.name.startsWith(p)
-- endif)
-- ) then true else false endif
--endif)
;
-- Returns true if the elem has comments, false otherwise
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment