fix: Mark remaining as obsolete

This commit is contained in:
Kaz Wolfe 2025-09-11 10:20:29 -07:00
parent 77a15a533d
commit a1cc4fa91b
No known key found for this signature in database
GPG key ID: 258813F53A16EBB4
3 changed files with 57 additions and 18 deletions

View file

@ -14,6 +14,11 @@ namespace Dalamud.Test.Compliance;
public class PublicApiTests
{
private static List<Type> IgnoredTypes { get; } =
[
typeof(Utility.CStringExtensions),
];
private static List<Assembly> PermittedAssemblies { get; } =
[
typeof(object).Assembly,
@ -38,7 +43,7 @@ public class PublicApiTests
[Fact]
public void NoRestrictedTypes()
{
foreach (var type in typeof(Dalamud).Assembly.GetTypes().Where(t => t.IsPublic))
foreach (var type in typeof(Dalamud).Assembly.GetTypes().Where(t => t.IsPublic).Except(IgnoredTypes))
{
if (type.GetCustomAttribute<ObsoleteAttribute>() != null) continue;
@ -48,14 +53,14 @@ public class PublicApiTests
if (!this.IsPermittedType(m.ReturnType))
{
Assert.Fail($"Method {type.FullName}.{m.Name} returns invalid type: {m.ReturnType.FullName}");
Assert.Fail($"Method {type.FullName}.{m.Name} returns unapproved type: {m.ReturnType.FullName}");
}
foreach (var param in m.GetParameters())
{
if (!this.IsPermittedType(param.ParameterType))
{
Assert.Fail($"Method {type.FullName}.{m.Name} uses invalid type: {param.ParameterType.FullName}");
Assert.Fail($"Method {type.FullName}.{m.Name} uses unapproved type: {param.ParameterType.FullName}");
}
}
}
@ -68,7 +73,7 @@ public class PublicApiTests
if (!this.IsPermittedType(p.PropertyType))
{
Assert.Fail(
$"Property {type.FullName}.{p.Name} is invalid type: {p.PropertyType.FullName}");
$"Property {type.FullName}.{p.Name} is unapproved type: {p.PropertyType.FullName}");
}
}
@ -79,7 +84,7 @@ public class PublicApiTests
if (!this.IsPermittedType(f.FieldType))
{
Assert.Fail(
$"Field {type.FullName}.{f.Name} is invalid type: {f.FieldType.FullName}");
$"Field {type.FullName}.{f.Name} is unapproved type: {f.FieldType.FullName}");
}
}
}