⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 excessivelengthrule.java

📁 检查Java程序漏洞
💻 JAVA
字号:
/** * BSD-style license; for more info see http://pmd.sourceforge.net/license.html*/package net.sourceforge.pmd.rules.design;import net.sourceforge.pmd.ast.SimpleNode;import net.sourceforge.pmd.stat.DataPoint;import net.sourceforge.pmd.stat.StatisticalRule;/** * This is a common super class for things which * have excessive length. * * i.e. LongMethod and LongClass rules. * * To implement an ExcessiveLength rule, you pass * in the Class of node you want to check, and this * does the rest for you. */public class ExcessiveLengthRule extends StatisticalRule {    private Class nodeClass;    public ExcessiveLengthRule(Class nodeClass) {        this.nodeClass = nodeClass;    }    public Object visit(SimpleNode node, Object data) {        if (nodeClass.isInstance(node)) {            DataPoint point = new DataPoint();            point.setLineNumber(node.getBeginLine());            point.setScore(1.0 * (node.getEndLine() - node.getBeginLine()));            point.setRule(this);            point.setMessage(getMessage());            addDataPoint(point);        }        return node.childrenAccept(this, data);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -