From 053f7a2e85dd9a80b5c98373057a067307e4492b Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sun, 24 Apr 2022 23:42:17 +0100 Subject: [PATCH] [ci skip] Check for double blank lines in source validator --- X10D.SourceValidator/Program.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/X10D.SourceValidator/Program.cs b/X10D.SourceValidator/Program.cs index 447a8ae..e9b001a 100644 --- a/X10D.SourceValidator/Program.cs +++ b/X10D.SourceValidator/Program.cs @@ -18,10 +18,27 @@ while (directories.Count > 0) files++; await using var stream = File.OpenRead(file); using var reader = new StreamReader(stream, Encoding.UTF8); + var blankLine = false; var lineNumber = 1; while (await reader.ReadLineAsync() is { } line) { + if (string.IsNullOrWhiteSpace(line)) + { + if (blankLine) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.Out.WriteLine($"{file}({lineNumber}): Double blank line"); + Console.ResetColor(); + } + + blankLine = true; + } + else + { + blankLine = false; + } + if (line.Length > 130) { Console.ForegroundColor = ConsoleColor.Red;