Files
RobustToolbox/Robust.Shared/Analyzers/ObsoleteInheritanceAttribute.cs
Pieter-Jan Briers 72d893dec5 Add "obsolete inheritance" analyzer (#5858)
This allows us to make it obsolete to *inherit* from a class, and only that.

Intended so people stop inheriting UI controls for no good reason.

Fixes #5856
2025-04-19 17:29:17 +10:00

29 lines
791 B
C#

using System;
namespace Robust.Shared.Analyzers;
/// <summary>
/// Indicates that the ability to <i>inherit</i> this type is obsolete, and attempting to do so should give a warning.
/// </summary>
/// <remarks>
/// This is useful to gracefully deal with types that should never have had <see cref="VirtualAttribute"/>.
/// </remarks>
/// <seealso cref="VirtualAttribute"/>
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public sealed class ObsoleteInheritanceAttribute : Attribute
{
/// <summary>
/// An optional message provided alongside this obsoletion.
/// </summary>
public string? Message { get; }
public ObsoleteInheritanceAttribute()
{
}
public ObsoleteInheritanceAttribute(string message)
{
Message = message;
}
}