Commit f85b6e47 authored by Gerson Sunyé's avatar Gerson Sunyé
Browse files

Merge branch 'master' of gitlab.univ-nantes.fr:naomod/mde/projet-2019

parents 3bc7c1e5 b46d78d0
/org.eclipse.jdt.source.all.xmi
......@@ -39,10 +39,12 @@ helper def: allMeasures(project : java!Model): Set(smm!Measure) =
--
thisModule.avoidThreadGroup(),
thisModule.useNotifyAllInsteadOfNotify(),
thisModule.dontCallThreadRun(),
-- Code Style rules
--
thisModule.avoidDollarSigns(),
thisModule.avoidPrefixingMethodParameters(),
thisModule.extendsObject(),
thisModule.fieldDeclarationsShouldBeAtStartOfClass(),
......@@ -70,7 +72,7 @@ helper def: allMeasures(project : java!Model): Set(smm!Measure) =
thisModule.signatureDeclareThrowsException(),
thisModule.tooManyFields(),
thisModule.tooManyMethods(),
-- FIXME:
-- #FIXME:
-- thisModule.SimplifyBooleanAssertion(),
-- Performance rules
......@@ -80,10 +82,10 @@ helper def: allMeasures(project : java!Model): Set(smm!Measure) =
thisModule.avoidRethrowingException(),
thisModule.avoidUsingShortType(),
thisModule.emptyStatementBlock(),
-- FIXME:
-- #FIXME:
-- thisModule.insufficientStringBufferDeclaration(),
thisModule.integerInstantiation(),
-- FIXME:
-- #FIXME:
-- thisModule.startsWith(),
thisModule.tooFewBranchesForASwitchStatement(),
thisModule.useIndexOfChar(),
......@@ -134,14 +136,12 @@ helper def: allMeasures(project : java!Model): Set(smm!Measure) =
-- thisModule.emptyfinalizeMethod(),
-- thisModule.doNotThrowExceptionInFinally(),
-- thisModule.finalizeShouldBeProtected(),
-- thisModule.avoidDollarSigns(),
-- thisModule.returnEmptyArrayRatherThanNull(),
-- thisModule.replaceVectorToList()
-- thisModule.unusedPrivateMethod ()
-- thisModule.avoidStringBufferField()
-- thisModule.avoidThrowingNewInstanceOfSameException(),
-- thisModule.stringToString(),
-- thisModule.dontCallThreadRun(),
-- thisModule.methodWithSameNameAsEnclosingClass(),
-- thisModule.dontUseFloatTypeForLoopIndices(),
-- thisModule.methodWithSameNameAsEnclosingClass(),
......@@ -270,7 +270,7 @@ rule MeasureStringToString(method : java!MethodInvocation) {
}
-- creates a new Measure when Thread.run() is used instead of Thread.start()
rule MeasureDontCallThreadRun(method : java!MethodInvocation) {
rule MeasureDontCallThreadRun(method : java!MethodDeclaration) {
to
om: smm!ObservedMeasure (
measure <- noc,
......@@ -559,7 +559,7 @@ rule MeasureAvoidPrintStackTrace(method : java!MethodInvocation) {
}
-- creates a new Measure when Thread.run() is used instead of Thread.start()
rule measureAvoidThreadGroup(variable : java!VariableDeclarationFragment) {
rule measureAvoidThreadGroup(variable : java!VariableDeclarationStatement) {
to
om: smm!ObservedMeasure (
measure <- noc,
......
......@@ -5,7 +5,7 @@ library codestyle;
-- Rule for metrics AvoidDollarSigns : return the set of class Measures that violates the rule.
helper def: avoidDollarSigns() : Set(smm!Measure) =
-- Browse through all variable/method/class/interface.
java!TypeDeclaration.allInstances()->union(java!MethodDeclaration.allInstances())->union(java!VariableDeclaration.allInstances())->select(i | i.name.indexOf('$') <> -1)
java!TypeDeclaration.allInstances()->union(java!MethodDeclaration.allInstances())->union(java!VariableDeclaration.allInstances())-> reject(each | each.isProxy())->select(i | i.name.indexOf('$') <> -1)
->collect(i | thisModule.MesureAvoidDollarSigns(i));
-- Rule for metrics shortMethodName : return the set of method Measures that violates the rule.
......@@ -166,4 +166,4 @@ helper context java!ClassDeclaration def: isNotAllFieldsDeclaredAtStartOfClass()
endif
endif
)
endif;
\ No newline at end of file
endif;
......@@ -5,9 +5,10 @@ library multithreading;
--Goes through all the methods to check if the following rule is followed:
--Don't call Thread.run()
helper def: dontCallThreadRun() : Set(smm!Measure) =
java!MethodInvocation.allInstances()
-> select (m | m.method.name='run' )
-> select (m | m.method.abstractTypeDeclaration.name = 'Thread' )
java!MethodDeclaration.allInstances()
-> select (m | m.name='run' )
-> select (m | m.abstractTypeDeclaration <> OclUndefined )
-> select (m | m.abstractTypeDeclaration.name = 'Thread' )
-> collect (m | thisModule.MeasureDontCallThreadRun(m));
--------------------------------------------- AvoidThreadGroup ---------------------------------------------
......
Supports Markdown
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