Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ronan GUEGUEN
Source Code Analyzer
Commits
f85b6e47
Commit
f85b6e47
authored
Dec 21, 2019
by
Gerson Sunyé
Browse files
Merge branch 'master' of gitlab.univ-nantes.fr:naomod/mde/projet-2019
parents
3bc7c1e5
b46d78d0
Changes
4
Hide whitespace changes
Inline
Side-by-side
input/.gitignore
0 → 100644
View file @
f85b6e47
/org.eclipse.jdt.source.all.xmi
src/main/atl/analysis.atl
View file @
f85b6e47
...
...
@@ -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!Method
Invoc
ation) {
rule MeasureDontCallThreadRun(method : java!Method
Declar
ation) {
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!VariableDeclaration
Frag
ment) {
rule measureAvoidThreadGroup(variable : java!VariableDeclaration
State
ment) {
to
om: smm!ObservedMeasure (
measure <- noc,
...
...
src/main/atl/codestyle.atl
View file @
f85b6e47
...
...
@@ -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;
src/main/atl/multithreading.atl
View file @
f85b6e47
...
...
@@ -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 ---------------------------------------------
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment