1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-10 05:15:43 +00:00

[ci skip] Check for double blank lines in source validator

This commit is contained in:
Oliver Booth 2022-04-24 23:42:17 +01:00
parent 22deba8428
commit 053f7a2e85
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634

View File

@ -18,10 +18,27 @@ while (directories.Count > 0)
files++; files++;
await using var stream = File.OpenRead(file); await using var stream = File.OpenRead(file);
using var reader = new StreamReader(stream, Encoding.UTF8); using var reader = new StreamReader(stream, Encoding.UTF8);
var blankLine = false;
var lineNumber = 1; var lineNumber = 1;
while (await reader.ReadLineAsync() is { } line) 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) if (line.Length > 130)
{ {
Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.Red;