Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/validation/CodeStyleValidator.xtend +44 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,8 @@ import static extension de.ugoe.cs.swe.common.TTCN3ReferenceHelper.* import static extension de.ugoe.cs.swe.common.TTCN3ScopeHelper.* import static extension org.eclipse.emf.ecore.util.EcoreUtil.* import static extension org.eclipse.xtext.EcoreUtil2.* import de.ugoe.cs.swe.tTCN3.ValueofOp import de.ugoe.cs.swe.tTCN3.Value class CheckDefinitionComeFirstParameter { public boolean hasOtherDefinitions Loading Loading @@ -865,6 +867,48 @@ class CodeStyleValidator extends AbstractDeclarativeValidator { return !found } @Check def checkNoValueOfForValues(ValueofOp templateOp) { //TODO: add property, update version // if (!activeProfile.checkNoValueOfForValues) // return; // only consider templates with a type // if (template.type == null) // return; //TODO: overly specific.. val expr = templateOp.template.template.simple.expr // .ref.head if (expr instanceof Value) { if (expr.ref !== null) { if (expr.ref.referencedValue instanceof SingleTempVarInstance) { return } //TODO: other conditions? } else { //TODO: check further? return } } else { //TODO: check further? return } statistics.incrementCountStyle val message = "ValueOf operation is used on a value!" val INode node = NodeModelUtils.getNode(templateOp) warning( message, null, MessageClass.STYLE.toString, node.startLine.toString, node.endLine.toString, //TODO: add proper section id "6.XX, " + MiscTools.getMethodName() ); } @Check def checkNoInlineTemplates(InLineTemplate template) { if (!activeProfile.checkNoInlineTemplates) Loading Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/validation/CodeStyleValidator.xtend +44 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,8 @@ import static extension de.ugoe.cs.swe.common.TTCN3ReferenceHelper.* import static extension de.ugoe.cs.swe.common.TTCN3ScopeHelper.* import static extension org.eclipse.emf.ecore.util.EcoreUtil.* import static extension org.eclipse.xtext.EcoreUtil2.* import de.ugoe.cs.swe.tTCN3.ValueofOp import de.ugoe.cs.swe.tTCN3.Value class CheckDefinitionComeFirstParameter { public boolean hasOtherDefinitions Loading Loading @@ -865,6 +867,48 @@ class CodeStyleValidator extends AbstractDeclarativeValidator { return !found } @Check def checkNoValueOfForValues(ValueofOp templateOp) { //TODO: add property, update version // if (!activeProfile.checkNoValueOfForValues) // return; // only consider templates with a type // if (template.type == null) // return; //TODO: overly specific.. val expr = templateOp.template.template.simple.expr // .ref.head if (expr instanceof Value) { if (expr.ref !== null) { if (expr.ref.referencedValue instanceof SingleTempVarInstance) { return } //TODO: other conditions? } else { //TODO: check further? return } } else { //TODO: check further? return } statistics.incrementCountStyle val message = "ValueOf operation is used on a value!" val INode node = NodeModelUtils.getNode(templateOp) warning( message, null, MessageClass.STYLE.toString, node.startLine.toString, node.endLine.toString, //TODO: add proper section id "6.XX, " + MiscTools.getMethodName() ); } @Check def checkNoInlineTemplates(InLineTemplate template) { if (!activeProfile.checkNoInlineTemplates) Loading