#1055 Fix verifyMessages task not to shift comments up

This commit is contained in:
ljacqu 2017-01-14 12:10:33 +01:00
parent e1eb382cb1
commit d761b0ee5c

View File

@ -38,19 +38,17 @@ public class MessageFileElementReader {
private void loadElements(Path path) { private void loadElements(Path path) {
List<String> currentCommentSection = new ArrayList<>(10); List<String> currentCommentSection = new ArrayList<>(10);
for (String line : FileIoUtils.readLinesFromFile(path)) { for (String line : FileIoUtils.readLinesFromFile(path)) {
if (isTodoComment(line)) {
continue;
}
if (isCommentLine(line)) { if (isCommentLine(line)) {
currentCommentSection.add(line); currentCommentSection.add(line);
} else if (MessageFileEntry.isMessageEntry(line)) { } else {
if (!currentCommentSection.isEmpty()) { if (!currentCommentSection.isEmpty()) {
processTempCommentsList(currentCommentSection); processTempCommentsList(currentCommentSection);
} }
elements.add(new MessageFileEntry(line)); if (MessageFileEntry.isMessageEntry(line)) {
} else { elements.add(new MessageFileEntry(line));
throw new IllegalStateException("Could not match line '" + line + "' to any type"); } else if (!isTodoComment(line)) {
throw new IllegalStateException("Could not match line '" + line + "' to any type");
}
} }
} }
} }
@ -69,7 +67,8 @@ public class MessageFileElementReader {
} }
private static boolean isCommentLine(String line) { private static boolean isCommentLine(String line) {
return line.trim().isEmpty() || line.trim().startsWith("#"); return !isTodoComment(line)
&& (line.trim().isEmpty() || line.trim().startsWith("#"));
} }
private static boolean isTodoComment(String line) { private static boolean isTodoComment(String line) {