diff --git a/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/rule/codestyle/CodeFormatRule.java b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/rule/codestyle/CodeFormatRule.java index 646286f4e5..b1176d7759 100644 --- a/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/rule/codestyle/CodeFormatRule.java +++ b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/rule/codestyle/CodeFormatRule.java @@ -31,8 +31,12 @@ import net.sourceforge.pmd.properties.PropertyFactory; public class CodeFormatRule extends AbstractPLSQLRule { - private static final PropertyDescriptor INDENTATION_PROPERTY = PropertyFactory.intProperty("indentation") - .desc("Indentation to be used for blocks").defaultValue(2).require(inRange(0, 32)).build(); + private static final PropertyDescriptor INDENTATION_PROPERTY = + PropertyFactory.intProperty("indentation") + .desc("Indentation to be used for blocks") + .defaultValue(2) + .require(inRange(0, 32)) + .build(); private int indentation = INDENTATION_PROPERTY.defaultValue(); @@ -207,7 +211,8 @@ public class CodeFormatRule extends AbstractPLSQLRule { public Object visit(ASTArgumentList node, Object data) { List arguments = node.findChildrenOfType(ASTArgument.class); - if (node.getEndColumn() > 120) { + // note: end column is exclusive + if (node.getEndColumn() >= 120) { addViolationWithMessage(data, node, "Line is too long, please split parameters on separate lines"); return super.visit(node, data); } @@ -229,7 +234,7 @@ public class CodeFormatRule extends AbstractPLSQLRule { if (argument.getChild(0) instanceof ASTUnqualifiedID) { if (argument.getChild(0).getEndColumn() > longestParameterEndColumn) { - longestParameterEndColumn = argument.getChild(0).getEndColumn(); + longestParameterEndColumn = argument.getChild(0).getEndColumn() - 1; } } }