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:
parent
22deba8428
commit
053f7a2e85
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user