use of net.sourceforge.pmd.stat.DataPoint in project pmd by pmd.
the class ExcessiveLengthRule method visit.
@Override
public Object visit(ApexNode<?> node, Object data) {
if (nodeClass.isInstance(node)) {
DataPoint point = new DataPoint();
point.setNode(node);
point.setScore(1.0 * (node.getEndLine() - node.getBeginLine()));
point.setMessage(getMessage());
addDataPoint(point);
}
return node.childrenAccept(this, data);
}
use of net.sourceforge.pmd.stat.DataPoint in project pmd by pmd.
the class ExcessiveNodeCountRule method visit.
@Override
public Object visit(ApexNode<?> node, Object data) {
int numNodes = 0;
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
Integer treeSize = (Integer) ((ApexNode<?>) node.jjtGetChild(i)).jjtAccept(this, data);
numNodes += treeSize;
}
if (nodeClass.isInstance(node)) {
DataPoint point = new DataPoint();
point.setNode(node);
point.setScore(1.0 * numNodes);
point.setMessage(getMessage());
addDataPoint(point);
}
return Integer.valueOf(numNodes);
}
use of net.sourceforge.pmd.stat.DataPoint in project pmd by pmd.
the class ExcessiveLengthRule method visit.
@Override
public Object visit(PLSQLNode node, Object data) {
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.finest("SimpleNode: line " + node.getBeginLine() + ", column " + node.getBeginColumn() + " - is node " + node.getClass().getCanonicalName() + " instanceof " + this.nodeClass.getClass().getCanonicalName());
}
if (nodeClass.isInstance(node)) {
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.finest("SimpleNode: YES node " + node.getClass().getCanonicalName() + " IS instanceof " + this.nodeClass.getClass().getCanonicalName() + " with length == (" + node.getEndLine() + " - " + node.getBeginLine() + " == " + (node.getEndLine() - node.getBeginLine()));
}
DataPoint point = new DataPoint();
point.setNode(node);
point.setScore(1.0 * (node.getEndLine() - node.getBeginLine()));
point.setMessage(getMessage());
addDataPoint(point);
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("SimpleNode: Score " + point.getScore() + " for " + this.nodeClass.getCanonicalName());
}
}
return node.childrenAccept(this, data);
}
use of net.sourceforge.pmd.stat.DataPoint in project pmd by pmd.
the class ExcessiveNodeCountRule method visit.
@Override
public Object visit(PLSQLNode node, Object data) {
int numNodes = 0;
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
Integer treeSize = (Integer) ((PLSQLNode) node.jjtGetChild(i)).jjtAccept(this, data);
numNodes += treeSize;
}
if (nodeClass.isInstance(node)) {
DataPoint point = new DataPoint();
point.setNode(node);
point.setScore(1.0 * numNodes);
point.setMessage(getMessage());
addDataPoint(point);
}
return Integer.valueOf(numNodes);
}
use of net.sourceforge.pmd.stat.DataPoint in project pmd by pmd.
the class NPathComplexityRule method visit.
@Override
public Object visit(ASTMethodDeclaration node, Object data) {
LOGGER.entering(CLASS_NAME, "visit(ASTMethodDeclaration)");
int npath = complexityMultipleOf(node, 1, data);
DataPoint point = new DataPoint();
point.setNode(node);
point.setScore(1.0 * npath);
point.setMessage(getMessage());
addDataPoint(point);
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.finest("NPath complexity: " + npath + " for line " + node.getBeginLine() + ", column " + node.getBeginColumn());
}
LOGGER.exiting(CLASS_NAME, "visit(ASTMethodDeclaration)", npath);
return Integer.valueOf(npath);
}
Aggregations