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
Yannis LE BARS
Source Code Analyzer
Commits
b524aa1e
Commit
b524aa1e
authored
Dec 19, 2019
by
Khaled AMIRAT
Browse files
Update src/main/atl/analysis.atl, src/main/atl/codestyle.atl, src/main/atl/errorProne.atl files
parent
5162f574
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/atl/analysis.atl
View file @
b524aa1e
...
...
@@ -99,7 +99,7 @@ helper def: allMeasures(project : java!Model): Set(smm!Measure) =
thisModule.emptySwitchStatement(),
thisModule.emptySynchronizedBlock(),
thisModule.emptyFinallyBlock(),
thisModule.emptyfinalizeMethod(),
--
thisModule.emptyfinalizeMethod(),
--thisModule.doNotThrowExceptionInFinally(),
--thisModule.finalizeShouldBeProtected(),
...
...
src/main/atl/codestyle.atl
View file @
b524aa1e
...
...
@@ -61,6 +61,17 @@ helper def: longVariable() : Set(smm!Measure) =
--------------------------------------------- ShortVariableName ---------------------------------------------
-- Rule for metrics shortVariableName : return the set of variables measures that violates the rule.
helper def: shortVariableName() : Set(smm!Measure) =
java!SingleVariableDeclaration.allInstances()
-> reject(each | each.isProxy() or not each.catchClause->oclIsUndefined() or not each.enhancedForStatement->oclIsUndefined())
-> select( i | i.name.size() < 3)
-> union( java!VariableDeclarationFragment.allInstances()
-> reject(each | each.isProxy() or each.variablesContainer.oclIsTypeOf(java!VariableDeclarationExpression))
-> select( i | i.name.size() < 3)
)
-> collect (i | thisModule.MesureShortVariableName(i));
----- Fix Issues #699
...
...
src/main/atl/errorProne.atl
View file @
b524aa1e
...
...
@@ -180,6 +180,41 @@ helper def: finalizeShouldBeProtected() : Set(smm!Measure) =
->select(m | m.name = 'finalize' and m.modifier.visibility.toString() <> 'protected')
->collect(m | thisModule.MesureFinalizeShouldBeProtected(m));
--------------------------------------------- EmptySwitchStatement ---------------------------------------------
--Detects the use of empty switch statements. These blocks serve no purpose and should be removed
helper def: emptySwitchStatement() : Set(smm!Measure) =
java!SwitchStatement.allInstances()
->select(switchStatement | switchStatement.statements.isEmpty())
->collect(switchStatement | thisModule.MeasureEmptySwitchStatement(switchStatement));
------------------------------------------ EmptySynchronizedBlock ---------------------------------------------
--Detects the use of empty synchronized block. These blocks serve no purpose and should be removed
helper def: emptySynchronizedBlock() : Set(smm!Measure) =
java!SynchronizedStatement.allInstances()
->select(synchronizedBlock | synchronizedBlock.body.statements.isEmpty() )
->collect(synchronizedBlock | thisModule.MeasureEmptySynchronizedBlock(synchronizedBlock));
---------------------------------------- EmptyFinallyBlock----------------------------------------------
-- Rule for metrics EmptyFinallyBlock
helper def: emptyFinallyBlock() : Set(smm!Measure) =
java!TryStatement.allInstances()
->select( finallyBlock | finallyBlock.finally.statements.isEmpty())
->collect(finallyBlock| thisModule.MeasureEmptyFinallyBlock(finallyBlock));
----------------------------------------- EmptyFinalizer----------------------------------------------
-- Rule for metrics EmptyFinalizer
helper def: emptyfinalizeMethod() : Set(smm!Measure) =
java!MethodDeclaration.allInstances()
->select( finalizeMethod | finalizeMethod.name = 'finalize' and finalizeMethod.body.statements.isEmpty())
->collect(finalizeMethod| thisModule. MeasureEmptyFinalizer(finalizeMethod));
--- Issues #780, #784, #799, #819, #862, #871
...
...
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