From c5c1063342aefbeda91e5c42f62f7d64236380a6 Mon Sep 17 00:00:00 2001 From: samatstarion Date: Sun, 29 Dec 2024 21:04:35 +0100 Subject: [PATCH] [Update] handlebars helpers to use the discard parameter instead (_) --- uml4net.HandleBars/ClassHelper.cs | 18 ++++++------- uml4net.HandleBars/DecoratorHelper.cs | 14 +++++----- uml4net.HandleBars/DocumentationHelper.cs | 4 +-- uml4net.HandleBars/EnumHelper.cs | 2 +- uml4net.HandleBars/GeneralizationHelper.cs | 4 +-- uml4net.HandleBars/PropertyHelper.cs | 30 +++++++++++----------- uml4net.HandleBars/StringHelper.cs | 4 +-- uml4net.HandleBars/TypeNameHelper.cs | 2 +- 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/uml4net.HandleBars/ClassHelper.cs b/uml4net.HandleBars/ClassHelper.cs index dc5f168e..4a5fdb40 100644 --- a/uml4net.HandleBars/ClassHelper.cs +++ b/uml4net.HandleBars/ClassHelper.cs @@ -40,7 +40,7 @@ public static class ClassHelper /// public static void RegisterClassHelper(this IHandlebars handlebars) { - handlebars.RegisterHelper("Class.QueryAllProperties", (context, parameters) => + handlebars.RegisterHelper("Class.QueryAllProperties", (context, _) => { if (!(context.Value is IClass @class)) { @@ -52,7 +52,7 @@ public static void RegisterClassHelper(this IHandlebars handlebars) return properties; }); - handlebars.RegisterHelper("Class.QueryAllContainedProperties", (context, parameters) => + handlebars.RegisterHelper("Class.QueryAllContainedProperties", (context, _) => { if (!(context.Value is IClass @class)) { @@ -66,7 +66,7 @@ public static void RegisterClassHelper(this IHandlebars handlebars) return properties; }); - handlebars.RegisterHelper("Class.QueryAllContainedNonDerivedProperties", (context, parameters) => + handlebars.RegisterHelper("Class.QueryAllContainedNonDerivedProperties", (context, _) => { if (!(context.Value is IClass @class)) { @@ -81,7 +81,7 @@ public static void RegisterClassHelper(this IHandlebars handlebars) return properties; }); - handlebars.RegisterHelper("Class.QueryAllContainedNonDerivedNonRedefinedProperties", (context, parameters) => + handlebars.RegisterHelper("Class.QueryAllContainedNonDerivedNonRedefinedProperties", (context, _) => { if (!(context.Value is IClass @class)) { @@ -110,7 +110,7 @@ public static void RegisterClassHelper(this IHandlebars handlebars) return nonRedefinedProperties; }); - handlebars.RegisterHelper("Class.QueryAllNonDerivedProperties", (context, parameters) => + handlebars.RegisterHelper("Class.QueryAllNonDerivedProperties", (context, _) => { if (!(context.Value is IClass @class)) { @@ -124,7 +124,7 @@ public static void RegisterClassHelper(this IHandlebars handlebars) return properties; }); - handlebars.RegisterHelper("Class.QueryAllNonDerivedNonReadOnlyProperties", (context, parameters) => + handlebars.RegisterHelper("Class.QueryAllNonDerivedNonReadOnlyProperties", (context, _) => { if (!(context.Value is IClass @class)) { @@ -138,7 +138,7 @@ public static void RegisterClassHelper(this IHandlebars handlebars) return properties; }); - handlebars.RegisterHelper("Class.QueryAllNonDerivedNonReadOnlyProperties", (context, parameters) => + handlebars.RegisterHelper("Class.QueryAllNonDerivedNonReadOnlyProperties", (context, _) => { if (!(context.Value is IClass @class)) { @@ -152,7 +152,7 @@ public static void RegisterClassHelper(this IHandlebars handlebars) return properties; }); - handlebars.RegisterHelper("Class.QueryAllNonDerivedNonReadOnlyNonContainedReferenceEnumerableProperties", (context, parameters) => + handlebars.RegisterHelper("Class.QueryAllNonDerivedNonReadOnlyNonContainedReferenceEnumerableProperties", (context, _) => { if (!(context.Value is IClass @class)) { @@ -171,7 +171,7 @@ public static void RegisterClassHelper(this IHandlebars handlebars) return properties; }); - handlebars.RegisterHelper("Class.QueryAllNonDerivedNonReadOnlyNonContainedNonRedefinedReferenceEnumerableProperties", (context, parameters) => + handlebars.RegisterHelper("Class.QueryAllNonDerivedNonReadOnlyNonContainedNonRedefinedReferenceEnumerableProperties", (context, _) => { if (!(context.Value is IClass @class)) { diff --git a/uml4net.HandleBars/DecoratorHelper.cs b/uml4net.HandleBars/DecoratorHelper.cs index d4166584..6df30671 100644 --- a/uml4net.HandleBars/DecoratorHelper.cs +++ b/uml4net.HandleBars/DecoratorHelper.cs @@ -45,7 +45,7 @@ public static class DecoratorHelper /// public static void RegisterDecoratorHelper(this IHandlebars handlebars) { - handlebars.RegisterHelper("Decorator.WriteClassAttribute", (writer, context, parameters) => + handlebars.RegisterHelper("Decorator.WriteClassAttribute", (writer, context, _) => { if (!(context.Value is IClass @class)) { @@ -60,7 +60,7 @@ public static void RegisterDecoratorHelper(this IHandlebars handlebars) writer.WriteSafeString(classAttribute); }); - handlebars.RegisterHelper("Decorator.WriteImplementsAttribute", (writer, context, parameters) => + handlebars.RegisterHelper("Decorator.WriteImplementsAttribute", (writer, context, _) => { if (!(context.Value is IProperty property)) { @@ -76,7 +76,7 @@ public static void RegisterDecoratorHelper(this IHandlebars handlebars) writer.WriteSafeString(implementsAttribute); }); - handlebars.RegisterHelper("Decorator.WritePropertyAttribute", (writer, context, parameters) => + handlebars.RegisterHelper("Decorator.WritePropertyAttribute", (writer, context, _) => { if (!(context.Value is IProperty property)) { @@ -105,7 +105,7 @@ public static void RegisterDecoratorHelper(this IHandlebars handlebars) writer.WriteSafeString($"{propertyAttribute}" + Environment.NewLine); }); - handlebars.RegisterHelper("Decorator.WriteRedefinedPropertyAttribute", (writer, context, parameters) => + handlebars.RegisterHelper("Decorator.WriteRedefinedPropertyAttribute", (writer, context, _) => { if (!(context.Value is IProperty property)) { @@ -125,7 +125,7 @@ public static void RegisterDecoratorHelper(this IHandlebars handlebars) } }); - handlebars.RegisterHelper("Decorator.WriteRedefinedByPropertyAttribute", (writer, context, parameters) => + handlebars.RegisterHelper("Decorator.WriteRedefinedByPropertyAttribute", (writer, _, parameters) => { if (parameters.Length != 2) { @@ -142,7 +142,7 @@ public static void RegisterDecoratorHelper(this IHandlebars handlebars) } }); - handlebars.RegisterHelper("Decorator.WriteSubsettedPropertyAttribute", (writer, context, parameters) => + handlebars.RegisterHelper("Decorator.WriteSubsettedPropertyAttribute", (writer, context, _) => { if (!(context.Value is IProperty property)) { @@ -162,7 +162,7 @@ public static void RegisterDecoratorHelper(this IHandlebars handlebars) } }); - handlebars.RegisterHelper("Decorator.WriteImplementsAttribute", (writer, context, parameters) => + handlebars.RegisterHelper("Decorator.WriteImplementsAttribute", (writer, context, _) => { if (!(context.Value is IProperty property)) { diff --git a/uml4net.HandleBars/DocumentationHelper.cs b/uml4net.HandleBars/DocumentationHelper.cs index 64c539ae..1b63b40a 100644 --- a/uml4net.HandleBars/DocumentationHelper.cs +++ b/uml4net.HandleBars/DocumentationHelper.cs @@ -40,7 +40,7 @@ public static class DocumentationHelper /// public static void RegisteredDocumentationHelper(this IHandlebars handlebars) { - handlebars.RegisterHelper("Documentation", (writer, context, parameters) => + handlebars.RegisterHelper("Documentation", (writer, context, _) => { if (!(context.Value is IElement eModelElement)) { @@ -55,7 +55,7 @@ public static void RegisteredDocumentationHelper(this IHandlebars handlebars) writer.WriteSafeString($"/// {Environment.NewLine}"); }); - handlebars.RegisterHelper("RawDocumentation", (writer, context, parameters) => + handlebars.RegisterHelper("RawDocumentation", (writer, context, _) => { if (!(context.Value is IElement element)) { diff --git a/uml4net.HandleBars/EnumHelper.cs b/uml4net.HandleBars/EnumHelper.cs index 3375332e..3fc489bd 100644 --- a/uml4net.HandleBars/EnumHelper.cs +++ b/uml4net.HandleBars/EnumHelper.cs @@ -57,7 +57,7 @@ public static string EnumToString(TEnum enumValue) where TEnum : Enum /// public static void RegisterEnumHelper(this IHandlebars handlebars) { - handlebars.RegisterHelper("Enum.ToString", (writer, context, parameters) => + handlebars.RegisterHelper("Enum.ToString", (writer, _, parameters) => { if (parameters.Length != 1) { diff --git a/uml4net.HandleBars/GeneralizationHelper.cs b/uml4net.HandleBars/GeneralizationHelper.cs index 38809071..bc9328eb 100644 --- a/uml4net.HandleBars/GeneralizationHelper.cs +++ b/uml4net.HandleBars/GeneralizationHelper.cs @@ -40,7 +40,7 @@ public static class GeneralizationHelper /// public static void RegisterGeneralizationHelper(this IHandlebars handlebars) { - handlebars.RegisterHelper("Generalization.Interfaces", (writer, context, parameters) => + handlebars.RegisterHelper("Generalization.Interfaces", (writer, context, _) => { if (!(context.Value is IClass @class)) { @@ -55,7 +55,7 @@ public static void RegisterGeneralizationHelper(this IHandlebars handlebars) } }); - handlebars.RegisterHelper("Generalization.Classes", (writer, context, parameters) => + handlebars.RegisterHelper("Generalization.Classes", (writer, context, _) => { if (!(context.Value is IClass @class)) { diff --git a/uml4net.HandleBars/PropertyHelper.cs b/uml4net.HandleBars/PropertyHelper.cs index c8bfd802..589e7809 100644 --- a/uml4net.HandleBars/PropertyHelper.cs +++ b/uml4net.HandleBars/PropertyHelper.cs @@ -73,7 +73,7 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) } }); - handlebars.RegisterHelper("Property.QueryStructuralFeatureNameEqualsEnclosingType", (context, arguments) => + handlebars.RegisterHelper("Property.QueryStructuralFeatureNameEqualsEnclosingType", (_, arguments) => { if (arguments.Length != 2) { @@ -104,7 +104,7 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) } }); - handlebars.RegisterHelper("Property.QueryIsEnum", (context, arguments) => + handlebars.RegisterHelper("Property.QueryIsEnum", (_, arguments) => { if (arguments.Length != 1) { @@ -116,7 +116,7 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) return property.QueryIsEnum(); }); - handlebars.RegisterHelper("Property.IsEnum", (context, arguments) => + handlebars.RegisterHelper("Property.IsEnum", (_, arguments) => { if (arguments.Length != 1) { @@ -128,7 +128,7 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) return property.QueryIsEnum(); }); - handlebars.RegisterHelper("Property.QueryIsBool", (context, arguments) => + handlebars.RegisterHelper("Property.QueryIsBool", (_, arguments) => { if (arguments.Length != 1) { @@ -140,7 +140,7 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) return property.QueryIsBool(); }); - handlebars.RegisterHelper("Property.QueryIsNumeric", (context, arguments) => + handlebars.RegisterHelper("Property.QueryIsNumeric", (_, arguments) => { if (arguments.Length != 1) { @@ -152,7 +152,7 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) return property.QueryIsNumeric(); }); - handlebars.RegisterHelper("Property.QueryIsInteger", (context, arguments) => + handlebars.RegisterHelper("Property.QueryIsInteger", (_, arguments) => { if (arguments.Length != 1) { @@ -164,7 +164,7 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) return property?.Type?.Name.ToLowerInvariant().Contains("int"); }); - handlebars.RegisterHelper("Property.QueryIsFloat", (context, arguments) => + handlebars.RegisterHelper("Property.QueryIsFloat", (_, arguments) => { if (arguments.Length != 1) { @@ -175,7 +175,7 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) return typeName is not null && (typeName.Contains("single") || typeName.Contains("float")); }); - handlebars.RegisterHelper("Property.QueryIsDouble", (context, arguments) => + handlebars.RegisterHelper("Property.QueryIsDouble", (_, arguments) => { if (arguments.Length != 1) { @@ -186,7 +186,7 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) return typeName?.Contains("double"); }); - handlebars.RegisterHelper("Property.QueryIsDateTime", (context, arguments) => + handlebars.RegisterHelper("Property.QueryIsDateTime", (_, arguments) => { if (arguments.Length != 1) { @@ -197,7 +197,7 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) return typeName?.Contains("date"); }); - handlebars.RegisterHelper("Property.QueryHasDefaultValue", (context, arguments) => + handlebars.RegisterHelper("Property.QueryHasDefaultValue", (_, arguments) => { if (arguments.Length != 1) { @@ -209,7 +209,7 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) return property.QueryHasDefaultValue(); }); - handlebars.RegisterHelper("Property.QueryIsContainment", (context, arguments) => + handlebars.RegisterHelper("Property.QueryIsContainment", (context, _) => { if (!(context.Value is IProperty property)) { @@ -219,7 +219,7 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) return property.QueryIsContainment(); }); - handlebars.RegisterHelper("Property.WriteTypeName", (writer, context, parameters) => + handlebars.RegisterHelper("Property.WriteTypeName", (writer, context, _) => { if (!(context.Value is IProperty property)) { @@ -231,7 +231,7 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) writer.WriteSafeString($"{typeName}"); }); - handlebars.RegisterHelper("Property.WriteUpperValue", (writer, context, arguments) => + handlebars.RegisterHelper("Property.WriteUpperValue", (writer, context, _) => { if (!(context.Value is IProperty property)) { @@ -243,7 +243,7 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) writer.WriteSafeString($"{upperValue}"); }); - handlebars.RegisterHelper("Property.WriteForInterface", (writer, context, arguments) => + handlebars.RegisterHelper("Property.WriteForInterface", (writer, context, _) => { if (!(context.Value is IProperty property)) { @@ -308,7 +308,7 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) writer.WriteSafeString(sb + Environment.NewLine); }); - handlebars.RegisterHelper("Property.WriteForClass", (writer, context, parameters) => + handlebars.RegisterHelper("Property.WriteForClass", (writer, _, parameters) => { if (parameters.Length != 2) { diff --git a/uml4net.HandleBars/StringHelper.cs b/uml4net.HandleBars/StringHelper.cs index 9d26747f..c028f919 100644 --- a/uml4net.HandleBars/StringHelper.cs +++ b/uml4net.HandleBars/StringHelper.cs @@ -37,7 +37,7 @@ public static class StringHelper /// public static void RegisterStringHelper(this IHandlebars handlebars) { - handlebars.RegisterHelper("String.CapitalizeFirstLetter", (writer, context, parameters) => + handlebars.RegisterHelper("String.CapitalizeFirstLetter", (writer, _, parameters) => { if (parameters.Length != 1) { @@ -49,7 +49,7 @@ public static void RegisterStringHelper(this IHandlebars handlebars) writer.WriteSafeString(value.CapitalizeFirstLetter()); }); - handlebars.RegisterHelper("String.LowerCaseFirstLetter", (writer, context, parameters) => + handlebars.RegisterHelper("String.LowerCaseFirstLetter", (writer, _, parameters) => { if (parameters.Length != 1) { diff --git a/uml4net.HandleBars/TypeNameHelper.cs b/uml4net.HandleBars/TypeNameHelper.cs index 9106fd57..51c82ce1 100644 --- a/uml4net.HandleBars/TypeNameHelper.cs +++ b/uml4net.HandleBars/TypeNameHelper.cs @@ -41,7 +41,7 @@ public static class TypeNameHelper /// public static void RegisterTypeNameHelper(this IHandlebars handlebars) { - handlebars.RegisterHelper("POCO.TypeName", (writer, context, parameters) => + handlebars.RegisterHelper("POCO.TypeName", (writer, context, _) => { if (!(context.Value is IProperty property)) {