diff --git a/.editorconfig b/.editorconfig index 5d2fd31e31..da4026108e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -616,6 +616,9 @@ dotnet_code_quality.api_surface = all #dotnet_code_quality.CA1010.additional_required_generic_interfaces = dotnet_diagnostic.CA1010.severity = warning +# Mark attributes with 'AttributeUsageAttribute'. +dotnet_diagnostic.CA1018.severity = warning + # Provide ObsoleteAttribute message. dotnet_diagnostic.CA1041.severity = warning diff --git a/OpenRA.Game/Scripting/ScriptContext.cs b/OpenRA.Game/Scripting/ScriptContext.cs index 421addf371..37b47821b1 100644 --- a/OpenRA.Game/Scripting/ScriptContext.cs +++ b/OpenRA.Game/Scripting/ScriptContext.cs @@ -33,6 +33,7 @@ namespace OpenRA.Scripting } // For traitinfos that provide actor / player commands + [AttributeUsage(AttributeTargets.Class)] public sealed class ScriptPropertyGroupAttribute : Attribute { public readonly string Category; @@ -40,8 +41,10 @@ namespace OpenRA.Scripting } // For property groups that are safe to initialize invoke on destroyed actors + [AttributeUsage(AttributeTargets.Class)] public sealed class ExposedForDestroyedActors : Attribute { } + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] public sealed class ScriptActorPropertyActivityAttribute : Attribute { } public abstract class ScriptActorProperties @@ -115,6 +118,7 @@ namespace OpenRA.Scripting } } + [AttributeUsage(AttributeTargets.Class)] public sealed class ScriptGlobalAttribute : Attribute { public readonly string Name; diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 56c6a61ca1..de5df6f145 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -23,6 +23,7 @@ using OpenRA.Support; namespace OpenRA.Traits { + [AttributeUsage(AttributeTargets.Interface)] public sealed class RequireExplicitImplementationAttribute : Attribute { } [Flags]