All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.pmd.lang.apex.rule.design.NcssMethodCountRule Maven / Gradle / Ivy

/**
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
 */

package net.sourceforge.pmd.lang.apex.rule.design;

import net.sourceforge.pmd.lang.apex.ast.ASTMethod;

/**
 * Non-commented source statement counter for methods.
 *
 * @author ported from Java original of Jason Bennett
 */
public class NcssMethodCountRule extends AbstractNcssCountRule {

    /**
     * Count the size of all non-constructor methods.
     */
    public NcssMethodCountRule() {
        super(ASTMethod.class);
    }

    @Override
    protected int defaultReportLevel() {
        return 40;
    }

    @Override
    protected boolean isIgnored(ASTMethod node) {
        return node.isConstructor();
    }

    @Override
    protected Object[] getViolationParameters(ASTMethod node, int metric, int limit) {
        return new Object[]{ node.getImage(), metric, limit };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy