Files
RobustToolbox/Robust.Shared/Analyzers/MustCallBaseAttribute.cs
Pieter-Jan Briers 75b3431ee6 New "must call base" analyzer. (#5266)
* New "must call base" analyzer.

This enforces that you actually call base when overriding stuff. This is intended for base methods like entity system's, where server/client systems overriding shared ones SHOULD call Initialize() and such.

* Add MustCallBase to entity system methods
2024-06-28 14:44:49 +10:00

18 lines
592 B
C#

using System;
namespace Robust.Shared.Analyzers;
/// <summary>
/// Indicates that overriders of this method must always call the base function.
/// </summary>
/// <param name="onlyOverrides">
/// If true, only base calls to *overrides* are necessary.
/// This is intended for base classes where the base function is always empty,
/// so a base call from the first override may be ommitted.
/// </param>
[AttributeUsage(AttributeTargets.Method)]
public sealed class MustCallBaseAttribute(bool onlyOverrides = false) : Attribute
{
public bool OnlyOverrides { get; } = onlyOverrides;
}