@Override public void visitNode(Tree tree) { FunctionTree declaration = (FunctionTree) tree; int nbLines = getNumberOfLines(declaration); if (nbLines > max) { context() .newIssue( this, String.format(MESSAGE, CheckUtils.getFunctionName(declaration), nbLines, max)) .tree(declaration); } }
@Override public void visitNode(AstNode astNode) { int nbLines = getNumberOfLine(astNode); if (nbLines > max) { getContext() .createLineViolation( this, "This function {0} has {1} lines, which is greater than the {2} lines authorized. Split it into smaller functions.", astNode, CheckUtils.getFunctionName(astNode), nbLines, max); } }