Skip to content

Commit

Permalink
wawa
Browse files Browse the repository at this point in the history
  • Loading branch information
RobynLlama committed Aug 3, 2024
1 parent b38eeb9 commit c72a47f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public override void RunChecks()

if (!info.Exists)
{
SetStateAndReason(CheckStatus.Fatal, $"Unable to open {FileName}");
SetStateAndReason(CheckStatus.Fatal, $"{FileName} not found");
return;
}

Expand Down
26 changes: 21 additions & 5 deletions src/ThunderstoreTestTool/TSPackage/Package.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ internal static class ExtMethod
internal static void GetValidationString(this BaseTSCheckRunner Runner, StringBuilder sb, int Indent)
{

if (Runner.State == CheckStatus.Pending)
return;

string Tabs(int n)
{
return new string(' ', n * 2);
Expand All @@ -64,20 +67,33 @@ string Tabs(int n)
//If the runner is a leaf output it's _Because_ value underneath it
if (Runner.MyChecks.Length == 0)
{
//Leaf
//Leaf runners

sb.Append(Tabs(Indent + 1));
sb.AppendLine(Runner.Because);
}
else
{
//Branch
foreach (var runner in Runner.MyChecks)
//Branch runners

//A runner that is fatal by its own pre-checks needs to output its because
if (Runner.State == CheckStatus.Fatal && Runner.Because is not null)
{
if (runner is BaseTSCheckRunner tsRunner)
sb.Append(Tabs(Indent + 1));
sb.AppendLine(Runner.Because);
}
else
{
//Descend into non-fatal runners
foreach (var runner in Runner.MyChecks)
{
tsRunner.GetValidationString(sb, Indent + 1);
if (runner is BaseTSCheckRunner tsRunner)
{
tsRunner.GetValidationString(sb, Indent + 1);
}
}
}

sb.AppendLine();
}

Expand Down

0 comments on commit c72a47f

Please sign in to comment.