提交 fda7e2d5 authored 作者: Thomas Mueller's avatar Thomas Mueller

Limit line length to 80 characters

上级 69051adc
...@@ -18,6 +18,8 @@ import java.util.Arrays; ...@@ -18,6 +18,8 @@ import java.util.Arrays;
*/ */
public class CheckTextFiles { public class CheckTextFiles {
private static final int MAX_SOURCE_LINE_SIZE = 100;
// must contain "+" otherwise this here counts as well // must contain "+" otherwise this here counts as well
private static final String COPYRIGHT = "Copyright 2004-2013 " + private static final String COPYRIGHT = "Copyright 2004-2013 " +
"H2 Group."; "H2 Group.";
...@@ -164,6 +166,7 @@ public class CheckTextFiles { ...@@ -164,6 +166,7 @@ public class CheckTextFiles {
} }
} }
int line = 1; int line = 1;
int startLinePos = 0;
boolean lastWasWhitespace = false; boolean lastWasWhitespace = false;
for (int i = 0; i < data.length; i++) { for (int i = 0; i < data.length; i++) {
char ch = (char) (data[i] & 0xff); char ch = (char) (data[i] & 0xff);
...@@ -186,6 +189,13 @@ public class CheckTextFiles { ...@@ -186,6 +189,13 @@ public class CheckTextFiles {
} }
lastWasWhitespace = false; lastWasWhitespace = false;
line++; line++;
int lineLength = i - startLinePos;
if (lineLength > MAX_SOURCE_LINE_SIZE) {
if (file.getName().endsWith(".java")) {
fail(file, "line too long: " + lineLength, line);
}
}
startLinePos = i;
} else if (ch == '\r') { } else if (ch == '\r') {
if (!ALLOW_CR) { if (!ALLOW_CR) {
fail(file, "contains CR", line); fail(file, "contains CR", line);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论