Commit fcc4de67 authored by Astlo's avatar Astlo
Browse files

Fix avoidDollarSigns

parent 0ab6de45
......@@ -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.
......@@ -59,6 +59,8 @@ helper def: longVariable() : Set(smm!Measure) =
-> select( variable | variable.name.size() > 17)
-> collect (variable | thisModule.MeasureLongVariable(variable));
--------------------------------------------- ShortVariableName ---------------------------------------------
-- Rule for metrics shortVariableName : return the set of variables measures that violates the rule.
helper def: shortVariableName() : Set(smm!Measure) =
......@@ -85,27 +87,6 @@ helper def: noPackageDeclaration() : Set(smm!Measure) =
->collect(err | thisModule.MesureAvoidNoPackageDeclaration(err));
--------------------------------------------- GenericsNaming ---------------------------------------------
-- Rule for metrics GenericsNaming
helper def: genericsNaming() : Set(smm!Measure) =
java!TypeParameter.allInstances()
-> reject(type | type.name.size() = 1 and type.name.substring(1,1) = type.name.substring(1,1).toUpper())
-> collect(type | thisModule.MeasureGenericsNaming(type));
--------------------------------------------- MisLeadingVariableName ---------------------------------------------
-- Rule for metrics MisLeadingVariableName
helper def: misLeadingVariableName() : Set(smm!Measure) =
java!VariableDeclarationFragment.allInstances()
-> reject(variable | variable.variablesContainer.oclIsTypeOf(java!FieldDeclaration))
-> union(java!SingleVariableDeclaration.allInstances())
-> select(variable | variable.name.size() >= 2)
-> select(variable | variable.name.substring(1,2) = 'm_')
-> collect(variable | thisModule.MeasureMisLeadingVariableName(variable));
--------------------------------------------- IfStmtsMustUseBraces ---------------------------------------------
-- Helper for issue IfStmtsMustUseBraces : return a Measure for each class that contains an if statement without braces.
helper def: IfBraces() : Set(smm!Measure) =
java!IfStatement.allInstances()
-> select(i | i.thenStatement <> OclUndefined)
-> select(i | not i.thenStatement.oclIsTypeOf(java!Block))
-> collect(i | thisModule.MeasureIfStmtsMustUseBraces(i));
\ No newline at end of file
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