[xtro] Do not allow to leave empty todo files in xtro. (#12090)

To avoid things like the ones fixed in https://github.com/xamarin/xamarin-macios/pull/12088 we add a new
test to ensure that todo files do have content.
This commit is contained in:
Manuel de la Pena 2021-07-12 09:44:11 -04:00 коммит произвёл GitHub
Родитель 7ad807a4c3
Коммит cd1145d169
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 15 добавлений и 0 удалений

Просмотреть файл

@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
@ -169,6 +170,17 @@ namespace Extrospection {
}
}
static void NoEmptyTodo ()
{
foreach (var file in Directory.GetFiles (directory, "*.todo")) {
if (!IsIncluded (file))
continue;
if (!(File.ReadLines(file).Count() > 0)) {
Log ($"?empty-todo? File '{Path.GetFileName (file)}' is empty. Empty todo files should be removed.");
}
}
}
static string directory;
static Dictionary<string, List<string>> commons = new Dictionary<string, List<string>> ();
static int count;
@ -301,6 +313,9 @@ namespace Extrospection {
// entries in .todo should be found in .raw files - else it's likely fixed (and out of date)
NoFixedTodo ();
// empty files should be removed
NoEmptyTodo ();
if (count == 0)
Console.WriteLine ("Sanity check passed");
else