Checkstyle

This commit is contained in:
Clément Fournier
2019-04-02 09:35:44 +02:00
parent 1b7119ed64
commit 27803a198b
7 changed files with 13 additions and 22 deletions

View File

@ -69,7 +69,7 @@ abstract class AbstractCounterCheckRule<T extends JavaNode> extends AbstractJava
return data;
}
static abstract class AbstractLineLengthCheckRule<T extends JavaNode> extends AbstractCounterCheckRule<T> {
abstract static class AbstractLineLengthCheckRule<T extends JavaNode> extends AbstractCounterCheckRule<T> {
@SafeVarargs
AbstractLineLengthCheckRule(Class<T> nodeType, Class<? extends T>... concreteNodes) {

View File

@ -27,7 +27,8 @@ import net.sourceforge.pmd.properties.PropertyFactory;
*/
public class SwitchDensityRule extends AbstractJavaRulechainRule {
private final PropertyDescriptor<Double> reportLevel =
private static final PropertyDescriptor<Double> REPORT_LEVEL =
// can't use CommonPropertyDescriptors because we need a double property
PropertyFactory.doubleProperty("minimum")
.desc("Threshold above which a node is reported")
.require(positive())
@ -36,12 +37,13 @@ public class SwitchDensityRule extends AbstractJavaRulechainRule {
public SwitchDensityRule() {
super(ASTSwitchStatement.class);
definePropertyDescriptor(REPORT_LEVEL);
}
@Override
public Object visit(ASTSwitchStatement node, Object data) {
double density = new SwitchDensityVisitor().compute(node);
if (density >= getProperty(reportLevel)) {
if (density >= getProperty(REPORT_LEVEL)) {
addViolation(data, node);
}
return super.visit(node, data);

View File

@ -111,10 +111,9 @@ abstract class AbstractCounterCheckRule<T extends PLSQLNode> extends AbstractPLS
return data;
}
static abstract class AbstractLineLengthCheckRule<T extends PLSQLNode> extends AbstractCounterCheckRule<T> {
abstract static class AbstractLineLengthCheckRule<T extends PLSQLNode> extends AbstractCounterCheckRule<T> {
@SafeVarargs
AbstractLineLengthCheckRule(Class<T> nodeType, Class<? extends T>... concreteNodes) {
AbstractLineLengthCheckRule(Class<T> nodeType) {
super(nodeType);
}

View File

@ -38,8 +38,7 @@ public abstract class AbstractNcssCountRule<T extends PLSQLNode> extends Abstrac
*
* @param nodeClass class of node to count
*/
@SafeVarargs
AbstractNcssCountRule(Class<T> nodeClass, Class<? extends T>... concreteNodeTypes) {
AbstractNcssCountRule(Class<T> nodeClass) {
super(nodeClass);
}

View File

@ -4,11 +4,6 @@
package net.sourceforge.pmd.lang.plsql.rule.design;
import net.sourceforge.pmd.lang.plsql.ast.ASTMethodDeclaration;
import net.sourceforge.pmd.lang.plsql.ast.ASTProgramUnit;
import net.sourceforge.pmd.lang.plsql.ast.ASTTriggerTimingPointSection;
import net.sourceforge.pmd.lang.plsql.ast.ASTTriggerUnit;
import net.sourceforge.pmd.lang.plsql.ast.ASTTypeMethod;
import net.sourceforge.pmd.lang.plsql.ast.ExecutableCode;
/**
@ -17,12 +12,8 @@ import net.sourceforge.pmd.lang.plsql.ast.ExecutableCode;
*/
public class ExcessiveMethodLengthRule extends AbstractCounterCheckRule.AbstractLineLengthCheckRule<ExecutableCode> {
public ExcessiveMethodLengthRule() {
super(ExecutableCode.class,
ASTMethodDeclaration.class,
ASTProgramUnit.class,
ASTTriggerTimingPointSection.class,
ASTTriggerUnit.class,
ASTTypeMethod.class);
super(ExecutableCode.class
);
}
@Override

View File

@ -10,7 +10,7 @@ import net.sourceforge.pmd.lang.plsql.ast.OracleObject;
/**
* Non-commented source statement counter for Oracle Object declarations.
*
*
* @author Stuart Turton
*/
public class NcssObjectCountRule extends AbstractNcssCountRule<OracleObject> {
@ -31,7 +31,7 @@ public class NcssObjectCountRule extends AbstractNcssCountRule<OracleObject> {
protected boolean isIgnored(OracleObject node) {
// Treat Schema-level ProgramUnits as Oracle Objects, otherwise as
// subprograms
return node instanceof ASTProgramUnit &&!(node.jjtGetParent() instanceof ASTGlobal);
return node instanceof ASTProgramUnit && !(node.jjtGetParent() instanceof ASTGlobal);
}
@Override

View File

@ -20,7 +20,7 @@ public class ExcessiveTemplateLengthRule extends AbstractVmRule {
.defaultValue(1000)
.build();
ExcessiveTemplateLengthRule() {
public ExcessiveTemplateLengthRule() {
definePropertyDescriptor(REPORT_LEVEL);
addRuleChainVisit(ASTprocess.class);
}