Skip to content

Commit

Permalink
Merge pull request #30 from hongaaronc/update-bg-consistency-diffnames
Browse files Browse the repository at this point in the history
Change messaging format in BgOffsetConsistencyCheck to match KiaiConsistencyCheck
  • Loading branch information
Hiviexd committed Feb 29, 2024
2 parents 3860885 + 9fe0325 commit a8099c2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 37 deletions.
51 changes: 17 additions & 34 deletions Checks/Design/BgOffsetConsistencyCheck.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Numerics;
using System.Text;

using MapsetParser.objects;

Expand All @@ -22,7 +21,7 @@ public override CheckMetadata GetMetadata() =>
{
Author = "Nostril",
Category = "Design",
Message = "Background offset inconsistency",
Message = "Background offset inconsistencies",
Documentation = new Dictionary<string, string>()
{
{
Expand All @@ -43,10 +42,10 @@ Background offset should generally be consistent across difficulties."
{
_MINOR,
new IssueTemplate(LEVEL_MINOR,
"\"{0}\" has {1} unique offsets: {2}",
"filename",
"# found",
"enumerated list")
"\"{0}\" {1}: ({2})",
"Filename",
"Offset Coordinates",
"List of Difficulties")
.WithCause("Background offset is inconsistent across difficulties. Make sure this is intentional.")
}
};
Expand Down Expand Up @@ -78,35 +77,19 @@ public override IEnumerable<Issue> GetIssues(BeatmapSet beatmapSet)
continue;
}

var outputString = convertOffsetsToString(offsets);

yield return new Issue(
GetTemplate(_MINOR),
null,
fileName,
offsets.Count,
outputString
);
}
}

private string convertOffsetsToString(Dictionary<Vector2?, HashSet<string>> offsets)
{
if (offsets == null)
{
return null;
}

StringBuilder sb = new StringBuilder();
foreach (var offset in offsets) {
sb.Append(offset.Key);
sb.Append(" (");
sb.Append(string.Join(", ", offset.Value));
sb.Append("), ");
foreach (var offset in offsets)
{
var offsetCoords = offset.Key;
var diffNames = string.Join(", ", offset.Value);
yield return new Issue(
GetTemplate(_MINOR),
null,
fileName,
offsetCoords,
diffNames
);
}
}
sb.Remove(sb.Length - 2, 2); // Remove last trailing comma + space

return sb.ToString();
}
}
}
8 changes: 5 additions & 3 deletions Checks/Timing/KiaiConsistencyCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ Kiais should generally be consistent across difficulties (except in GDs)."
{
_MINOR,
new IssueTemplate(LEVEL_MINOR,
"{0}",
"List of Difficulty Names")
"Group {0}: ({1})",
"Kiai Group #",
"List of Difficulties")
.WithCause("Kiai start and end times are not aligned across difficulties.")
}
};
Expand Down Expand Up @@ -77,7 +78,8 @@ public override IEnumerable<Issue> GetIssues(BeatmapSet beatmapSet)
yield return new Issue(
GetTemplate(_MINOR),
null,
"Group " + (i + 1).ToString() + ": (" + string.Join(", ", diffNameStrings[i]) + ")"
(i + 1).ToString(),
string.Join(", ", diffNameStrings[i])
);
}
}
Expand Down

0 comments on commit a8099c2

Please sign in to comment.