protected void check(Statement s, Problems problems) { if (s == null) { return; } // shorthand statements are ignored inside alt statements INamedNode curr = s; while (curr != null) { if (curr instanceof Alt_Statement || curr instanceof Call_Statement) { return; } curr = curr.getNameParent(); } StatementBlock sb = s.getMyStatementBlock(); if (sb == null) { return; } Definition d = sb.getMyDefinition(); if (d == null) { return; } // shorthand statements are marked in functions, test cases and altsteps that have a 'runs on' // clause if (d instanceof Def_Function && ((Def_Function) d).getRunsOnType(timestamp) != null) { problems.report(s.getLocation(), ERROR_MESSAGE_PREFIX + typename + ERROR_MESSAGE_SUFFIX); return; } if (d instanceof Def_Altstep || d instanceof Def_Testcase) { problems.report(s.getLocation(), ERROR_MESSAGE_PREFIX + typename + ERROR_MESSAGE_SUFFIX); } }
protected void check(final Identifier identifier, final String description, Problems problems) { String displayName = identifier.getDisplayName(); if (VISIBILITY_PATTERN.matcher(displayName).matches()) { String msg = MessageFormat.format(REPORT, description, displayName); problems.report(identifier.getLocation(), msg); } }
protected void check(IValue expression, Problems problems) { if (expression instanceof Expression_Value) { ExpressionVisitor visitor = new ExpressionVisitor(); expression.accept(visitor); if (visitor.getCount() > reportTooComplexExpressionSize) { String msg = MessageFormat.format(COMPLEXITY, visitor.getCount(), reportTooComplexExpressionSize); problems.report(expression.getLocation(), msg); } } }